Why no back button on DateElement picker? - xamarin.ios

This walkthrough for MT.D shows a back button on the UIDatePicker that appears when a DateElement is tapped. I'm in an iPad app, and using an MT.D DialogViewController as a subview in an overall UIView. When the date picker slides up I just get the black background with no way to dismiss the picker (no nav bar w/ back button). Same problem exists for the radio group picker. Is this because the dialog view controller is being used as a subview? Any ideas how I might get a nav bar up with a back button using the built-in picker logic?

You must use the DialogViewController as a child element of a UINavigationController to get the back button. On iPad, you can embed the UINavigationController in a UIPopoverController.
Adding the view of a controller into the view of another controller is not considered good design on iOS and won't result in the behavior you expect.

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.

I want a different title to appear in the navigation bar for each imageview in my scroll view (xcode 4.2, iOS 5.0)

I have a scroll view, and when a user moves from one imageview to the next, I want the title in the navigation bar to change. So I want to set a new title for the navigation bar for each image in the scroll view. How would I go about doing this?
Thank you very much for your help.
Write a delegate for your scroll view. In the delegate, implement the scrollViewDidScroll: method to figure out which image is currently visible and change the title.
To eliminate your incompatible type warning, you can declare that ScrollViewController adopts the UIScrollViewDelegate protocol:
#interface ScrollViewController : UIViewController <UIScrollViewDelegate>

BackButtonBarItem not working properly in iphone

I implemented the following code to show the navigation bar with a backbuttonbaritem.
[mapNavigationItem setTitle:#"Tracking"];
[mapNavigationItem setRightBarButtonItem:nil];
[mapNavigationItem setLeftBarButtonItem:nil];
UIBarButtonItem *stopTrackingBarButton = [[UIBarButtonItem alloc] initWithTitle:#"Stop Tracking" style:UIBarButtonItemStylePlain target:nil action:#selector(stopTracking)];
[mapNavigationItem setBackBarButtonItem:stopTrackingBarButton];
[mapNavigationBar pushNavigationItem:mapNavigationItem animated:NO];
[stopTrackingBarButton release];
The stopTracking button is displayed on the screen, but no title is displayed. When i click on the stopTracking button, it disappears and then shows the title.
Could someone please tell me whats happening??
Ok i think i wasnt clear enough,
I have a mapview with buttons in the tab bar, when the app starts the navigation bar shows 2 buttons, when i click on one of the Tab bar items, it should clear the navigation bar buttons and add a back button bar button item only. I am successful upto this stage.
But when i click on the BackBar button item, it disappears, and does not perform the action assigned to it.
FYI:
IBOutlet UINavigationBar *mapNavigationBar;
IBOutlet UINavigationItem *mapNavigationItem;
If you want to use a different title for your back button than the previous navigation title, then you need to change it just before pushing the new view controller and change it back again after popping it.
So something like:
self.navigationItem.title = #"Stop Tracking";
[self.navigationController pushViewController:mapNavigationItem animated:NO];
and in this class's viewWillAppear
self.navigationItem.title = #"Tracking";
Edit:
If you are not using the backbarbutton for taking the navigation controller back then dont set it as a backBarButton simply set it as left barButton item.
Plus it also seems like you are using same navigation bar for both tabs. not a good idea. Load both tab views from different viewcontrollers and add two different navigation bars to those views.

iPad: Correct approach to custom navigation items in UINavigationController

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?

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];

Resources