In the viewController class I want to make a draw method that adds an UIImageView to the main view as a subview. Now how do I get the View object from the app so that I can invoke the draw method on that specific view in the method of another class. Also Where in the code is the view instantiated that pops up on my iphone when I start the app by default?
Thank you very much.
I would recommend getting a more firm grasp of views and view controllers in the docs:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009503-CH1-SW2
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/AboutViewControllers/AboutViewControllers.html
But, if you need to access the view from your viewController, it’s as simple as accessing the view property:
[myViewController.view addSubview:someOtherView];Regarding your question about where the root view is instantiated, it depends on whether or not you’re using a XIB to design your interface. If you want to modify the view controller’s view in code, override the view controller’s
viewDidLoadand make sure you call[super viewDidLoad]first.If you want to select a different view controller at startup, you can do so in the app delegate in
application: didFinishLaunchingWithOptions: launchOptionssince this is where the app assigns its window and rootViewController properties.