1、如果iOS的系统是11.0,tableview下移64的解决办法
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
2、cell上按钮传值
当我们在一个自定义的tableView Cell上添加一个UIButton按钮时,点击按钮使用如下方法获取对应的indexPath。
#pragma mark - 填写按钮动作/向下一个页面传值
- (void)PracticeClick:(UIButton *)button{
PractController *practice=[[PractController alloc]init];
//1. 将button强转成你自定义cell类( FollowCell是自定义cell)
FollowCell *cell = (FollowCell *)[button superview];
//2.使用tableView indexPathForCell来获取对应的indexPath
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
//3.获取cell对应的indexPath就可以实现传值了
practice.model = self.dataSource[indexPath.row];
FollowModel * teamDescModel = [self.NofollowArr objectAtIndex:indexPath.row];
if ([teamDescModel.followupStatus isEqualToString:@"0"]) {
practice.task = teamDescModel.taskId;
practice.customer = teamDescModel.customerId;
}
[self.navigationController pushViewController:practice animated:YES];
}
3、设置label/Title按钮圆角(左上和右上)
[self.Title.superview layoutIfNeeded];
UIRectCorner rectCorner = UIRectCornerTopLeft | UIRectCornerTopRight ;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.Title.bounds byRoundingCorners:rectCorner cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = path.CGPath;
self.Title.layer.mask = shapeLayer;
4、跳转到指定界面
PlusOneVC是要跳转的界面
PlusOneVC *plusVC = [[PlusOneVC alloc] init];
for (UIViewController *temp in self.navigationController.viewControllers) {
if ([temp isKindOfClass:[PlusOneVC class]]) {
[self.navigationController popToViewController:plusVC animated:YES];
}
}