您的位置:首页 > 移动开发 > IOS开发

iOS 开发中遇到的问题

2017-05-22 17:48 274 查看

1:打印的字典或者数组中的值为 unicode 编码,转为中文

NSData *jsonData = [NSJSONSerialization dataWithJSONObject:searchType.paramasDic options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"%@",jsonStr);


2:解决UITableView系统cell分隔线起始位置

cell.separatorInset = UIEdgeInsetsMake(0, 50, 0, 0);这里的先后顺序是上左下右

3:在删除指定行的 cell 时崩溃:Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.app

//先 remove 再 delete
[self.favoriteArray removeObject:f];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];


4:cell 自带的左滑删除要实现的方法

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath   {
self.tableView.editing = !self.tableView.editing;

}
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleDelete;

}
-(NSString*)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{
return @"取消";
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: