Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have something similar in a prototype I wrote last week. It was a quick and dirty prototype so I actually hard coded some of this stuff. I can share it with you so you can see an example. My segue code looks like this:</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"DessertsCategory"]) { CategoryViewController *cvc = (CategoryViewController *)[segue destinationViewController]; [cvc setCategoryname:@"Desserts"]; } else if ([[segue identifier] isEqualToString:@"KidsCraftCategory"]){ CategoryViewController *cvc = (CategoryViewController *)[segue destinationViewController]; [cvc setCategoryname:@"Kids Crafts"]; } else if ([[segue identifier] isEqualToString:@"PartyCategory"]){ CategoryViewController *cvc = (CategoryViewController *)[segue destinationViewController]; [cvc setCategoryname:@"Party"]; } else if ([[segue identifier] isEqualToString:@"TrendingCategory"]){ CategoryViewController *cvc = (CategoryViewController *)[segue destinationViewController]; [cvc setCategoryname:@"Trending"]; } } </code></pre> <p>Basic stuff, look for the segue's identifier (I have a segue for each button), get the destination controller and call that setCategoryname method on it (note, that's a pretty bad name for a method. If you use properties and have a string named Categoryname the property will generate a SetCategoryname method for you when synthesize gets called. So you'll want to give that a better name like "SetValueOfCategoryName" or "UpdateCategoryNameString", whatever you want just avoid set+propertyName).</p> <p>Anyway, on my CategoryViewController that method looks like this:</p> <pre><code>-(void)setCategoryname:(NSString *)categoryName { self.categoryName = categoryName; } </code></pre> <p>Easy, you could probably just call the category name accessor instead of creating a method there. In hindsight not sure why I did it that way, other than I probably wrote it at 3am, but it works so I'll give it to you exactly as I have it. Then on my CategoryViewController my viewWillAppear method looks like this:</p> <pre><code>-(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.lblDiscover.text = self.categoryName; } </code></pre> <p>lblDiscover is one of my labels so I just set that value before it appears. You could do it in the viewDidAppear method if you wanted too, but there might be a little flicker as the text changes:</p> <pre><code>-(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; self.lblDiscover.text = self.categoryName; } </code></pre> <p>Hope that helps some. I wrote the previous answer when I was working in Windows so I had to recall it all by memory, thought it should still work though.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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