I have a problem that has been solved on iOS6, but still appears if I use the iOS 5.1 simulator.
I have a default page based application. I added a "Main menu" view controller, that has three buttons that activate the root view controller containing the pages via a push segue, all defined in the storyboard.
I then added a navigation controller and made it the initial view controller.
If I pas the menu via a button and flip a few pages I can click the back button and it goes back to the menu. Good.
But I don't want the nav bar, so I hide it, and on the root view controller that contains the page view controllers I add a button which performs this action:
[self.navigationController popToRootViewControllerAnimated:YES];
This button works perfect on iOS6, I can flip a few pages, press the button and I'm back in the menu.
With the iOS 5.1 simulator however (and on my 5.1 iPad), a page flip occurs! It's a page filp until I'm on the last page and then I go back to the menu.
I searched for over two hours now but could not find a solution, I hope someone can help me with this?
Note: setting animated to NO does not solve the problem.
I did find the answer to my question, this is my first iOS project which explains why I did not find it any sooner myself.
In the default page based application there are two lines in the viewDidLoad method:
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
First, it's not really adding but assigning that happens here, second, when I put the second line in comment, everything works as expected.
So I'm glad it solves my problem, however it raises some questions:
The gestures are started as easy as they were, so why was this line needed in the first place, what does it supposedly fix?
Why does it work in iOS6? It should have had the same problem, no?
Is it correct that it is an assignment and not an addition?
Any answers to these three are still appreciated.
Alex
Related
I have 1 (rootViewController) view controller which is embedded in navigation controller. Then i pushed another view controller (secondViewController), which has search controller in title view. When i am trying search become first responder (Active) i got this in terminal:
Warning: Attempt to present
"AppName.CustomSearchViewController: 0x7face0c20eb0> on
whose view is
not in the window hierarchy!
This happens only in iOS lower than 11. When i embed this second view controller in navigation controller and present it modally all works good, but i need exactly pushing. How can i solve this?
I solved it! I need to make definesPresentationContext false in rootViewController to make it work on another one!
I've been looking through the iOS 7 / UIKIT framework, and although it looks quite different aesthetically it's really the same SDK underneath from what I can see.
My question, is there any extra code that needs to be included to get the draggable behaviour between pushed tableviews/views?
When you push a view onto a UINavigationController you can now drag back to the previous controller from the side rather than pressing the back button.
This behavior can be seen in mail.
How is this achieved, do I need to add any code to add it to my app?
This has nothing to do with UITableView or UITableViewController, but with UINavigationController. And yes, you get this behavior for free as long as the back button is visible.
I am totaly new to this site, but I already like it :-)
I found it by searching for a question about the UIPageViewController.
I have a normal UIPageViewController App, in which I open a ModalViewController for setting up some settings...
Now the Problem: :-)
If I click on the done Button on the right side of the ModalView, to dismiss it, the PageViewController turnes the page, because he thinks that he is meant by that click ;-)
Can I disable the PageViewController GestureRecognizer as long as I have a ModalView opened?
Is there a method to disable and later his recognizer?
thank you for your help in advance...
cu Matze
It seems odd that your UIPageViewController would steal touches from a modal view presented over it. Unless, perhaps, you are embedding the modal view within the content of the UIPageViewController?
To answer your question -- you can easily disable the page view controller's gesture recognizers by enumerating its gestureRecognizers property (an NSArray):
for (UIGestureRecognizer *gr in [self.pageViewController gestureRecognizers]) {
[gr setEnabled:NO];
}
Re-enable them later with setEnabled:YES.
UPDATE:
In iOS 6 UIPageViewControllerTransitionStyleScroll has been added. UIPageViewControllers that use this transition style return no gesture recognisers in the array returned by gestureRecognizers. Presumably page view controllers with this transition style use an underlying, private UIScrollView instance (it behaves just like a UIScrollView with paging enabled), although I haven't checked this.
Ever since iOS5, I have a problem where when I present and then dismiss a modal view, my Navigation Controller bar is hidden underneath the status bar. I have read the forums and tried many things but I cannot find the fix for this behavior.
Also, I get this behavior when presenting any modal view controller so it does not appear to be specific to the view controller I am presenting. At first I thought it was a problem with ZXing but this seems to be generic with the iOS5 update.
Additionally, if I select a UITextField after dismissing the modal and my navigation bar is hidden under the status bar, the keyboard comes up misplaced in my window. Again, if I do a rotate back and forth, the navigation controller bar and the keyboard work just fine.
Any ideas would be appreciated.
RESOLVED
OK. I finally found the problem here. Again this only appeared in iOS5 but when my RootViewController launches it holds off on rotations until the animation is done. Once it is done, then it allows rotations again. The problem was that it was returning NO for all aspects (including portrait). The view showed fine but when I would present a modal and return, the view geometry was mangled. Once I changed it to return YES for portrait mode even during animation, the problem went away.
RESOLVED OK. I finally found the problem here. Again this only appeared in iOS5 but when my RootViewController launches it holds off on rotations until the animation is done. Once it is done, then it allows rotations again. The problem was that it was returning NO for all aspects (including portrait). The view showed fine but when I would present a modal and return, the view geometry was mangled. Once I changed it to return YES for portrait mode even during animation, the problem went away.
Short Version:
"How do you get a simple UITable drill down UINavigationController-styled non-full-screen modal dialog on the iPad?"
Long version:
I have a very specific set of requirements that I can't seem to get working...
I have a functioning iPad program that that needs to pop up a non-full-screen modal view. This modal needs to have a navigation controller and a simple drill-down table that displays a detailed view that I can have edit some values related to the selected item in the table.
Of course I am looking to have the regular "Back" and "Delete" buttons in the Navigation Bar.
I can handle the detailed view, what I am having issues with:
Non-full-screen popup (mine is
always full screen no matter what I
try).
The Navigation controller will not display the Table View I tell it to and the navigation bar does not even have the title I assigned to it in IB.
I can't seem to get any of this working. If anyone has a step by step example of how to do this, that would be great,
~Eric
P.S. I am not afraid of doing this 100% programmatically, but all the examples I have been trying to follow (and failing at extending to my problem) use IB.
As for the fullscreen issue, you need to set modalPresentationStyle to UIModalPresentationFormSheet or UIModalPresentationPageSheet on the controller you want to present modally. I'm not sure of a way to do this through IB.
As for your navigation controller/table view, I think more information is needed to provide an answer.