我正在为 iPad 创建一个应用程序,我想显示一个UIPopoverController
指向它所属行的详细信息披露按钮的箭头。我想在tableView:accessoryButtonTappedForRowWithIndexPath:
方法中做到这一点。目前我有这个,有一个假人CGRect
:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
// Dismiss in the case it shows itself somewhere else
[addFeedPopup dismissPopoverAnimated:YES];
// Set up
TNSubscribeToFeedController *subscribeToFeedController = [[TNSubscribeToFeedController alloc] initWithNibName:@"SubscribeToFeed" bundle:nil];
UINavigationController *subscribeToFeedNavigationController = [[UINavigationController alloc] initWithRootViewController:subscribeToFeedController];
subscribeToFeedController.title = @"Subscribe to feed";
subscribeToFeedController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:nil];
subscribeToFeedController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:nil];
/*
* Note that we use the UINavigationController pure for the nices UINavigationBar.
*/
// Show in popup
addFeedPopup = [[UIPopoverController alloc] initWithContentViewController:subscribeToFeedNavigationController];
addFeedPopup.popoverContentSize = CGSizeMake(480, 320);
[addFeedPopup presentPopoverFromRect:CGRectMake(0, 0, 20, 20) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
// Memory
[subscribeToFeedNavigationController release];
[subscribeToFeedController release];
}
此外,当UITableView
处于编辑模式时,详细信息显示按钮位于左侧约 60 像素处,因为我使用它来设置行:
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"SectionTwoCell"] autorelease];
}
cell.textLabel.text = [NSString stringWithFormat:@"Feed %d", indexPath.row];
cell.detailTextLabel.text = @"Description";
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.editingAccessoryType = cell.accessoryType;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^//
// TWO LINES BACK DEAR SO USER //
谁能帮我解决这个问题?谢谢。
哦,是否也可以禁用滚动并禁用选择任何内容,直到UIPopoverController
关闭(完美主义)?