私はiOSGoogle Map SDK
が初めてで、ビューにマップを表示できるように取り組んでいますが、今は
UITextField
を追加して、あちらの場所を入力したい- ボタンをクリックすると、その場所が地図に表示されます
だから親切に私を助けてください。
私はiOSGoogle Map SDK
が初めてで、ビューにマップを表示できるように取り組んでいますが、今は
UITextField
を追加して、あちらの場所を入力したいだから親切に私を助けてください。
UINavigationBarにボタンを追加するか、マップ ビューの上部にUIToolBarを配置し、それをクリックして、入力を受け取るテキスト フィールドを含む UIAlertView を表示し、アラートの [OK] が押された後に、入力された場所を取得して、あなたのことをしてください。地図上にボタンを追加しないでください。使いやすさの要素が低下します。
すでにナビゲーション バーがある場合は、これを試してください
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]);
}