动态创建View的方法,包括Button等等
2010-06-25 10:45
549 查看
创建 myView:
UIVIew *myView = [[UIView alloc] initWithFrame:CGRectMaker(0,0,100,100)];
[anyView addSubview:myView];
[myView release];
销毁myView;
[myView removeFromSuperview];
在view中创建button:
UIButton *btn = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
btn.frame = CGRectMake(60,60, 60, 60);
[self.view addSubview:btn];
在view中销 毁button:
[btn removeFromSuperview];
[btn release];
UIVIew *myView = [[UIView alloc] initWithFrame:CGRectMaker(0,0,100,100)];
[anyView addSubview:myView];
[myView release];
销毁myView;
[myView removeFromSuperview];
在view中创建button:
UIButton *btn = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
btn.frame = CGRectMake(60,60, 60, 60);
[self.view addSubview:btn];
在view中销 毁button:
[btn removeFromSuperview];
[btn release];
相关文章推荐
- Android编程动态创建视图View的方法
- Silverlight中如何自己写方法将DataTable转换为PagedCollectionView数据(动态创建类)
- C#动态创建button的方法
- swift中类方法创建button等等其他控件
- [VC & MFC] 动态创建View的几个方法
- Androoid动态创建ImageView,设置间距方法
- Android编程动态创建视图View的方法
- C#动态创建button按钮的方法实例详解
- PB动态创建DW(包括外部数据源)
- 总结了几种设置UITableView的cell动态高度的方法
- 详解Android App中创建ViewPager组件的方法
- 解决水晶报表中动态加载的图片或利用水晶报表创建的图表不显示图片的方法
- Android截屏截图方法所有方法汇总(包括Activity、View、ScrollView、ListView、RecycleView、WebView截屏截图)
- MVC在VIEW中动态控制htmlAttributes的方法
- 几种设置UITableView的cell动态高度的方法
- 关于把button加到UIImageView上后button无法响应单击事件的方法
- jQuery动态创建html元素的常用方法汇总
- UICollectionViewCell 3种创建方法
- delphi dom动态创建节点方法
- UICollectionViewCell的四种创建方法