您的位置:首页 > 其它

动态创建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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: