ios - Open existing view programmaticly by pushing button -


i´m new ios development , facing me seems trivial task: open view controller 2 when pushing button in view controller1. no storyboard , xib files involved, methods found web search initwithnibname, usage of segue e.a. not applicable.

thanks

update:

still struggling issue. when switching viewcontroller2 pushing button in viewcontroller1 blank (white) view opens in app. meanwhile switched using storyboard need navigation control. still no xib files in use.

here relevant code viewcontroller1.m:

#import "viewcontroller2.h"  @interface viewcontroller1 ()  @property (strong, nonatomic) iboutlet uibutton *gotoviewcontroller2;  @end  @implementation viewcontroller1  - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. }  - (ibaction)gotoviewcontroller2:(id)sender { viewcontroller2* vc2 = [[viewcontroller2 alloc] init]; [self.navigationcontroller pushviewcontroller:vc2 animated:yes]; nslog(@"went viewcontroller2"); } 

in method button;

someviewcontroller *somevc = [[someviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:somevc animated:yes]; 

that'll push new view controller on default navigationcontroller stack , animate transition.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -