正文
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
#####6.tableview数组越界
-
使用懒加载的数组只创建一次刷新数据的时候要记得移除所有的数组元素
[self.dataArray removeAllObjects];
-
判断数组为空时候的越界问题当首次数据没有请求完毕的时候[tableVIew reloadData];就会导致crash这个时候需要做一次判断:
if(self.dataArray.count != 0){
MOdel * model = self.dataArray[indexPath.row];
}
-
有时候会出现上拉加载更多后点击下拉出现crash 这个时候提示数组越界但是并不是真的越界 因为这个时候的indexpath.row > 数组的元素个数的。所以需要以下处理
if(!(indexPath.row > rewardArray.count)){
Model* model = slef.dataArray[indexpath.row];
}
#####7.textfiled占位语的设置
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSForegroundColorAttributeName] = [Toolkit getColor:@"ff5600"];
NSMutableAttributedString *placeHolder = [[NSMutableAttributedString alloc]initWithString:@" 请输入支付密码" attributes:attrs];
_zhifuTextField.attributedPlaceholder = placeHolder;
#####8. 禁止屏幕滑动返回
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// 禁用返回手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
#####9.label中划线设置
//中划线
NSMutableAttributedString *attribtStr_origin = [[NSMutableAttributedString alloc]initWithString:originalMoney attributes:attribtDic];
[attribtStr_origin setAttributes:@{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle], NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle),NSForegroundColorAttributeName:[Toolkit getColor:hex_aaaaaa]} range:NSMakeRange(0,attribtStr_origin.length)];
[attribtStr_origin addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"GillSans"