How can you pass a variable among methods?
I have one UITabBarController.
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController {
NSLog(@"my ns string %@", viewController.tabBarItem.title);
}
I need an NSString variable so that I can access it when table cells are specified in this event. The idea is that the contents of the table depend on the name of the tab.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
In other languages โโthat I'm familiar with, I always just pass variables among functions or they are variables inside a class. I'm new to Objective-C, and I'm not sure how to handle variable areas.
I read that this can be done by creating a class that is used exclusively for variables. Is this the right way to do this? Advice is welcome.
source
share