i have application uses "navigation-based application" template in xcode.
now want change first view loads regular (custom) uiview, , if user clicks particular button, push original rootviewcontroller onto navigationcontroller.
i understand somewhere, calling rootviewcontroller:
- (id)initwithrootviewcontroller:(uiviewcontroller *)rootviewcontroller i want know how replace argument new class.
if want replace root view controller of navigation stack can replace first object of view controllers array -
nsmutablearray *viewcontrollers = [nsmutablearray arraywitharray:[self.navigationcontroller viewcontrollers]]; newviewcontroller *nvc = [[newviewcontroller alloc] init]; [viewcontrollers replaceobjectatindex:0 withobject:nvc]; [self.navigationcontroller setviewcontrollers:viewcontrollers];
Comments
Post a Comment