TABLE

#pragma mark- TableView Delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 1;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return 5;

}

- (CGFloat)tableView:(UITableView* )tableView heightForRowAtIndexPath:(NSIndexPath* )indexPath{

return 55;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *cellIdentity = @"registerCellId";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentity];

UILabel *name=[[UILabel alloc]initWithFrame:CGRectMake(15, 15, K_SCREEN_WIDTH/4, 25)];

UIButton *btn =[[UIButton alloc]initWithFrame:CGRectMake(15+K_SCREEN_WIDTH/4, 15, 50, 25)];

UIButton *btn1 =[[UIButton alloc]initWithFrame:CGRectMake(15+(K_SCREEN_WIDTH/4)*2, 15, 50, 25)];

UIButton *btn2 =[[UIButton alloc]initWithFrame:CGRectMake(15+(K_SCREEN_WIDTH/4)*3, 15, 50, 25)];

if (!cell) {

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentity];

name.font=[UIFont systemFontOfSize:14];

name.textColor=[UIColor blackColor];

btn.tag=6666+indexPath.row;

btn1.tag=7777+indexPath.row;

btn2.tag=8888+indexPath.row;

[btn addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];

[btn1 addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];

[btn2 addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];

[btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

[btn1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

[btn2 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

//? ? ? ? [btn3 setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];

[cell.contentView addSubview:name];

[cell.contentView addSubview:btn];

[cell.contentView addSubview:btn1];

[cell.contentView addSubview:btn2];

//? ? ? ? [cell.contentView addSubview:btn3];

}

name.text=@"陳陳陳";

[btn setTitle:@"1" forState:UIControlStateNormal];

[btn1 setTitle:@"1" forState:UIControlStateNormal];

[btn2 setTitle:@"1" forState:UIControlStateNormal];

//? ? [btn3 setTitle:@"1" forState:UIControlStateNormal];

cell.selectionStyle = UITableViewCellSelectionStyleNone;

return cell;

}

- (void)btn:(UIButton*)sender

{

NSLog(@"%ld",sender.tag);

}

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

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

  • // AppDelegate.m #import "ViewController.h" #import "LVi...
    leaderleader閱讀 536評(píng)論 0 0
  • iOS開發(fā)系列--網(wǎng)絡(luò)開發(fā) 概覽 大部分應(yīng)用程序都或多或少會(huì)牽扯到網(wǎng)絡(luò)開發(fā),例如說新浪微博、微信等,這些應(yīng)用本身可...
    lichengjin閱讀 4,039評(píng)論 2 7
  • 打印View所有子視圖 layoutSubviews調(diào)用的調(diào)用時(shí)機(jī) 當(dāng)視圖第一次顯示的時(shí)候會(huì)被調(diào)用當(dāng)這個(gè)視圖顯示到...
    hyeeyh閱讀 585評(píng)論 0 3
  • 使用步驟 要想顯示一個(gè)UIPopoverController,需要經(jīng)過下列步驟 設(shè)置內(nèi)容控制器 由于UIPopov...
    JonesCxy閱讀 1,275評(píng)論 0 2
  • 隨著過年的腳步越來越近,最熱鬧的年貨采辦時(shí)候也到來了。每當(dāng)這時(shí),大人們忙里忙外,小孩子們卻相當(dāng)興奮,茶幾上,桌子上...
    張偉娓娓道來閱讀 336評(píng)論 0 3

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