ios - viewController and pushViewcontroller not working? -
i trying pushviewcontroller in ios.but execution result following


when hit button make transition view view b. here code view a
#import <uikit/uikit.h> #import "viewcontrollerb.h" @interface viewcontrollera : uiviewcontroller -(ibaction)next:(id)sender; @end in .m file
#import "viewcontrollera.h" @interface viewcontrollera () @end @implementation viewcontrollera - (void)viewdidload { [super viewdidload]; // additional setup after loading view. } -(ibaction)next:(id)sender { viewcontrollerb *viewcontroller=[[viewcontrollerb alloc]init]; viewcontroller.string=@"tunvir"; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; } @end in viewcontroller b
@interface viewcontrollerb : uiviewcontroller @property (nonatomic,strong)nsstring *string; @end in .m file
#import "viewcontrollerb.h" @interface viewcontrollerb () @end @implementation viewcontrollerb @synthesize string=_string; - (void)viewdidload { [super viewdidload]; // additional setup after loading view. } @end in want set string in viewb "tunvir" , load object viewb. lot of warning appears.why happening , how fix this?thanks
if need set title navigationbar of viewcontrollerb'
- (void)viewdidload { [super viewdidload]; // additional setup after loading view. self.navigationitem.title = @"title navigationbar"; } edit use if ur using storyboard
-(ibaction)next:(id)sender { uistoryboard *storyboard = [[uistoryboard storyboardwithname:@"mainstoryboard" bundle:null] uiviewcontroller *viewcontrollerb = [storyboard instantiateviewcontrollerwithidentifier:@"viewcontrollerb"]; [[self navigationcontroller] pushviewcontroller:viewcontrollerb animated:yes]; }
Comments
Post a Comment