I have a button created using the .xib file. I want the app to autoload the first question (meaning the ViewController to autoload the "showQuestion" method when the app first started. I am a beginner. How do you do it? Please help! Thanks!
ViewController.m
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ //call the init method implemented by the superclass self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; self.questions = @[@"What is your name?", @"How old are you?", @"Where are you from?"]; return self; } - (IBAction)showQuestion:(id)sender{ self.questionLabel.text = self.questions[currentIndex]; } the AppDelegate.m file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. ViewController *vc = [[ViewController alloc] init]; self.window.rootViewController = vc; return YES; }