到目前为止,我已经编写了下一个代码:
UITableView *tableView = (UITableView *)iboTableView;
MovieCell *cell = (MovieCell *)[tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndex:iboImageView.tag]];
我不明白为什么代码崩溃?我知道单元格是什么类型,知道索引,并且有 iboTableView。
附言
在此功能中,一切正常:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MovieCell *cell = (MovieCell *)[tableView cellForRowAtIndexPath:indexPath];
}
编辑:
-(void)tapDetected:(UITapGestureRecognizer *)sender
{
UIImageView *iboImageView = sender.view;
UIAlertView *messageAlert = [[UIAlertView alloc]
initWithTitle:@"Row Selected" message:[NSString stringWithFormat:@"%d", iboImageView.tag] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
// Display Alert Message
[messageAlert show];
UITableView *tableView = (UITableView *)iboTableView;
NSIndexPath *index = [NSIndexPath indexPathWithIndex:iboImageView.tag];
MovieCell *cell = (MovieCell *)[tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndex:iboImageView.tag]];
//DemoTableController *controller = [[DemoTableController alloc] initWithStyle:UITableViewStylePlain];
//FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:controller];
//popover.contentSize = CGSizeMake(150,158);
//[popover presentPopoverFromView:cell.iboPopImage];
}