Add subview to another view

Posted by Martol1ni on Stack Overflow See other posts from Stack Overflow or by Martol1ni
Published on 2012-04-15T22:30:02Z Indexed on 2012/04/15 23:28 UTC
Read the original article Hit count: 231

With two ViewControllers, MyView 1 and MyView 2, is there possible to add a subview to MyView2 from MyView1.m?

I have tried:

MyView2 * screen = [[MyView2 alloc]initWithNibName:nil bundle:nil];
[screen.view addSubView:mySubView];

But my new instance of MyView 2 has no connection to the 'visible' ViewController on MyView2, right?

To clarify, the ViewController that is showing, is MyView1. I want MyView1 to be able to add a subview to the MyView2 view.

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode