Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your question isn't that clear. In general you can set the title of the current view to be any NSString object, so </p> <pre><code>self.title = string; </code></pre> <p>However what I'm guessing your asking is whether you can set the tile of a view which is created and brought into view when you click on a <strong>UITableViewCell</strong>. If so the answer is yes you can. You can do this in the <strong>tableView:didSelectRowAtIndexPath:</strong> method of your view controller when you create the new view.</p> <p>You need to pass either the <strong>indexPath</strong> variable or the text label from the cell <strong>cell.textLabel.text</strong> into a custom init method. So if you had a view controller called <strong>nextController</strong> for instance you'd do something like,</p> <pre><code>NextController *next = [[NextController alloc] initWithIndexPath: indexPath]; [appDelegate.navController pushViewController:next animated: YES]; [next release]; </code></pre> <p>inside the <strong>tableView:didSelectRowAtIndexPath:</strong> method of your main controller. Then in your <strong>NextController</strong> class you'd override the <strong>init</strong> method along the these lines,</p> <pre><code>-(id)initWithIndexPath: (NSIndexPath *)indexPath { if ( self == [super init] ) { indexVariable = indexPath; } return self; } </code></pre> <p>after declaring the <strong>indexVariable</strong> in you <strong>@interface</strong>. The all you need to do is set the title of your new view form the <strong>viewDidLoad:</strong> method of your new controller, either grabbing the cell's label using the <strong>NSIndexPath</strong> or directly if you passed the label instead.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload