我是新来的iOS和对工作的Google Map SDK
,并能够在地图上显示的看法,但现在
- 我想添加一个
UITextField
,并在那里输入位置 - 按钮上单击该位置应在地图中显示
所以,请您帮助我。
我是新来的iOS和对工作的Google Map SDK
,并能够在地图上显示的看法,但现在
UITextField
,并在那里输入位置 所以,请您帮助我。
我建议你添加的UINavigationBar的或放置在地图视图的顶部UIToolBar,然后按钮上按一下显示与文本框一个UIAlertView中是需要输入,并按下了警报的确定采取输入的位置后做你的东西。 不要在地图上添加按钮,它会降可用性的因素。
如果你有一个导航栏已,试试这个
UIBarButtonItem *locationButton = [[UIBarButtonItem alloc] initWithTitle:@"location" style:UIBarButtonItemStyleBordered target:self action:@selector(showAlertWithTextField)];
self.navigationItem.rightBarButtonItem=locationButton;
-(void)showAlertWithTextField{
UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Enter Location" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
[dialog setAlertViewStyle:UIAlertViewStylePlainTextInput];
[dialog show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1)
NSLog(@"%@",[[alertView textFieldAtIndex:0]text]);
}