iphone - presenting viewController after contact has been selected in peoplePickerNavigationController? -
i having little problem -
(btw have looked on how can present modal view controller after selecting contact? didnt me)
basically want let user select contact using - peoplepickernavigationcontroller. after selection want presentmodalviewcontroller use personref data. can see "add person" method called iphone not present view.
update - works if cancel animation in dismiss dismissmodalviewcontrolleranimated , in presentmodalviewcontroller, looks pretty ugly.
this function called after user selects contact -
- (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)personref { temprecordid = abrecordgetrecordid(personref); bool hasdeletedate = [globalfunctions checktoseeifinhibye:temprecordid]; if (hasdeletedate) { [globalfunctions alert:nslocalizedstring(@"", @"") ]; }else{ [self addcustomvaluesafterselection]; [self dismissmodalviewcontrolleranimated:yes]; } return no; }
this function called still view not presenting -
- (void)addperson { nslog(@"@2"); addviewcontroller *addviewcontroller = [[addviewcontroller alloc] initwithstyle:uitableviewstylegrouped]; addviewcontroller.delegate = self; // create new managed object context new book -- set persistent store coordinator same fetched results controller's context. nsmanagedobjectcontext *addingcontext = [[nsmanagedobjectcontext alloc] init]; self.addingmanagedobjectcontext = addingcontext; [addingcontext release]; [addingmanagedobjectcontext setpersistentstorecoordinator:[[fetchedresultscontroller managedobjectcontext] persistentstorecoordinator]]; addviewcontroller.person = (person *)[nsentitydescription insertnewobjectforentityforname:@"person" inmanagedobjectcontext:addingcontext]; addviewcontroller.hibyegroupid = [datasource hibyegroupid]; uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:addviewcontroller]; [self.navigationcontroller presentmodalviewcontroller:navcontroller animated:yes]; [addviewcontroller release]; [navcontroller release]; }
thank much.
just don't dismiss people picker , present controller modally on top of it. if afterwards dismiss controller @ point dismiss people picker instead (from caller/parent) , viewcontroller dismissed too.
from apple docs:
dismissmodalviewcontrolleranimated: … if present several modal view controllers in succession, , build stack of modal view controllers, calling method on view controller lower in stack dismisses immediate child view controller , view controllers above child on stack. when happens, top-most view dismissed in animated fashion; intermediate view controllers removed stack.
Comments
Post a Comment