日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

UITableView移除某一行cell的分割线

發布時間:2024/4/14 编程问答 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 UITableView移除某一行cell的分割线 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

為什么80%的碼農都做不了架構師?>>> ??

以前一直以為不能單獨去掉cell的一行分割線,所以處理特殊的UI時,甚至用嵌套UITableView,最終導致處理邏輯變得相對復雜了;

直到今天才恍然大悟,尼瑪還可以這樣去"移除"某一行的分割線,心理各種吐血.....

不多說,見代碼:

?

// // ViewController.m // CKTableView // // Created by CK on 16/5/13. // Copyright ? 2016年 CK. All rights reserved. //#import "ViewController.h"@interface ViewController ()<UITableViewDataSource> {UITableView *myTableView; } @end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];myTableView = [UITableView new];myTableView.backgroundColor = [UIColor whiteColor];myTableView.frame = self.view.bounds;myTableView.dataSource = self;[self.view addSubview:myTableView];if ([myTableView respondsToSelector:@selector(setSeparatorInset:)]) {[myTableView setSeparatorInset:UIEdgeInsetsZero];}if ([myTableView respondsToSelector:@selector(setLayoutMargins:)]) {[myTableView setLayoutMargins:UIEdgeInsetsZero];}}#pragma mark - - UITableViewDataSource- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{return 10; }- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *identity = @"displaycell";UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identity];if (!cell) {cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identity];}if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {[cell setSeparatorInset:UIEdgeInsetsZero];}if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {[cell setLayoutMargins:UIEdgeInsetsZero];}//指定隱藏第二行分割線if (indexPath.row==2) {[cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, MAXFLOAT)];}cell.textLabel.text = [NSString stringWithFormat:@"測試 %lu",indexPath.row];return cell; }@end

?

轉載于:https://my.oschina.net/sfandy/blog/674757

總結

以上是生活随笔為你收集整理的UITableView移除某一行cell的分割线的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。