ios - Push View Controller, Black Screen -
i'm pushing new view controller , passing data it. when run application can press button , push new view screen black. appreciated.
- (ibaction)button:(id)sender { nsstring *firstfield = self.field.text; nsstring *secondfield = self.field2.text; self.resultsarray = [[nsarray alloc] initwithobjects:firstfield, secondfield, nil]; nsuinteger randomresult = arc4random_uniform(self.resultsarray.count); self.label.text = [self.resultsarray objectatindex:randomresult]; imagesviewcontroller *ivc = [[imagesviewcontroller alloc] init]; ivc.label = self.label.text; [self.navigationcontroller pushviewcontroller:ivc animated:yes]; }
when you're using storyboard, , want push view controller in code (rather segue), need give controller identifier, , create this:
imagesviewcontroller *ivc = [self.storyboard instantiateviewcontrollerwithidentifier:@"myidentifier"]; ivc.label = self.label.text; [self.navigationcontroller pushviewcontroller:ivc animated:yes];
Comments
Post a Comment