我在swift UITableViewController中有以下代码,但我得到一个"必须将自动调整掩码转换为约束,以便在第二行有_setHostsLayoutEngine:YES异常.我没有更改界面构建器中的任何设置(因此都检查了Autolayout和大小类).
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell? {
let cell:TodoItemCell = tableView.dequeueReusableCellWithIdentifier("TodoItemCell", forIndexPath: indexPath) as TodoItemCell
let row = indexPath.row
cell.titleLabel.text = self.todoItems![row].title
self.callback!(row)
// Configure the cell...
return cell
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我正在使用UITableView.
CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink];
Run Code Online (Sandbox Code Playgroud)
这是我收到错误的一行.它在IOS 7中工作.但是当我在IOS 8中运行应用程序时,我收到错误
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES.
Run Code Online (Sandbox Code Playgroud)
编辑
完整代码
- (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: …Run Code Online (Sandbox Code Playgroud)