0

First of all I'm using storyboards. Currently this is an iPhone application, but in the future an iPad equivalent will also be made.

I have a UITableView containing 'People'. When clicked on them it goes to a detail page containing info on that person. That detail view consists of a UIImageView (Photo of that Person) UILabel,... AND a UITableView with 'Related' data.

That related data is: PhoneNumbers, e-mail addresses and companies for which that person works.

For the phone number and e-mail address I want a button on the cell. Pressing that button will either send the number to the phone application or the e-mail address to an e-mail form. Pressing a cell containing a company should segue to another view containing details about that company.

What is the best way to implement a button and a segue to make sure that the app doesn't "segue' to another screen when a phone number/e-mail is selected.

Glenn
  • 21
  • 1

1 Answers1

1

In your storyboard select the table and in Attribute inspector set content = dynamic prototypes, then set prototype cells = 1. Then drag and drop your button and other fields into your cell. Connect your button to your desired method to handle email/phone logic like how you'd do with any other button. For cell selection either create a segue in storyboard or do your logic in didSelectRowAtIndexPath method.

Note: to get the row number of pressed button you can do:

CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];

I hope it's clear.

Artin
  • 241
  • 4
  • 9