ios - Passing Data to a Navigation controller inside a Tab View controller -
i'm pretty new ios development.
i have problem passing data between views in tab bar controller.
viewcontroller // first tab in tab bar number pad entering numbers label songcontroller // second tab embed within navigation controller searches database number entered in first tab , displays lyrics in web view
i'm try pass value label in viewcontroller method in songcontroller.
in viewcontroller.m
- (ibaction)gobutton:(id)sender { int songnum = [self.numberlabel.text intvalue]; nsstring *songnumber = [nsstring stringwithformat:@"%d",songnum]; if ([songnumber isequal: @"0"] || [songnumber isequal: @""]) { [self.numberlabel settext:@""]; uialertview *songnotfound = [[uialertview alloc] initwithtitle: @"sorry" message: @"this song not found." delegate: nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [songnotfound show]; } else { nslog(@"%@", songnumber); songcontroller *sing = [[songcontroller alloc]init]; sing.songnumberfromchooser = songnumber; self.tabbarcontroller.selectedindex = 1; }
the nsstring songfromnumberchooser
in songcontroller
isn't being changed. doing wrong?
it not passing data between tabs. best way use delegation pattern. let read this tutorial first. if there still doesn't work, can hack out together.
Comments
Post a Comment