views:

88

answers:

0

I am creating an application for the iPad, and I want to show an UIPopoverController with an arrow pointing to the detail disclosure button for the row it belongs to. I want to do this in the tableView:accessoryButtonTappedForRowWithIndexPath: method. Currently I have this, with a dummy 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];
}

Also, when the UITableView is in editing mode, the detail disclosure button is about 60 pixels to the left, since I use this to set up my rows:

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        //

Can anyone help me with this problem? Thanks.


Oh, and is it also possible to disable scrolling and disable selecting anything until the UIPopoverController is closed (perfectionism)?