Learning(一)

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];? ? ? ? ?

? ? ? } ? ? ?

}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容