iphone - Can not pass value of textfield to other viewcontroller in ios -


i want pass value of textfield in loginview uploadview userlogin1 null ( 0x000000) codes: loginvuew.h

@property (nonatomic,retain) iboutlet uitextfield *username; 

loginview.m

-(ibaction)loginbutton:(id)sender{  uploadview= [[uploadtab alloc] initwithframe:cgrectmake(0,0,0,0) andusertring:username.text]; } 

uploadview.h

@property (nonatomic, copy) nsstring *userlogin1; - (id)initwithframe:(cgrect)frame andusertring:(nsstring *)struser; 

uploadview.m

- (id)initwithframe:(cgrect)frame andusertring:(nsstring *)struser {     if (self) {         userlogin1=[[nsstring alloc] init];         userlogin1 = struser;      }     return self; }  - (void)viewdidload {  nslog(@"user login: %@",userlogin1);         self.navigationitem.title = [nsstring stringwithformat: @"hello, %@",userlogin1];  } 

when run in initwithframe(), string passing correct in viewdidload not correct. , userlogin1 variable 0x00000. have sugesstions? thansk in advance

you messing things think. class uploadtab ? view not have method viewdidload ! it's uiviewcontroller's one. if viewcontroller should allocate initwithnibname:bundle or smth that. added: code missing actual alloc-init method

- (id)initwithframe:(cgrect)frame andusertring:(nsstring *)struser {     // self nil here! in every cases done self = [[super alloc] initblabla]     if (self) {         userlogin1=[[nsstring alloc] init];         userlogin1 = struser;      }     return self; } 

Comments