我有一個表格視圖,當用戶選擇一個特定的行時,我想顯示一個簡單的操作表來選擇新的條目是來自現有的聯繫人,還是創建一個新的聯繫人。我顯示該動作片作爲這樣: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];'雖然沒有用,但同樣的確切行爲 –