2014-11-03 16 views
6

UITableView kullanıyorum.UITableview Hücresi istisnası - 'Otomatik düzeltme maskesini _setHostsLayoutEngine için kısıtlamalara dönüştürmelisiniz: YES

CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink]; 

Hata alıyorum satırı budur. Bu IOS 7. çalışıyor Ama IOS 8'de uygulamayı çalıştırmak zaman

- (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; 

} 
+0

Muhtemelen http://stackoverflow.com/questions/25854095/uitableviewcell-throwing-exception – pshah

+0

ile ilgili olası http://stackoverflow.com/questions/24217195/why-do-i-get-must-translate- otomatikleştirici-maskeye-kısıtlama-için-sethost –

+0

Bana toltal cellForRowAtIndexPath kodlamasını gösterebilir misin? – user3182143

cevap

0

bu kısıtlamaları karşımıza çıkar hatayı

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

DÜZENLEME

Tam kod alıyorum . Kodu silinmiş kısıtlamalarla çalıştırmayı ve bunları tek tek yeniden eklemeyi deneyin. Burada cevap dışarı

1
+9

Herkese, 'UITableViewCell' içindeki görünümlerin tümünü ** UITableViewCell 'olarak ayarlanmadıklarını kontrol ettiğinizden emin olun. "UITableView" in dışına baktım ve "UIView" ** INSIDE ** "UITableView" (özellikle hücre), "UITableViewCell" adını verdiğimi fark ettim. –

+0

^bu yorum gerçek cevap olmalıdır .. Uygunsuz altyazının herhangi bir uygunsuz türde (sadece "UITableViewCell" değil) olabileceği ancak genel mesajın aynı olabileceği olasıdır. Alt sayfalarınızda dolaşın, sınıfları kontrol edin ve muhtemelen hatayı burada bulabilirsiniz. –