UIView *footView=[[UIView alloc] initWithFrame:CGRectMake(0, 0,ScreenWidth , 90)];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"8" ]forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"22" ]forState:UIControlStateHighlighted];
btn.frame=CGRectMake(0, 35, ScreenWidth, 45);
btn.userInteractionEnabled=YES;//
[btn addTarget:self action:@selector(btnSearch) forControlEvents:UIControlEventTouchUpInside];
[footView addSubview: btn];
UILabel *lab=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 45)];
lab.userInteractionEnabled = YES;//
lab.textAlignment=NSTextAlignmentCenter;
lab.textColor=white1;
lab.text=@"2012年3月1日加入";
lab.backgroundColor=[UIColor clearColor];
lab.font=[UIFont systemFontOfSize:15.0f];
[btn addSubview:lab];
[lab release];
_tableView.tableFooterView=footView;
[footView release];
本文详细介绍了如何在iOS开发中自定义一个包含按钮和标签的UI组件,通过设置按钮图片和状态变化,以及为标签添加文本信息,实现了一个具有交互性的自定义视图。重点阐述了在不同状态下UI元素的配置和布局管理。

被折叠的 条评论
为什么被折叠?



