iOS项目问题汇总<二>

来源:互联网 发布:平面装修设计软件 编辑:程序博客网 时间:2024/06/05 02:40

1.出现如下报错:
invalid nib registered for identifier (CELLNAME) - nib must contain exactly one top level object which must be a UITableViewCell instance。
用xib做View时,上面可能添加一些控件没有删除,仍然在界面上也没有关联,这时应该在xib界面查找这些未删除的控件并删掉就可以了
2.时间戳转化为当地时间

 //时间戳转换为时间    NSString * str =[NSString stringWithFormat:@"%ld",science.updateline] ;//时间戳    NSTimeInterval time = [str doubleValue]+28800;//时差问题差8小时    NSDate * detailDate = [NSDate dateWithTimeIntervalSince1970:time];    //实例化一个NSDateFormatter对象    NSDateFormatter * dateFormatter = [[NSDateFormatter alloc]init];    //设定时间格式    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];    NSString * currentDate = [dateFormatter stringFromDate:detailDate];

3.
出现错误:UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath / Assertion failure messages
原因cell没写identifier,或者注册cell写错了identifier,亦或没有建立cell…

0 0