iPad: Correct approach to custom navigation items in UINavigationController - ios4

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?

Related

iOS 7 - ContainerView with embedded UITableViewController and UISearchBarController

I've a simple view which is embedded in an UINavigationController. This view contains a segemented control in it's top bar and a ContainerView as subview.
The content for the ContainerView is a UITableViewController with a UISearchBarController.
I've set EdgesForExtendedLayout to none for both controllers.
After first start it looks okey:
After tapping the first time into the search bar - the bar is hidden behind the navigation bar:
After tapping outside a small part of the search bar is visable (grey border):
If I drag down then it looks like that:
After changing the view (push and pop on UINavigationController) it looks like that:
Any ideas to fix this?
I guess you want all your view to scroll, and not only the UITableView.
I'd embed everything in a UIScrollView (segmentedcontrol and tableview), and make sure the tableview doesn't scroll by itself.

Monotouch use UITabBarController inside DialogViewController

Currently in my app I have this design:
-- DialogViewController 1
-----DialogViewController 2
--------DialogViewController 3
-----------TabBarController
--------------DialogViewController4
--------------DialogViewController5
--------------DialogViewController6
--------------DialogViewController7
Problem with this is that dialog view controllers 4-7 breaks the monotouch dialog flow (so to speak), because of TabBarController in between. When I create dialog view controllers 4-7 I need to create new Root in their constructors which I don't need to for DVC 1-3.
With this approach certain things like radio groups don't work inside DVC 4-7 e.g it will display the radio group selection, but there is no navigation bar at the top.
My question is what can I do to solve this? Can I use TabBarController inside DVC somehow if that makes sense? Or how can I "hook" DVC 4-7 back to main "circuit"?
Thanks in advance.
According to the iOS HIG
A tab bar appears at the bottom edge of the screen and should be
accessible from every location in the app
which implies that it should be the root, not nested inside another controller.

Show Title in MonoTouch tabbed application

Maybe I'm missing something super simple, but I can't seem to get a title to show up at the top of Views contained within a basic tabbed application. I follow these steps...
New Solution, Universal Storyboard, Tabbed Application
Run that and you have two basic Views "First View" and "Second View".
Neither View by default has a title bar, but the default code shows setting a this.Title.
Why don't the title bars show up? How do I get them to show? I've tried several things to get these to show such as...
Setting "Top Bar" in Interface Builder to "Navigation Bar". It then shows in Interface Builder but never shows on runtime.
I've also tried in ViewDidLoad() to set this.TabBarController.Title but that doesn't seem to do anything either.
Thoughts?
The feature you are looking for is called a NavigationBar and can be added manually via IB to your view if it does not have a NavigationController associated with it. If there is a navigation controller then the NavigationBar will show up automatically.
So to answer your question if you want a NavigationBar go to IB and add one from the objects library you should then be able to manipulate the Title on the nav bar to your hearts content.

ScrollView with paging iphone sdk

in the main view controller i have a scrollview and paging control.
i have added another viewcontroller's view as a page of paging control in scrollview.
now i have 9 buttons on that view controller's view which is inside scroll view.
now when i click on the buton i wants that main view controller's view should be pushed to another view controller.
but not getting how it can be done as the buttons are in view which is in the scrollview.
When a user interface element created in interface builder seems not to be doing what you told it to do, you should verify that:
you saved your changes to the nib in IB
that you correctly declared your ivars/properties as IBOutlet and connected your outlets in IB
that there are no views hijacking your events.
If the buttons in your view inside the scroll view don't appear to be getting press events, you may need to adjust the userInteractionEnabled property of parent views.
You can "move" any view from one view hierarchy to another by doing:
[myView removeFromSuperview];
[anotherParentView addSubview:myView];

Monotouch: arrange the UINavigationController back button in a different position

How can I arrange (programatically) the back button of a UINavigationController in a different position?
For example, suppose that the back button (visible in the upper bar of a UINavigationController) has these coordinates: 67 for x and 10 for y. I would arrange the back button for these coordinates: 89 for x and 10 for y.
Do I have to override these measures in a specific method (for example viewDidLoad() method)?
Thank you. Regards.
I guess this cannot be done in a simple way as you can manipulate the navigation bar only via few properties. So there are basically two methods:
1) traverse the UI tree and search for the actual button control created by iOS for you in the navigation toolbar and change its Frame property. You can always get to the inner controls by the Subviews property, so call navigationController.Subviews and iterate through that until you find the control you would like to move, btw it could be deep in the hierarchy, depends. And with iOS update this can change, so this is a bit of a hack, but usually such technique works well.
2) do the custom way. Hide the actual navigation bar, and do the navigation yourself via custom buttons, add a UIButton to your interface, in the action for that call popViewController on the navigationController. If you're inside a view controller, you can use this.navigationController.PopViewControllerAnimated (...);
If you need nice buttons, use this PSD, works well for me http://www.teehanlax.com/blog/2010/06/14/iphone-gui-psd-v4/
Hope this helps. If so, please vote.

Resources