在GooGle地图上添加UITextField和UiButton
我是iOS新手,正在使用Google Map SDK
,能够在视图上显示地图,但是现在可以显示地图
- 我想添加一个
UITextField
并input那里的位置 - 在button上单击该位置应显示在地图上
所以,请帮助我。
我build议你在UINavigationBar上添加button,或者在地图视图的顶部放置一个UIToolBar ,然后点击它,显示带有input文本的UIAlertView,在按下提示的OK后,input地址做你的东西。 不要在地图上添加button,这会降低可用性因素。
如果你已经有一个导航栏,试试这个
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]); }
- 对于谷歌地图的iOS SDK,当前的位置偶尔得到绘制在0,0
- 像UBER一样在Google Map上移动GMSMarker
- iOS谷歌地图textField没有响应
- 如何打开谷歌地图导航url在iOS中的方向和声音?
- 用Google maps iOS sdk在swift中创build自定义信息窗口?
- 我的项目只在模拟器中运行,但不能在设备上工作,为什么?
- 更新到IOS11和Xcode9后的问题! “com.google.Maps.LabelingBehavior”,“TIC Read Status”
- 更改Google地图的选定标记或更改标记的颜色?
- 用箭头replaceGMSMapView中的蓝点 – Swift