Saturday, 15 August 2015

iphone - How do I push to new view controller with code? -



iphone - How do I push to new view controller with code? -

the app should forwards view controller based on info in database. database working fine, can't app forwards sec view controller. here's code have in place.

sssecondviewcontroller *tempview =[[sssecondviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:tempview animated:yes];

i'm not getting errors when run code screen forwards blank black view?

if have viewcontroller on storyboard can assign below code & must have set identifier viewcontroler on storyboard

sssecondviewcontroller *tempview =[self.storyboard instantiateviewcontrollerwithidentifier:@"youridentifier"];

set viewcontroller id here,in below image identifier "menuviewcontroller"

if on .xib file then

sssecondviewcontroller *tempview =[[sssecondviewcontroller alloc] initwithnibname:@"youridentifier" bundle:nil];

if want add together new viewcontroller programmetically without using available viewcontroller ,then have init initwithframe shows viewcontroller

sssecondviewcontroller *tempview =[[sssecondviewcontroller alloc] initwithframe:cgrectmake(0,0,320,480)];

sssecondviewcontroller *tempview =[[sssecondviewcontroller alloc] init]; line allocates viewcontroller, not have location draw it.

iphone ios uiviewcontroller xcode4.5

No comments:

Post a Comment