如何顯示的選項,當用戶點擊UITableViewCellAccessoryDetailDisclosureButton
我表示具有UITableViewCellAccessoryDetailDisclosureButton作爲細胞附件在一個UITableView記錄。我想顯示這些「保存」,「發送到」和「訪問」選項,當用戶點擊詳細披露按鈕,但我不知道如何做到這一點。 請幫幫我。
如何顯示的選項,當用戶點擊UITableViewCellAccessoryDetailDisclosureButton
我表示具有UITableViewCellAccessoryDetailDisclosureButton作爲細胞附件在一個UITableView記錄。我想顯示這些「保存」,「發送到」和「訪問」選項,當用戶點擊詳細披露按鈕,但我不知道如何做到這一點。 請幫幫我。
首先,你必須實現(這是由特定的選擇行不同的呼叫)
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
裏面,你使用一些像這樣的代碼:
UIMenuController *menuController = [UIMenuController sharedMenuController];
AddRouteMenuItem *menuItem = [[AddRouteMenuItem alloc] initWithTitle:@"Add to push list" action:@selector(addRouteMenuButtonPressed:)];
menuItem.indexPath = pressedIndexPath;
menuController.menuItems = [NSArray arrayWithObject:menuItem];
[menuItem release];
[menuController setTargetRect:[self.tableView rectForRowAtIndexPath:pressedIndexPath] inView:self.tableView];
[menuController setMenuVisible:YES animated:YES];
您按下指數path = indexPath
最後一點 - 是指向附件按鈕的更改指針 - (void)setTargetRect:(CGRect)targetRect inView:(UIView *)targetView
你爲什麼要發佈重複問題的答案?做一個搜索.. – mja
有時沒有太多的時間搜索之前...生病嘗試看下一次... – user170317
看看這裏:http://stackoverflow.com/questions/3833184/iphone-ipad-context-menu – mja
請張貼它作爲一個答案,讓我接受它。 :)) –