決不想我會回答我的問題上的SO,但這裏有雲:
訪問上海華的上海華和查詢indexPath部分和行屬性的伎倆。
在按鈕的目標:
-(void)showDeleteSheet:(id)sender {
NSIndexPath *indexPath = [table indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
NSInteger currentSection = indexPath.section;
NSInteger currentIndexRow = indexPath.row;
//form the actionSheet
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Delete this item?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete"
otherButtonTitles:nil];
actionSheet.tag = currentIndexRow;
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
[actionSheet release];
}
然後倒在actionSheet的clickedButtonAtIndex方法,我得到的行,我需要:答案
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{ ... doSomethingWith: actionSheet.tag }
else
{ ... user pressed cancel }
}
部分被發現in another post and,其餘here
以上失敗。請參閱下面的答案,瞭解如何執行此操作。 – 2010-04-20 01:43:59