我有一个表格视图,当用户选择一个特定的行时,我想显示一个简单的操作表来选择新的条目是来自现有的联系人,还是创建一个新的联系人。我显示该动作片作为这样:UIActionSheet不显示在弹出窗口
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row != 0 )
{
//Select the entry
}
else
{
UITableViewCell *selectedRow = [tableView cellForRowAtIndexPath:indexPath];
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"New Contact", @"Existing Contact", nil];
[sheet showFromRect:selectedRow.frame inView:tableView animated:YES];
return;
}
//Do some other stuff...
}
根据文档...
讨论
在iPad上,这种方法显示的操作片在酥料饼 其箭头指向视图的指定矩形。弹出框 不与指定的矩形重叠。
然而...行动表显示在我的视图的底部,而不是弹出到一边。 tableview是一个splitviewcontroller中的主视图
任何想法为什么这不起作用?
试过这个:'CGRect frame = [selectedRow convertRect:selectedRow.frame toView:self.view]; [sheet showFromRect:frame inView:self.view animated:YES];'虽然没有用,但同样的确切行为 –