我有一個按鈕添加到註釋標記爲地圖視圖頁面在我iPhone應用程序傳遞數據的方法,當一個按鈕被竊聽
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(go_to_detail_page:)
forControlEvents:UIControlEventTouchUpInside];
annView.rightCalloutAccessoryView = rightButton;
和我的接收功能是
-(IBAction)go_to_detail_page:(id)sender;{
}
我的問題如下。我在頁面上創建了很多標記,當按下特定的註釋視圖按鈕時,我想傳遞一個唯一的標識符,即使是一個字符串也可以。一旦註解被按下,我怎樣才能將一個字符串傳遞給go_to_detail_page
方法?
爲什麼不使用「發件人」進行識別?該按鈕本身作爲其動作選擇器的參數傳遞。 – 2012-12-31 11:21:24
對不起,我該怎麼做?謝謝 – user1096447
@ user1096447:請使用良好的命名約定... camelCase用於方法名稱。 –