ios - Cannot assign values in iphone version of program -
ios - Cannot assign values in iphone version of program -
i attempting create ipad app universal. havinng little issue. have code. in masterviewcontroller , depending on country selected, said country passed detailviewcontroller , country loaded in detailview.
my problem that, when code run on iphone, activecountry null. when run on ipad has value. have selected right class iphone version , im not sure why have detailviewcontroller view in iphone storyboard.
my question hence is, stopping me passing value self.detailviewcontroller.activecountry.
would love help issue.
thanks
ps. ipad detailview controller on ipad version detailversion of uisplitview controller.
if (ui_user_interface_idiom() == uiuserinterfaceidiomphone) { lat = 15.4166152; lon =-61.353149; [self.detailviewcontroller animatetoposition:maplycoordinatemakewithdegrees(lon,lat) time:1.0 height:0.1]; thridviewcontroller *thrid=[[thridviewcontroller alloc]init]; [self.navigationcontroller pushviewcontroller:thrid animated:yes]; [thrid settitle:@"america"]; self.detailviewcontroller.activecountry=@"america"; nslog(@"the active country %@",self.detailviewcontroller.activecountry); } else { lat = 15.4166152; lon =-61.353149; [self.detailviewcontroller animatetoposition:maplycoordinatemakewithdegrees(lon,lat) time:1.0 height:0.1]; thridviewcontroller *thrid=[[thridviewcontroller alloc]init]; [self.navigationcontroller pushviewcontroller:thrid animated:yes]; [thrid settitle:@"america"]; self.detailviewcontroller.activecountry=@"america"; nslog(@"the active country %@",self.detailviewcontroller.activecountry); }
}
update think notice wrong.
in app delegate, in code says ipad running phone call init on detailview controller in iphone no such thing. cause im not sure how. because detailviewcontroller doesnt start off beingness seen.
update-app delegate
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [dbaccess copydatabaseifneeded]; if (ui_user_interface_idiom() == uiuserinterfaceidiomphone) { //place iphone code } else { // place ipad-specific code here... masterviewcontroller *left=[[masterviewcontroller alloc]init]; uinavigationcontroller *navigleft=[[uinavigationcontroller alloc]initwithrootviewcontroller:left]; detailviewcontroller *detail=[[detailviewcontroller alloc]init]; uinavigationcontroller *navigright=[[uinavigationcontroller alloc]initwithrootviewcontroller:detail]; left.detailviewcontroller = detail; uisplitviewcontroller *splitviewcontroller=[[uisplitviewcontroller alloc]init]; splitviewcontroller.delegate=detail; splitviewcontroller.viewcontrollers=[nsarray arraywithobjects:navigleft,navigright,nil]; } homecoming yes; }
well, first question be: why duplicating much code iphone , ipad? in general, need set different in conditional statements - ui specific code. set device specific in conditionals , leave commonly used code outside, devices use. may prepare problem right there.
if doesn't solve issue, insert breakpoint at:
self.detailviewcontroller.activecountry=@"america";
and print value for: self.detailviewcontroller self.detailviewcontroller.activecountry , allow know say.
ios iphone objective-c
Comments
Post a Comment