I am having an issue with the UIPopoverController. I am trying to make a registration form appear on the screen when the app starts (and a login screen periodically thereafter). However, as the form is a little long I also require a toolbar that sits above the keyboard, with next, prev, done buttons (similar to those found in safari).
How can I make the toolbar appear on top of the popover view, while still maintaining a full width of the screen, the iPad is constantly in landscape mode.
I did have this working, however the buttons would only be active when they appeared in the same rectangle as the popover.
Any help here would be appreciated
Set your toolbar to be the inputAccessoryView for each of your UITextFields.
There are many examples of how to do this on SO and other sites.
Create a Class for your Previous,next Toolbar.
Make a method which return a Toolbar as below.
-(UIToolbar*)createToolBarForView:(UIView *)keyBoardView
{
//Add segment Controller and Selector for your segmentController
}
In the selector for your segment controller Use Delegates to notify the implementing Class that segment controller is getting fired.
After Making all these things set the inputAccessoryType for all the textFields for which you want that toolbar to appear
{
YourTextField.inputAccessoryView = [OBjectOfYourCustomView createToolBarForView:self.view];
}
Related
I wanted to display a Popup view on top of the screen but while enabling the actual screen as well. User should be able to perform all touch actions on the screen's controller while displaying and allowing touch actions on popup view as well. No fade for background ofcourse.
I do not see a existing style for UIAlertController that meets this need.
Is it possible with UIAlertController?
(PS. with UIPopoverPresentationController Custom style, managed to disable fade but still couldn't get the touch controls work on background screen)
Sounds like you might want to look into passthroughViews property on UIPopoverPresentationController. From the documentation:
"When displayed, taps outside of the popover window cause the popover to be dismissed automatically. To allow the user to interact with the specified views and not dismiss the popover, you can assign one or more views to the passthroughViews property."
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPopoverController_class/
I have a master page in my application that is based on PageViewController. On that master page I have a side bar that provides options to the user. One of the options is to display "About" information regarding the application. When the user click the About button in the side bar, I want to display my AboutViewController as modal. It appears all my linking up is correct however when I click the About menu option in the side bar, the whole screen simply goes black (which is the background color or my AboutViewController) and none of the content in my AboutViewController is visible.
Here is the code for my PageViewController. The highlighted code is the code that displays the modal view controller.
Here is a screen show of About View Controller Scene that I am trying to display.
Where is a screen shot of what the app looks like before I click the About button:
This is how a click the About button:
This is what I get after I click the about button:
Any suggestions as to what I am doing wrong?
UPDATE: Per the comment provided I updated my code as follows and I am still having the same problem.
gobj_sideBar.showSideBar(false)
iobj_AboutViewController = AboutViewController()
iobj_AboutViewController?.iobj_CloseAboutInfoDelegate = self
iobj_AboutViewController!.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
// Cover Vertical is necessary for CurrentContext
iobj_AboutViewController!.modalPresentationStyle = .CurrentContext
// Display on top of current UIView
self.presentViewController(iobj_AboutViewController!, animated: true, completion: nil)
Also - I don;t believe a blank page is being displayed as in the code for my About View Controller I do have the following line of code which turns off the status bar and the status bar is not visible on the scene displayed when I click the about button.
override func prefersStatusBarHidden() -> Bool {
return true;
}
OK So I switched to using Modal Segues as suggest and that mostly works. The only challenge I have now is that I want the About View Controller to display as a small popup type view but instead it is taking up the full screen as seen below:
These are the properties I have set for my About view controller. Any idea how I should change it so the view comes up as a popup type window where the background is grayed out but the About view does not take up the entire screen?
I am not experienced enough to tell what's wrong but I am spotting some mistakes in your code :
modalTransitionStyle and modalPresentationStyle are to be set on the presented view controller not on the presenting.
You instantiate an AboutViewController, save a reference to it and set self as its delegate but in the call to presentViewController(...) you instantiate another AboutViewController
Also consider that the black is not the background color of your About scene but instead the color of a blank screen.
If I were you, I'd use a segue for that about scene as well, it's less error prone. And instead of delegation to dismiss the About view controller, try an unwind segue.
I need to create below thing
Currently i'm using WYPopover , but I can't create the button since it's outside of the popover. Is there any existing solution out there ? Many thanks
Create a bigger popover UIView holding all your child elements (current popover + button) and make its background transparent or however you wish.
Popover-controller's are exclusively used in iPad. If you want to use in iPhone, you should create it in a custom way.
I am not familiar with the XYPopover in Github, but normally the custom created popover should be dismissed whenever the user taps any place in the screen. That is one of the key feature of the popovers.
Normally the custom popovers are build like, adding a hidden parent view and then the visible image of a popover frame on it.
You should to do the following,
Avoid dismissing the parent view on tap of parent-hidden-view.
Add a close button at the area where you want to show the close button, on top of the parent-hidden-view.
Capture the button click and dismiss the view (remove the view from superview)
How to customize your need
Creating custom popover view is not a big task. It will take maxim one day, try it your self.
One Parent view with clear color
One background image of a popover frame.
View-inside popover (this needs to be customized for UIPopover also).
Close button.
I have a SplitViewController (iPad) and its leftViewController is a class inherited from UITableViewController; on the other hand, the rightViewController is a map. In landscape mode, when the leftViewController is shown (UITableViewController), then the user can tap on one item and it is pushed onto the left part of the SplitViewController another list of items (UITableViewController). As a result, it appears the title and the back button with the title of the previous list (this is the back button offered by the UITableViewController, so I have not programmed a new button to implement that behavior). During all that process the map does not change (and this is the desired behavior).
The problem is related to the back button and in landscape mode; that is, when it is pressed then the previous list is shown (and this is the desired behavior), however it seems like all the screen (the menu bar at the top and also the sliptviewcontroller -with left and rigth viewcontrollers) is refreshed (repainted) from top to bottom during less than one second.
I am quite sure that is not a problem related to animation because I have commented, in the code, all the sentences related to animation, and, I also have set to false all the function arguments like "animate:".
It is a esthetic problem, but I would like to correct it.
Thanks in advance,
Solution: Implement in the left view controller the following method.
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
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].