ios - How to switch to a existing, non-Navigation Controller-View programmable? -
i trying switch view (a totally normal view) view (also normal) programmable. here existing code:
- (ibaction)login:(id)sender { if([_username.text isequaltostring:name] && [_password.text isequaltostring:pw]) { dashboardviewcontroller *destinationcontroller = [[dashboardviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:destinationcontroller animated:yes]; }else { uialertview *message = [[uialertview alloc] initwithtitle:@"wrong username or password!" message:@"sorry." delegate:nil cancelbuttontitle:@"okay" otherbuttontitles:nil, nil]; [message show]; _password.text = nil; } }
so, want directed dashboardviewcontroller
. if try code, black, empty view shown. wrong it?
i had same problem! here solution used:
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle: nil]; dashboardviewcontroller *viewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"id"]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes];
mainstoryboard
should name of storyboard , id
should view controller id can set in storyboard.
Comments
Post a Comment