Show a UIPopoverController from a detail disclosure button in a UITableViewCell?

To do what you want, you need an accessoryView and setting the accessoryType does not create one. However, it will work if you create a button and set it as the cell.accessoryView.

Up vote 2 down vote favorite 3 share g+ share fb share tw.

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)? Iphone cocoa-touch uitableviewcell uipopovercontroller link|improve this question edited Jul 3 '10 at 13:54 asked Jul 3 '10 at 13:30WTP'--13.2k73987 73% accept rate.

To do what you want, you need an accessoryView and setting the accessoryType does not create one. However, it will work if you create a button and set it as the cell.accessoryView. Create and set the accessoryView when the cell is created: ... UIButton *disclosureButton = UIButton buttonWithType:UIButtonTypeDetailDisclosure; disclosureButton addTarget:self action:@selector(discloseDetails:) forControlEvents:UIControlEventTouchUpInside; cell.

AccessoryView = disclosureButton; ... Replace tableView:accessoryButtonTappedForRowWithIndexPath: with discloseDetails:. This looks much like what you have before so I've only put the changes below: - (void) discloseDetails:(UIButton *)sender { ... UITableViewCell *cell = (UITableViewCell *) sender. Superview; NSIndexPath *indexPath = self.

TableView indexPathForCell:cell; // if needed addFeedPopup presentPopoverFromRect:cell.accessoryView. Bounds inView:cell. AccessoryView permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES; ... } If you don't need the cell, it can be made even simpler: - (void) discloseDetails:(UIButton *)sender { ... addFeedPopup presentPopoverFromRect:sender.

Bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES; ... } Here's what it looks like.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions