2013-10-21 42 views

回答

2

我建議你添加的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]); 
} 
+0

K I得到了UR點兄弟,u能請給我如何在textfeild進入的地方進行搜索在谷歌地圖視圖的任何樣品。 –

+0

k thanx brother .... –

+0

它運作?如果是這樣,請接受/提出答案。 – satheeshwaran