在我的 ios 应用程序中,我想知道哪个 indexPathUITableViewCell
被选中?
基本上,我试图将朋友选择限制为 3 个朋友,因为如果选择计数大于 3,我禁用了 tableview 的用户交互。现在,如果所选行等于选中的行,我想再次启用它,以便用户可以替换通过取消选中当前选中标记的行中的任何一个来与另一个朋友成为朋友。我试过这个:-
#pragma mark Limiting number of friends selected to 3
- (void)friendPickerViewControllerSelectionDidChange:
(FBFriendPickerViewController *)friendPicker
{
if ([friendPicker.selection count] <=3)
{
self.friendPickerController.tableView.userInteractionEnabled=YES;
}
if ([friendPicker.selection count] >=3)
{
UIAlertView *maxFriendsAlert =
[[UIAlertView alloc] initWithTitle:@"Max number of friends selected."
message:@"no more friends can be selected,"
delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:@"Buy more friends",nil];
[maxFriendsAlert show];
maxFriendsAlert.tag=1;
#pragma mark disable friends selection
self.friendPickerController.tableView.userInteractionEnabled=NO;
}
//enable friend selection if selected row is equal to checkmarked row i.e. enable selection for previously checkmarked row
NSIndexPath *oldindexPath1=[self.friendPickerController.selection objectAtIndex:0];
NSIndexPath *oldindexPath2=[self.friendPickerController.selection objectAtIndex:1];
NSIndexPath *oldindexPath3=[self.friendPickerController.selection objectAtIndex:2];
if (self.friendPickerController.tableView.indexPathForSelectedRow==oldindexPath1||self.friendPickerController.tableView.indexPathForSelectedRow==oldindexPath2||self.friendPickerController.tableView.indexPathForSelectedRow==oldindexPath3)
{
self.friendPickerController.tableView.userInteractionEnabled=YES;
}
}
问题是我不知道已经选中的 uitableviewcell 的索引路径