ios - Hiding Cancel button on ABPeoplePickerNavigationController in iOS8 -
i attempting hide cancel button of abpeoplepickernavigationcontroller. following code works fine when run in ios 7.1 simulator, correctly hiding button. however, has no effect when run in ios 8.4 simulator. in both cases, log message written debugger, know code executing.
besides code, have tried subclassing abpeoplepickernavigationcontroller (even though apple docs not to) , setting button nil in viewdidload method, has no effect on ios 8 either.
googling this, there many posts asking how this, answers. however, none of answers appear work in ios 8. have tried solution suggested in following post (along many others) no success.
has found way hide cancel button of abpeoplepickernavigationcontroller in ios 8?
-(void)showpeoplepickercontroller { abpeoplepickernavigationcontroller *picker = [[abpeoplepickernavigationcontroller alloc] init]; picker.peoplepickerdelegate = self; picker.delegate = self; // display person's phone, email, , birthdate nsarray *displayeditems = [nsarray arraywithobjects:[nsnumber numberwithint:kabpersonphoneproperty], [nsnumber numberwithint:kabpersonemailproperty], [nsnumber numberwithint:kabpersonbirthdayproperty], nil]; picker.displayedproperties = displayeditems; // show picker [self presentviewcontroller:picker animated:yes completion:nil]; } -(void)navigationcontroller:(uinavigationcontroller *)navigationcontroller didshowviewcontroller:(uiviewcontroller *)viewcontroller animated:(bool)animated { nslog(@"attempting hide cancel button..."); navigationcontroller.topviewcontroller.navigationitem.rightbarbuttonitem = nil; }
Comments
Post a Comment