對我來說這看起來很簡單,但我無法理解我正在犯的錯誤。我必須在iPad應用程序的點擊行中打開彈出窗口。我做了以下代碼:在打開popviewcontroller時出錯
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
popViewController *vc = [[popViewController alloc] initWithNibName:@"popViewController" bundle:nil];
vc.preferredContentSize = CGSizeMake(500,500);
vc.view.frame = CGRectMake(0, 0, 500, 500);
UIPopoverController *healthPopOver = [[UIPopoverController alloc] initWithContentViewController:vc];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[healthPopOver presentPopoverFromRect:cell.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
當最後一行執行時,應用程序崩潰。我在谷歌搜索了很多頁面,但我無法找到它的原因。我沒有得到任何特定的錯誤,只有主文件中的線程1錯誤。 有人可以幫助我嗎。這讓我感到沮喪。順便說一句我正在使用iOS7。
問候
潘卡
可以打印錯誤? –
問題在於不保留彈出窗口。按@null建議保留popover。 – 2013-09-26 08:24:36