开发者

how to add a UIView file on a MainView as a subview

开发者 https://www.devze.com 2023-02-11 03:58 出处:网络
If I already have a UIViewController(no nib) on iphone,and I wanna use it on ipad. I use a IBOutlet(UIView)on ipad to show this view.

If I already have a UIViewController(no nib) on iphone,and I wanna use it on ipad. I use a IBOutlet(UIView)on ipad to show this view.

I try to set in viewDidLoad :

MacroMain开发者_如何学JAVAView *marcoview =[[MacroMainView alloc]initWithNibName:nil bundle:nil];

marcoView =[marcoview view];

[[self view]addSubview:marcoView];

but still no work.. What should I do??

Thanks in advance.


You should use loadView method for a UIViewController without a nib. UIViewController Doc

If you create your views manually, you must override this method and use it to create your views

0

精彩评论

暂无评论...
验证码 换一张
取 消