objective c - Navigation Controller not working when enabling ARC in xcode 5 and using ios 7 -
i enabled arc , using ios 7 app.with out using xib doing programming.but unable navigate 1 view controller view controller.created obj in .h file class.
in .h file @property(nonatomic,strong)countriesviewcontroller *countryviewcontroller;
in .m file in button action.
countryviewcontroller = [[countriesviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:countryviewcontroller animated:yes];
you need add navigation controller in appdelegate this,
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.viewcontroller = [[yourviewcontroller alloc] initwithnibname:@"yourviewcontroller" bundle:nil]; self.navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:self.viewcontroller]; self.window.rootviewcontroller = self.navigationcontroller; [self.window makekeyandvisible]; return yes; }
in viewcontroller, navigate this,
self.countryviewcontroller = [[countriesviewcontroller alloc]initwithnibname:@"countriesviewcontroller" bundle:nil]; [self.navigationcontroller pushviewcontroller:self.countryviewcontroller animated:yes];
Comments
Post a Comment