【发布时间】:2013-11-14 19:43:29
【问题描述】:
在 tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath 我插入了一个 alertView,其中包含一个文本,该文本会根据单击的单元格而变化..
“发送”按钮的动作 nell'alertView 必须保存所选单元格中存在的标签内容。
附:我正在使用 Parse.com
到目前为止,一切正常,但我只有一个问题,保存的数据不正确,因为它们不是所选单元格的数据,而是表格视图中第一个单元格的数据......我没有保存更多。 . 只有这个..
Nell'IndexPath' 做错了什么?你能帮我识别选中的单元格all'alertview吗?
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if ( buttonIndex ==0) {
NSLog(@"ritorno");
}
else {
NSArray *indexes = [self.TableView indexPathsForSelectedRows];
for (NSIndexPath *indexPath in indexes) {
PFUser *user = [self.Utenti objectAtIndex:indexPath.row];
PFObject *RichiestaAmicizia = [PFObject objectWithClassName:FF_AMICIZIE_CLASS];
[RichiestaAmicizia setObject:[PFUser currentUser] forKey:FF_AMICIZIE_DA_USER];
[RichiestaAmicizia setObject:user forKey:FF_AMICIZIE_A_USER];
[RichiestaAmicizia setObject:@"In_Attesa" forKey:FF_AMICIZIE_STATO];
[RichiestaAmicizia saveInBackground];
}
NSLog(@"Send");
}
}
【问题讨论】:
-
是否要获取所有选定的行?还是只有一个?被点击的那个?
-
我希望当我点击发送(nell'alertView)时,保存的数据是正确单元格的数据。
标签: ios uitableview uialertview didselectrowatindexpath nsindexpath