- (void )viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBar.barTintColor = TitleCOLOR;
self.navigationController.navigationBar.translucent = NO;
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:16],
NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.view.backgroundColor = [UIColor whiteColor];
//自定義返回按鈕
UIBarButtonItem*backItem=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStyleDone target:self action:@selector(backBtn:)];
self.navigationItem.leftBarButtonItem=backItem;
// Do any additional setup after loading the view.
self.myTableView.delegate= self;
self.myTableView.dataSource = self;
self.myTableView.tableFooterView =[[UIView alloc] initWithFrame:CGRectZero];//刪除多余的cell分割線
self.myTableView.backgroundColor = BGCOLOR;
[self.myTableView registerNib:[UINib nibWithNibName:@"" bundle:nil] forCellReuseIdentifier:@""];
// self.myTableView.separatorStyle= UITableViewCellSeparatorStyleNone;//去除分割線
//這個去除分割線方法必須寫在注冊cell的后面激才。
}
-(IBAction)backItem:(id)sender{
[self.navigationController popViewControllerAnimated:YES];
self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 12;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
static NSString * strCell = @"cell";
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:strCell];
if(!cell){
cell = [[UITableViewCell alloc] initWithStyle:0 reuseIdentifier:strCell];
}
cell.textLabel.text = @" 來自夏日里的夏天的Xcode";
cell.textLabel.numberOfLines= 0;
cell.textLabel.font = [UIFont systemFontOfSize:15.0f];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;//設(shè)置cell的箭頭
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return section==0?0:8;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{
self.myTableView.estimatedRowHeight= 44.0f;
return UITableViewAutomaticDimension;
}
// 改變UITableView的headerView背景顏色為透明色
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{
view.tintColor = [UIColor clearColor];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{
[self.myTableView deselectRowAtIndexPath:indexPath animated:YES];
}
tableview常用方法
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來东跪,“玉大人畸陡,你說我怎么就攤上這事≡奖樱” “怎么了罩锐?”我有些...
- 文/不壞的土叔 我叫張陵奉狈,是天一觀的道長卤唉。 經(jīng)常有香客問我,道長仁期,這世上最難降的妖魔是什么桑驱? 我笑而不...
- 正文 為了忘掉前任,我火速辦了婚禮跛蛋,結(jié)果婚禮上熬的,老公的妹妹穿的比我還像新娘。我一直安慰自己赊级,他們只是感情好押框,可當我...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著理逊,像睡著了一般橡伞。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上晋被,一...
- 文/蒼蘭香墨 我猛地睜開眼肋联,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了刁俭?” 一聲冷哼從身側(cè)響起牺蹄,我...
- 正文 年R本政府宣布腹躁,位于F島的核電站桑包,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏纺非。R本人自食惡果不足惜哑了,卻給世界環(huán)境...
- 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望烧颖。 院中可真熱鬧弱左,春花似錦、人聲如沸炕淮。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽涂圆。三九已至们镜,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間乘综,已是汗流浹背憎账。 一陣腳步聲響...
推薦閱讀更多精彩內(nèi)容
- #pragma mark - < UITableViewDelegate> //點擊Cell時調(diào)用函數(shù) - (vo...
- 我們經(jīng)常用到的代理方法,大多是tableView必須的實現(xiàn)的宴树,這里這幾個可選的策菜,但用來處理一些小細節(jié)是非常方便的。...
- 一酒贬、cell的重用機制 1又憨、why同樣的cell會被創(chuàng)建很多次,這樣很浪費系統(tǒng)的內(nèi)存锭吨,既然是一樣的蠢莺,就可以拿來重復...
- tableView可以說是每個app中必不可少的控件,所以掌握流暢度優(yōu)化技能相當?shù)闹匾?這里總結(jié)一些常用的優(yōu)化技...