ios - viewController and pushViewcontroller not working? -


i trying pushviewcontroller in ios.but execution result following

my fist view

second view

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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -