ios - Push View Controller - Button Action sending from one view controller to another -


i looking make action button view coontroller. when button pressed, user sent view controller.

however, when running simulator , clicking button, not going next view controller. (the next view controller dashboard).

here .h file , .m file

`//  viewcontroller.h //  shopping list // //  created seenu on 2/8/16. //  copyright © 2016. rights reserved. //  #import <uikit/uikit.h>  @interface viewcontroller : uiviewcontroller  @property (weak, nonatomic) iboutlet uilabel *login; @property (weak, nonatomic) iboutlet uitextfield *emailtextfield; @property (weak, nonatomic) iboutlet uilabel *password; @property (weak, nonatomic) iboutlet uitextfield *passwordtextfield; @property (weak, nonatomic) iboutlet uibutton *button;  - (ibaction)signin:(id)sender;   @end`//  // //  viewcontroller.m //  shopping list // //  created seenu on 2/8/16. //  copyright © 2016. rights reserved. //  #import "viewcontroller.h" #import "dashboard.h"  @interface viewcontroller ()  @end  @implementation viewcontroller  @synthesize button;  - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib.  } - (ibaction)signin:(id)sender { dashboard *home = [[dashboard alloc] initwithnibname:@"dashboard" bundle:nil]; [self.navigationcontroller pushviewcontroller:home animated:yes]; }  - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. }  @end 

make sure view controller have navigation controller. easy way of doing create navigation controller in applicationdidfinishlaunchingwithoptions in appdelegate class. set first view controller rootviewcontroller of navigationcontroller , add window. go appdelegate class , add code on there.

- (bool)application:(uiapplication *)application  didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point customization after application launch.     uiviewcontroller *rootcontroller =           [[rootviewcontroller alloc]           initwithnibname:@"rootviewcontroller" bundle:nil];      uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc]                  initwithrootviewcontroller:rootcontroller];      self.window = [[uiwindow alloc]          initwithframe:[[uiscreen mainscreen] bounds]];     [self.window addsubview:navigationcontroller.view];     [self.window makekeyandvisible];     return yes;  } 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -