iOS8 下的一些方法等的变化

参考

1. 地图定位问题,委托方法无法调用

  1. _locationManager = [[CLLocationManager alloc] init];
    [_locationManager setDelegate:self];
    [_locationManager requestAlwaysAuthorization]; //这一步是ios8新增加的
    [_locationManager startUpdatingLocation];

  2. 在info.plist 里增加字段(NSLocationWhenInUseUsageDescription和NSLocationAlwaysUsageDescription)

info.plist

3.增加委托方法

  • (void)locationManager:(CLLocationManager*)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
    {
    switch (status) {
    case kCLAuthorizationStatusNotDetermined:
    if ([location respondsToSelector:@selector(requestAlwaysAuthorization)]) {
    [locationrequestAlwaysAuthorization];
    }
    break;
    default:
    break;
    }
    }

2. Xcode6在iPhone5+iOS7模拟器上编译,上下有黑边问题的解决方案


3. 使用autolayout来动态确定uitableviewcell的高度(这种方法只有在ios8里可用)参考

_tableView.estimatedRowHeight = 200;
_tableview.rowHeight = UITableViewAutomaticDimension;

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

  [cell.contentView layoutIfNeeded];(这句需要加上)

}

不用-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;这个委托方法来设置高度了。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容