然后实现方法:
-(IBAction) buttonTapped:(ID)sender { // create a new UIVIEw UIVIEw *newVIEw = [[UIVIEw alloc] initWithFrame:CGRectMake(10,10,100,100)]; // do something,e.g. set the background color to red newVIEw.backgroundcolor = [UIcolor redcolor]; // add the new vIEw as a subvIEw to an existing one (e.g. self.vIEw) [self.vIEw addSubvIEw:newVIEw]; // release the newVIEw as -addSubvIEw: will retain it [newVIEw release];}总结
以上是内存溢出为你收集整理的xcode – 如何在单击按钮时将UIView添加为UIViewController的子视图?全部内容,希望文章能够帮你解决xcode – 如何在单击按钮时将UIView添加为UIViewController的子视图?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)