KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have some code that I would like to run only once in my MainViewController. It should run every time the user starts the app, but only after the MainViewController has loaded. I don't want to run it in -(void)applicationDidFinishLaunching:(UIApplication *)application . Here's the idea I had: MainViewController.h @interface IpadMainViewController : UIViewController <UISplitViewControllerDelegate> { BOOL hasRun; } @property (nonatomic, assign) BOOL hasRun; MainViewController.m @synthesize hasRun; -(void)viewDidLoad { [super viewDidLoad]; if (hasRun == 0) { // Do some stuff hasRun = 1; } } Any ideas?
Tags (comma-separated)
Save Edits
Cancel