iPhone中点击按钮修改视图

做了一个iPhone项目。我想要通过点击按钮加载一个UIView,充填一半屏幕。

UIView *customView =[UIView alloc]initWithFrame:CGRectMake(10,100,200,200);//Give frame according to your view 
customView.backgroundColor=[UIColor greenColor];
[Self.view addSubView: customView];

可以用addSubView试试。

点击查看:http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/addSubview%3a