开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜