1、如果iOS的系統(tǒng)是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上按鈕傳值
?當(dāng)我們在一個自定義的tableView Cell上添加一個UIButton按鈕時,點擊按鈕使用如下方法獲取對應(yīng)的indexPath。
?#pragma mark - 填寫按鈕動作/向下一個頁面?zhèn)髦?/h4>
?- (void)PracticeClick:(UIButton *)button{? ??
PractController *practice=[[PractController alloc]init];???
//1. 將button強轉(zhuǎn)成你自定義cell類( FollowCell是自定義cell)? ?
FollowCell *cell = (FollowCell *)[button superview];? ?
?//2.使用tableView indexPathForCell來獲取對應(yīng)的indexPath? ?
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];??
//3.獲取cell對應(yīng)的indexPath就可以實現(xiàn)傳值了? ?
?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、設(shè)置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、跳轉(zhuǎn)到指定界面
PlusOneVC是要跳轉(zhuǎn)的界面
PlusOneVC *plusVC = [[PlusOneVC alloc] init];
for (UIViewController *temp in self.navigationController.viewControllers) {
? ? if ([temp isKindOfClass:[PlusOneVC class]]) {
? ? ? ? [self.navigationController popToViewController:plusVC animated:YES];? ? ? ? ?
? ? ? } ? ? ?
}
?- (void)PracticeClick:(UIButton *)button{? ??
PractController *practice=[[PractController alloc]init];???
//1. 將button強轉(zhuǎn)成你自定義cell類( FollowCell是自定義cell)? ?
FollowCell *cell = (FollowCell *)[button superview];? ?
?//2.使用tableView indexPathForCell來獲取對應(yīng)的indexPath? ?
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];??
//3.獲取cell對應(yīng)的indexPath就可以實現(xiàn)傳值了? ?
?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];?? ?
}?
?[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;
PlusOneVC是要跳轉(zhuǎn)的界面
PlusOneVC *plusVC = [[PlusOneVC alloc] init];
for (UIViewController *temp in self.navigationController.viewControllers) {
? ? if ([temp isKindOfClass:[PlusOneVC class]]) {
? ? ? ? [self.navigationController popToViewController:plusVC animated:YES];? ? ? ? ?
? ? ? } ? ? ?
}