Present UINavigationBar + toolbar modally from UIScrollView - iphone

I am creating a reader app and have the kindle app as an
inspiration.
From the reader view (uiscrollview) I wish to present/animate a navigation bar
and toolbar on a tap. Now the app (uiwindow) already has as its root view controller
a navigationVC, which is used for the flow for selecting book category and a book. I then make the top bar invisible when displaying the actual text in my uiscrollview.
I want to display that navigationVC again on a tap, is that possible? I tried in my uiscrollview bind a tapgesturerecognizer to present that controller modally but it didn't work.
Thanks!

It works now, it wasn't as advanced as I thought. Actually, I had an error in my gesturerecognizer handler, which didn't set the UINavigationController's properties :).

Related

Presenting a UIVIew from a container view modally (nav bar missing)

I am a bit new to iPhone development and working on learning it on my own.
I have a view controller which contains 2 parts:
Image View - some picture + some text on top of it
Container view
the container view is now segued into a new controller view which I replaced with a collection view. The idea here is for this to hold some picture I can click on to get to another page yet.
So, with all that, I have things working fine. My main view shows the top picture + text and below is all the smaller pictures which are clickable and that take me to another view that is being presented modally.
The final view is a UIView that contains in it a imageView to hold the picture I clicked on the other view. This even works fine.
The issue is that I am trying to add a naviagtion bar on top of the new view which shows up fine in story board and I added a button to close it. But that for some reason does not show up when I run the application.
If I change the presenting mode to Push, I see the navigation bar show up with the back button as well, but my close button does not work there either (code added to dismiss the view correctly).
What am I doing wrong with the modal presentation?
If you want to present a view with a navbar modally, it has to have it own NavigationController.
So too have a NavigationBar in a modal displayed View, drag a UINavigationViewController in front of your ViewController, e.g.:
This is not needed in case of a push segue, as the pushed ViewController is still child of the original UINavigationViewController, wich is owner of the NavigationBar
The NavigationBar is managed by the UINavigationController, wich is on the parent-side.
So if you add Buttons in the Storyboard, you are adding these buttons to the NavigationItem, wich belongs to the ViewController.

Present UIViewController modally within a UIViewController that does not cover full screen

Basically once I dismissed the modal view, my customized UIToolbar no longer clickable.
Here is my design:
a customized UIToolbar at the bottom of the screen
top part of the screen is associated with a container view controller
[note] I added the top two items above into a root view controller and assigned to UIWinow's root view controller. The container view can be changed whenever toolbar items are clicked.
then, each toolbar item associated with a UINavigationController so that it's navigable.
within a UIViewController of a navigation, I present a view modally. The modal view does NOT cover the full screen as a result of the entire design...
after i dismiss the modal view, the UIToolbar items are no longer clickable.
I think the 'bug' is resided in where i presented the modal view, so I also tried to present modal view using root view controller, then there is also other issues...
maybe someone has more insight on this, that will be really appreciated :)
Thanks.
Try releasing the modalViewController as soon as its no longer needed. If you are using ARC, set it to nil. Allocate a new one when a modalView is needed.

How to add a navigation bar to a viewController presented using modalView in iPad

I am implementing a facebook integration in my ipad app.I am presenting a veiwController to load facebook URL modally using modalPresentationStyle = UIModalTransitionStyleCrossDissolve. Now I want to implement a navigation bar on the top which will show a title Facebook and a button to close this view.
I tried adding a navigation bar but it didn't show up because my viewController is not tied to any navigationController and tried toolbar as a subview to the viewController's view but it shows up only after the webView is finished loading.
I want to know how should I implement a permanent navigation bar so that I can any time close the modal view.
While the navigation bar doesn't show up automatically, you can always add the navigation bar via IB. I was able to get it working in a sample project. You can take a look and see if it helps you.
Another thing is that you are doing modalPresentationStyle = UIModalTransitionStyleCrossDissolve;. This is incorrect in that you are assigning a transition style to the presentation style property but works because the values are basically enums and UIModalTransitionStyleCrossDissolve ends up with the same value as UIModalPresentationFormSheet.

Non-Modal view without NavigationController

I have an app built from the UITabBarController starter project. The first tab is part of the main.xib that contains the tab bar. I would like to slide a view up from the bottom on top of that tab's view that only covers part of the screen. My understanding is that you can only cover part of the screen if you make the top view non-modal, but I don't see a way to do that without a NavigationController.
How can I do this?
you can add a UIView as a subview to the current view, and then animate its appearance into the screen using animation blocks, or Quartz or however you would like.
presentModalViewController: is actually a method that belongs to UIViewController, the superclass of UINavigationController, so you can use it from any view controller, not just a navigation controller.
Have you tried using a UIActionSheet? That's an easy way to get a view with a few buttons for user input to slide up and only cover the bottom portion of the current view.

iPhone Toolbar on top of a Scrollview to save UImage?

ive been looking at some tutorials on a toolbar they all are implemented through the navigation controller delegate. Is there a way i could use the toolbar without using the navigation controller?
right now i have a ViewController with a Scrollview in that scrollview i have images when the user uses a touch gesture then i want a toolbar to be viewable and usable to the user just like on the Photo App.
i want to know how i could use the toolbar and make it functional without going through the app delegate and staying on the current viewController.
A toolbar can be created and positioned just like any other view. Don't confuse toolbars with tabbars.