UITableview Cell异常 - '必须将自动调整掩码转换为约束才能使_setHostsLayoutEngine:YES [英] UITableview Cell exception - 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES

查看:858
本文介绍了UITableview Cell异常 - '必须将自动调整掩码转换为约束才能使_setHostsLayoutEngine:YES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UITableView。

I am using the UITableView.

 CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink];

这是我收到错误的行。它在IOS 7中运行。但是当我在IOS 8中运行应用程序时,我收到错误

This is the line I am getting the error. It is working in IOS 7. But when I run the application in IOS 8 I am getting the error

** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES.

编辑

完整代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifierImageLink = @"NewsImageAndLink";
    static NSString *CellIdentifierImage = @"NewsImage";
    static NSString *CellIdentifierLink = @"NewsLink";
    static NSString *CellIdentifier = @"NewsDescription";

    NSString *image=[[_news objectAtIndex:indexPath.row] valueForKey:@"imageURL"];
    NSString *link=[[_news objectAtIndex:indexPath.row] valueForKey:@"link"];
    NSString *description=[[_news objectAtIndex:indexPath.row] valueForKey:@"description"];
    NSString *date=[[_news objectAtIndex:indexPath.row] valueForKey:@"date"];
    NSString *title=[[_news objectAtIndex:indexPath.row] valueForKey:@"title"];

    NSMutableString *html = [NSMutableString stringWithString: @""];

    //continue building the string
    [html appendString:@"<html><body>"];
    [html appendString:description];
    [html appendString:@"</body></html>"];

     SDWebImageManager *manager = [SDWebImageManager sharedManager];

    if (image !=(NSString *)[NSNull null] && link !=(NSString *)[NSNull null]) {

        CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImageLink];
        cell.lblHeading.text=title;

        NSURL *url = [NSURL URLWithString:image];

        [manager downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {

        } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {

            cell.newsImage.image = image;

        }];

        if (date !=(NSString *)[NSNull null] ) {
            cell.lblDate.text=date;
        }

        //pass the string to the webview
        [cell.webView loadHTMLString:[html description] baseURL:nil];

        cell.lblLink.text=link;


        return cell;
    }
    else if (image !=(NSString *)[NSNull null] && link==(NSString *)[NSNull null]) {

        CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImage];


        cell.lblHeading.text=title;

        NSURL *url = [NSURL URLWithString:image];

        [manager downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {

        } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {

            cell.newsImage.image = image;

        }];


        if (date !=(NSString *)[NSNull null] ) {
            cell.lblDate.text=date;
        }

        [cell.webView loadHTMLString:[html description] baseURL:nil];

        return cell;

    }
    else if (image ==(NSString *)[NSNull null] && link!=(NSString *)[NSNull null]) {

        CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink];

        cell.lblHeading.text=title;

        if (date !=(NSString *)[NSNull null] ) {
            cell.lblDate.text=date;
        }
        //cell.txtDescription.text=description;
        //pass the string to the webview
        [cell.webView loadHTMLString:[html description] baseURL:nil];
        cell.lblLink.text=link;
        return cell;

    }
    else if (image ==(NSString *)[NSNull null] && link==(NSString *)[NSNull null]) {
        CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        cell.lblHeading.text=title;

        if (date !=(NSString *)[NSNull null] ) {
            cell.lblDate.text=date;
        }
        //cell.txtDescription.text=description;
        //pass the string to the webview
        [cell.webView loadHTMLString:[html description] baseURL:nil];

        return cell;

    }
    return nil;

}


推荐答案

退房答案在这里:为什么呢我得到必须将自动调整掩码转换为约束以使_setHostsLayoutEngine:YES在xcode 6 beta

这暂时为我解决了这个问题。

This solved it for me temporarily.

这篇关于UITableview Cell异常 - '必须将自动调整掩码转换为约束才能使_setHostsLayoutEngine:YES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆