using UIReferenceLibraryViewController in custom popover controller - ios

I am using custom popover controller(WYPopoverController) for iPhone and showing UIReferenceLibraryViewController in it. The view does come perfectly but UIReferenceLibraryViewController has 'Done' button on its navigation bar and when I click on it, it does not respond. Though if I click outside the popover then popover disappears. I simply want to disappear popover when 'Done' button is pressed.
Please note, if I use UIPopoverController for iPad, then 'Done' button in UIReferenceLibraryViewController does respond. Not sure what am I missing in custom implementation.
Any help is much appreciated.

The problem to me seems like part of a terrible design by Apple, where the reference library controller dismisses itself rather than providing a delegate method notifying you to dismiss it. First, open a bug report with Apple and post the bug report number so people can duplicate it.
In absence of better options, I would suggest replacing the controller's navigation item's bar button item with your own, where that button would notify you of the user's tap and you'd dismiss the controller properly. This is a partial solution, as the reference library controller is a complex case, where it maintains a navigation stack internally. You may have to dig in the view controller parent/child hierarchy to find all cases.
Consider changing your design in the meantime, presenting the view modally instead of a popover on phone/pod devices.

Related

how to handle popUp's next viewController to embed in navigation?

I have a tab bar, an every item of it embedded in navigation controller, and several child viewControllers!
and I have a pop up view which I created in a new viewController!! to show my popUp I had to choose "present modally"!
when I go to a new viewController from my popUp on pressing button, it's not embedded in my navigation controller!
is there any way to fix it?
and the new viewControl also stays embed in navigation to show my tab bar
Unfortunately, what you are trying to achieve is not right, and please do not proceed with your initial plan.
I strongly believe a quick look at this could help you understand better UINavigationController and the difference between push vs present UIViewController in iOS.
As an answer to your question, you can imitate your wanted behaviour, but there is no direct native iOS way to accomplished your goal. Better, use pushViewController:animated: instead of present. More in the apple dev site - here.

How to always show a viewcontroller even when navigating screens in iOS?

I have this music player view controller that can be minimized. Thanks to LNPopupController[https://github.com/LeoNatan/LNPopupController].
Everything is working fine, but I have no idea how to make this music player view controller stays on top even when the user navigates to the other screens (even when the main navigation controller pushes another view controller). The app doesn't use tab bar controller by the way.
So, is there a way to implement this kind of idea? Again, sticking the minimized view controller on top of every screens of the app?
Developer of the framework here.
If you present the popup bar from a navigation controller, it will appear for all pushed controllers. Likewise for a tab bar controller.
If you need to have it for all controllers, it's not easily possible. One way is the have your entire application scene appear as a child controller of a view controller, and have that controller present the popup bar. This is a difficult way to make it work, and not recommended. It has many issues.
The popup controller is not meant to appear on the screen all the time. It is meant to implement a similar functionality as Apple's.
add the minimized view controller on keyWindown which your minimized view controller always on top ,I didnot Know whether can help you,the code demo gif as is show,If anyone need Demo,give me Email:59620one463qq.com(replace one to 1) to get demo

iOS navigation best practice for adding items

I cannot find the answer to this although I have implemented this rather a few times already, but maybe the wrong way.
Say I have an App for iOS, it has a main screen, which goes to a list, that list has a < back (to main) and an add button. Now when I click < back, I go back to main as that's the pop() from the stack. No issues so far.
Now when I click the add button, that is added to the stack as well; when I click back on that screen I go back to the list which is fine.
The problem is; when I save the new item, I want to go to the detail screen, but I don't actually want to have the add screen on the stack anymore while it will be there. I want the < back button for the detail item pointing to the list.
I know how to do this, but what is actually the best to implement this with the navigation stack?
Well for adding elements the best practice is to present an ModalViewController.
In this way it is not added to the stack.
Update
Let's take as examples simple apps that apple provide with iOS, Contacts app. When you want to add a new contact a VC is presented.
You'll need to implement "Done" or "Save" button that will dismiss the modalViewController and if you want to take the user into detail screen you could post a notification or other mechanism on dismissViewController method's completion block that will push the detail page from the list. But be careful on animations if you dismiss the modal VC animated and push the detail page animated you could get some unexpected behaviour. My proposal is to dismiss the Modal VC animated and push the detail page without animation.
You can override UINavigationController's viewControllers property after you pushed detail view controller. Just get current viewControllers property array, iterate and find the one you don't want to see and remove it. Remember to set viewControllers array again.
https://developer.apple.com/library/ios/documentation/Uikit/reference/UINavigationController_Class/index.html#//apple_ref/occ/instp/UINavigationController/viewControllers

Tabbar not showing in ios application

i am making one iOS tabbar application in that i have put 4 different tabs and whenever i click on 1 st tab and load another view after clicking of the first tab. After that when i press back button then tabbar is not displaying .So that i want hint that how can i show that
back the tabbar when we move from one tab from another and yes how i can use consistent the tabbar in whole application can you just guys help me on this i am new to iOS development.
here i am put the screen shot ...
here first screen is this one..
when i tap the video button that are first in the view then another window open
which are as under and see the tabbar is not there...
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Looking at your screen snapshots, do I correctly assume you're attempting to transition to the "Videos" scene by touching the big "Videos" button in the center of the "Home" scene (rather than touching the tab bar button at the bottom of the screen, which I assume works fine)? If that's the case, you need to have your button tell the view controller's tab bar controller that you want to change the index of the tab bar, and it takes care of it for you. You cannot do the transition using a segue (or at least not without a custom segue, which is even more complicated than the procedure I outline below). If you're changing the view some other way (e.g. using a standard segue or using presentViewController, pushViewController programmatically, etc.), your tab bar can disappear on you.
You later said:
when in video controller there is tabbar is there but i drag and connect to that then tabbar is disabled
Yes, that's true. You cannot use a segue from one of your big buttons to one of the tabs in your tab bar. (Or technically, if you wanted to use a segue, it would be a custom segue which would do something very much like my below code, though perhaps a tad more complicated.) So, rather than using a segue for your big button, you need to write an IBAction (connected to the big Videos button on the Home scene), that tells the tab bar to change its selection:
- (IBAction)clickedVideosButton:(id)sender
{
[self.tabBarController setSelectedIndex:1];
}
A couple of comments:
My answer was predicated on the assumption that your tab bar works as expected when you tap on the buttons of the tab bar, itself. If you tap the buttons at the bottom of the screen, do you transition to your other views correctly and preserve the tab bar? If so, my answer above should solve your issues in getting the big buttons to work. If not, though, then the problem rests elsewhere and you need to show us your code that might account for that (either you're something non-standard in the UITabBarControllerDelegate methods, or your viewDidLoad of the view is doing something nonstandard).
If I understand your user interface design right, you have the tab bar at the bottom as well as the big buttons in the middle, which presumably do the same thing. That is, no offense, a curious user interface design (duplicative buttons, requiring extra tap on a button, etc.). You might want to choose to either use either big buttons (in which you can retire the tab bar, eliminate the IBAction code I've provided above, and just use a nice simple navigation controller and push segues, for example), or just use the tab bar (and lose the home screen, lose the big buttons, etc.).
You also made reference to "press back button", and I don't see any "back" button on any of your screen snapshots. Do I infer that you have a navigation controller and you're doing a pushViewController or push segue somewhere? If you're doing something with back buttons, you might need to clarify your question further.

iOS connect my view to popup on button press

I have two xibs, one is my title screen with buttons, the other is a more specific window that should come up when one of the buttons is pressed.
This isn't switching the whole screen, just a popup window, where clicking outside of the bounds of that window will make it disappear leaving only my title screen remaining as it was visible behind this popup view. This is similar to my understanding of "modal views".
Anyway I do not quite get how to connect it to the button on my title screen. I have the views made in IB ready to go. I'm not sure if I have declared all objects to satisfaction yet.
From what I understand I think I need a UIViewController or something, but its all a pretty thick fog of information right now
insight appreciated, or links to proper noob sources would be helpful
Does your title screen have a view controller (or is your app delegate the main controller object)? You will want to add an IBAction to that object, connect the button to it, and then present your other view controller modally (or in a popover) from there.
A popover will appear in a small window with an arrow, and tapping outside will close it. A modal view controller typically slides up into place, and you have to press a cancel button to close it. This guide explains how to use a popover. Using a modal view controller is simple if you have a view controller: [myViewController presentModalViewController:nextViewController animated:YES].

Resources