1

This relates to a question I asked a few days ago: iOS: Setting text in nib subview from view in UITabBar/UINavigationController application

I need to put the search bar and buttons on the top right of a navigation controller, this is more than the standard single button that UINavigationController.navigationItem.rightBarButtonItem allows so I am using the initWithCustomView: method of UIBarButtonItem to load a view from a nib file.

In my particular case, i've put the view as a seperate item in the main view file for that form

The problem i've got is load and display sequence and I wanted to know if this was the right approach to this?

It seems that the following happens:

viewDidLoad on my main window gets called viewDidAppear on my main window gets called and I set up rightBarButtonItem I then want to populate a text field on that search bar but because the loading of the view for the button item happens in the main thread, I don't know when it's appeared.

Would I be better to create a new class with nib for the search bar and buttons which would then have a viewDidLoad/viewDidAppear and I could then create a delegate function so I could 'deQueue' the text to go into the search bar?

Or, am I missing something really simple?

Community
  • 1
  • 1
JamesB
  • 499
  • 8
  • 23
  • I figured this out, see the other post for an explanation or read the example here: http://www.jamesrbrindle.com/developer/ios-developer/howto-add-a-custom-uinavigationitem-to-a-uinavigationcontroller-with-delegation.htm – JamesB May 20 '11 at 12:02
  • You can answer your own question and accept as an answer. – RK- Oct 11 '11 at 15:00

0 Answers0