决不想我会回答我的问题上的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