首页 > 移动平台 > 详细

iOS8的一些控件的变更---备用

时间:2015-10-14 23:35:31      阅读:265      评论:0      收藏:0      [点我收藏+]

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);?

iOS8的一些控件的变更---备用

原文:http://www.cnblogs.com/isItOk/p/4880975.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!