-2
我有一個UIAlertView在「UITableViewCellEditingStyleDelete」我試圖獲取所選單元格的行中的對象,但我找到了方法。Obj-C,獲取選定的行到UIAlertview clickedButtonAtIndex方法
這是我的代碼:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
confirmBlock = [[UIAlertView alloc] initWithTitle:@"Attention" message:[NSString stringWithFormat:@"Are you sure you want to block %@ ?", splitRow[1]] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil];
[confirmBlock show];
}
,並在用戶點擊選擇的選項之一:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
// here, how can I get the objectAtIndex of the selected row ?
}
我與標註的alertview,但它不是COS的objectAtIndex工作,試圖爲一個字符串。