UIView相关--------------------
UIView*view=[[UIView alloc]initWithFrame:CGRectMake(3, 3, 300, 40)];
view.backgroundColor=[UIColorclearColor]; //设置view的背景色为透明色
for(UIView*subview in [cell.contentView subviews])//获取view的子视图
/ /UITabViewCell中的contentView包括textlabel和imageView
[subviewremoveFromSuperview];//从父视图中移除子视图
UIButton相关------------------------
UIButton*button;
button.frame=CGRectMake(280,12, 20, 20);
button.tag=123
UIButton*button=[UIButton buttonWithType:UIButtonTypeCustom];
//UIButton的默认类型为自定义类型UIButtonTypeCustom,此类型UIBUTTON没有图示,看不见,但是能感应事件常用来感应响应事件。因为默认是不可见,所以手动写的时候,一定要修改其类型。
[buttonsetTitle:@"Pre"forState:UIControlStateNormal];
//UIButton设置标题不是通过label.text而是用setTitle方法。很容易出错
button.alpha=0.5f;//设置透明
[button setBackgroundImage:[UIImageimageNamed:@"title.png"]
forState:UIControlStateNormal];//给buttton设置背景图片
[button
addTarget:self action:@selector(headerClick:)
forControlEvents:UIControlEventTouchUpInside];
//给控件手动增加响应动作
UITabBarItem----------------------
//UITabBarItem是导航视图下面的对多五个,的小方块
UITabBarItem*tabBar=[[UITabBarItem alloc]
initWithTitle:@"机票查询"
image:[UIImage imageNamed:@"near.png"]
tag:4];
//初始化UITabBarItem
UITabBarItem*tabBar5=[[UITabBarItem alloc]
initWithTabBarSystemItem:UITabBarSystemItemMoretag:5
tag:3];
//用系统给定的方式初始化initWithTabBarSystemItem:UITabBarSystemItemMore
UITabBarController-----------------------------
//导航下部就是UITabBarController
UITabBarController*tabBarController
tabBarController.viewControllers=allTabs;//allTabs为包含viewController的数组
tabBarController.selectedIndex=2 //指定开机默认为选中哪一个