Hi,
On Mon, Apr 29, 2013 at 01:12:20AM -0400 or thereabouts, Austin Seraphin wrote:
> A view controller can only have one view, and you can access this through the view method. Remember that views have subviews, and all of these descend from UIView. So you want to make your search form and list two separate UIView objects. Then in the controller's code just use self.view.addSubview(@search_view) and self.view.addSubview(@list_view)
>
> And then you can just assign that as the root view controller of the navigation controller. This part took me a while to get my head around. Geomotion helped.
Thanks for the suggestion Austin! :)
I´m not exactly sure how to implement it. Thought it would be smart to have a FrontpageController which can load the SearchController that should be positioned on the top, and the VenueController that´s supposted to be below.
As you might have guessed, that did not work. I´d like to keep the what I have in the VenueController separated from what´s in the SearchController, if that´s possible. It would be fantastic if you could give me an example, I´m a bit lost right now. :-|
>>> class AppDelegate
>>> def application(application, didFinishLaunchingWithOptions:launchOptions)
>>> @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
>>>
>>> @frontpage_controller = FrontpageController.alloc.initWithNibName(nil, bundle:nil)
>>> @navigation_controller = UINavigationController.alloc.initWithRootViewController( @frontpage_controller )
>>>
>>> @window.rootViewController = @navigation_controller
>>> @window.makeKeyAndVisible
>>> true
>>> end
>>> end
>>> class FrontpageController < UIViewController
>>> def viewDidLoad
>>> super
>>> self.title = "Frontpage"
>>>
>>> @search_controller = SearchController.alloc.initWithNibName(nil, bundle:nil)
>>> @venue_controller = VenueController.alloc.initWithNibName(nil, bundle:nil)
>>>
>>> # This does not work:
>>> self.view.addSubview(@search_controller)
>>> self.view.addSubview(@venue_controller)
>>> end
>>> end