UISearchDisplayController变更为UISearchController
UIAlertView变更为UIAlertController
如果添加点击事件则需要使用UIAlertController其中的- (void)addAction:(UIAlertAction *)action;
那么其中的UIAlertAction则需要添加相应的事件即可
继续示例如下
UIAlertController*alert=[UIAlertController alertControllerWithTitle:@"提示"message:@"现在返回将不保存校准数据,点击确定则保存数据"preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertActionactionWithTitle:@"取消"style:UIAlertActionStyleCancelhandler:^(UIAlertAction *action) {
NSLog(@"取消");
}]];
[alert addAction:[UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *action) {
NSLog(@"确定");
}]];
[selfpresentViewController:alert animated:YEScompletion:nil];
总体说来呢这次的变化,以前是加载windows上,现在是在viewController。一定程度上简化了控件之间的逻辑,并且把代理取消了,转而使用block来进行替代,可见苹果未来的趋势是在砍掉代理这个事情
iOS8有史以来最坑爹的版本了,在iOS8下,获取系统通讯录,会导致无回调,原因是他的2个原来的方法被删除了
iOS7的方法
(void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
- (BOOL) peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { return NO; }
iOS8的方法
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person NS_AVAILABLE_IOS(8_0);// Called after a property has been selected by the user.- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier NS_AVAILABLE_IOS(8_0);