View is clipped during presentModalViewController transition animation - objective-c

I have initialized a UIViewController with a nib file which displays fine when I push it on my viewstack.
However when I try and present it as a modal viewcontroller, the view of that controller is clipped at the bottom during the transition animation only. After the transition is done, the view displays just fine.
Anyone have a clue what is going on here? Do I need to set additional properties on my viewcontroller that is presenting my modal viewcontroller?
I have tried re-setting the frame of my viewcontroller without success...

Related

hide navigationbar of uisearchdisplaycontroller when other viewcontroller is pushed

i have a uitableviewcontroller with uisearchdisplay controller. tapping on table cell pushes another view with some content and hides the navigationbar in the pushed view controller. the view controller has it's own uitoolbar, so far everything ok. the problem is that when a search result is shown and then tapping on the table cell view pushes the viewcontroller with uitoolbar with a navigation bar above it. so two bars on the pushed view. i dont want the navigation bar to be hidden. this code works if the viewcontroller is not pushed from search result
[self.navigationController setNavigationBarHidden:YES animated:YES];
what i'm missing using uisearchdisplay controller and hiding its navigation bar when other view is pushed?
I have redesigned my app. i dont use uisearchdisplay controller. instead i use uisearchbar and tableview which works perfectly.

How can I access my UINavigationBar properties with this config?

My main view controller is embedded in a UINavigationController. On my main view I've a button heading to another View Controller, let's call it "settingsController".
The problem is that I changed my UINavigationBar's appearance in my NavigationController (with UIAppearance or subclassing UINavigationBar, nevermind).
But I don't want a custom NavigationBar in my settingsController, where I've no NavigationBar attribute in IB. So how can I change this ?
Thanks for your advices
EDIT : quickly, to sum up this :
In any view controller, you can call self.navigationController.navigationBar to get the navigation bar of the navigation controller you're currently inside.
You could try changing the appearance in viewWillAppear on your settings view controller, and putting it back again in viewWillDisappear.

How to send a message back to UIScrollView from a NavigationController stack?

My view controllers are structured like this:
> UIWindow
> - RootViewController with UIScrollView (2 pages, pagingEnabled)
> -- UINavigationController (in the first page of the scrolling view)
> --- HomePageViewController (plus other ViewControllers pushed on the stack)
> -- MinutiaViewController (second page)
UIScrollView holds the UInavigationController as a subview
[scrollView addSubview:navController.view];
In my scenario I want to:
disable UIScrollView scrolling (scrollEnable=NO) once a new view is pushed onto the UINavigationViewController
enable UIScrollView again (scrollEnable=YES) once the new view is popped and the UINavigationController shows its root again
(HomePageViewController)
I figured out how to disable the scrollView scrolling when pushing a new view.
But cannot figure out how to enable the scrollView scrolling when the new view pops off the stack.
So far I tried
1 triggering viewWillAppear; viewWillDisappear; manually and sending a
message to UIScrollView from HomePageViewController's viewWillAppear
e.g.
[self.navigationController.parentViewController performSelector:#selector(enableScrollAgain)];
2 designated the RootViewController as a UINavigationController delegate to handle its
events
None seems to work so far. All advice appreciated!
Have you tried using Notifications ? You could add the RootView to observe a notification form the navigation controller, when you get that notification you can disable scrolling. Look into NotificationCenter.
Hope this helps

close UIPopover on rotation with a fadeout animation

The Apple Pages and Numbers apps have popovers (for "tools" etc) that close with a lovely fade out effect when you rotate the device. I'm trying to recreate this, but my popovers always seem to close instantly, so the animation of the rotation doesn't look quite as smooth. I'm currently using:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
[toolsPopoverController dismissPopoverAnimated:YES];
}
Does anyone know the best way to achieve the same effect seen in Pages/Numbers?
Thanks!
Based on the documentation for the UIPopoverController (emphasis added):
If the user rotates the device while a popover is visible, the popover controller hides the popover and then shows it again at the end of the rotation. The popover controller attempts to position the popover appropriately for you but you may have to present it again or hide it altogether in some cases. For example, when displayed from a bar button item, the popover controller automatically adjusts the position (and potentially the size) of the popover to account for changes to the position of the bar button item. However, if you remove the bar button item during the rotation, or if you presented the popover from a target rectangle in a view, the popover controller does not attempt to reposition the popover. In those cases, you must manually hide the popover or present it again from an appropriate new position. You can do this in the didRotateFromInterfaceOrientation: method of the view controller that you used to present the popover.
It would appear that by calling [toolsPopoverController dismissPopoverAnimated:YES] in the willAnimateRotationToInterfaceOrientation: method, you are dismissing with an animation while the popover is hidden during the rotation transition.
If you call the dismissPopoverAnimated:YES method in the didRotateFromInterfaceOrientation: method instead, the default behavior with the popover in the new position should present before the dismiss animation is invoked.
If the default animation is still not what you are looking for at this point, I would create a custom animation block and manage the fadeout or re-sizing explicitly to meet your desired needs.
This worked for me by calling dismissPopoverAnimated: from willRotateToInterfaceOrientation:duration:.

How to add a navigation bar to a UITableView

I added a subview to my application. The view controller is a UITableViewController. When I open the .xib file I see the table, but I can't drag a navigation bar onto it. So once the user enters the view, they have no way of getting back to the previous screen. What can be done?
the UITableView nib representation cannot have it. You can simulate the UI in the case you have a navigationController.
If you want to have a navigation controller, your UITableView has to be pushed into the stack of navigationController.
Assuming your view controller is ViewControllerA has a navigationController, then this method will make sure you have navigation controller in your UITableView:
[viewControllerA.navigationController pushViewController:tableViewController animated:YES];