UIPageControl with iPad SplitView for a magazine - ios

I'm creating a magazine using the SplitView feature with each article at the left, then to navigate the pages I added a UIPageControl.
This works PERFECTLY when vertical, but when horizontal the PageControl is hidden. I'm assuming it's either some "autoRotate" code or something in the nib...BUT WHAT???

I'm pretty sure it's hidden because the detail view gets cut off at the bottom when the screen is turned. See if you can move the UIPageControl up the page when the screen goes to the horizontal mode and then move it back when the screen goes to the vertical mode.

Related

What if layout height is longer than device height in xcode?

Please take a look at screen shot from simulator for iphone 8 plus. (01.png) Here is my question: I cant see whole view of my page(i cant see whole part of button5 and button6 because there is no vertical scroll bar) Shouldn't vertical scroll bar appear automatically? If vertical scroll bar appears then i can reach bottom of the page. What should i do? Please give me an advice because i haven't founded any solution yet. You can also take a look at screen shot from xcode main story board to see height of button5 and button 6. (02.png) I mean page background should not move. But I should be able to scrolling up and down through on page. Thanks.
01.png
02.png
Just add image view with background image below all components in the ViewController.
Then add Scroll View with your content on top of that image view.
Don't forget to select clear colour as the background for scroll view and the inner view apart from your buttons.
Follow this tutorial to add Scroll view and content in it directly in storyboard using Interface builder.
https://medium.com/#pradeep_chauhan/how-to-configure-a-uiscrollview-with-auto-layout-in-interface-builder-218dcb4022d7

Content moving in PageViewController tutorial slides

I'm using StoryBoards and have a PageViewController for my app tutorial screens.
All viewcontroller's on the storyboard are basically the same, except for a different image of course. When it's running... the first view shows the image anchored to the bottom instead of centering in the view.
As soon as I start sliding to the left, it jumps up to where it should be. All other subsequent views are working great. The second screen grab shows what happens after I start sliding to the next screen.
I'm stumped, I've never seen this before.
Any ideas?
Please check automaticallyAdjustsScrollViewInsets is set to false in your container.

Starbucks App Modal View Controller with MapView And TableView

I'm looking to replicate the basic functionality of the Stores finder in the new Starbucks app but am unsure as to how I would go about implementing the sliding aspect of presenting the view:
The main aspect of the functionality I am trying to replicate is the ability to present the modal and have it dismissible by sliding it down off the screen or expand to full screen when scrolled up.
Also notice how the scroll bar doesn't overflow the modal (tableview)? I'm not sure if this is a tableview nested within a scrollview. Either way, the scroll seems to be controlling both the scrolling of the tableview and the moving of the modal at the same time, which is neat.
Update: I'm able to dismiss the Modal by sliding it down but still not able to expand to full screen when scrolled up without having the scrollview scroll when I pan. I want the scrollview to flash the scroll indicator but not do the scroll while I'm growing the containing view to full screen, and resume scroll after I reach full screen. All without having to disable bounce at least when scrolled downwards.

Buttons going below screen in landscape mode

I am learning iphone app development and I am using swift. I took the lynda tutorial and I have created a very basic UI which is View Controller > View .
In the View I added a segmented control, two buttons(horizontal, facing each other), three labels, one textarea and two other buttons(horizontal, facing each other).
So I have these UIcomponents arranged vertically and I used 'Reset to suggested constraints' and made all the buttons equal width and equal height and everything is fine in potrait mode but as soon as I go to landscape mode the last two buttons disappear, if I add a constraint from bottom edges the whole UI gets messed up i.e. only one label and part of an upper button appears.
What should I do to make all the UI components visible both in potrait and landscape mode?
There are many ways to go about this. I've set up a github project to show you one way to achieve it.
Short resume of what I did manually without the help of the Interface Builder:
I've pinned the segmented control to the left, top and right of the parent view
The red button below has a vertical constraint to the segmented control and a leading constraint to the parent view. It also als a horizontal space constraint to the green button
The green button has a trailing constraint to the parent view, top aligned to the red button and widths set to equal to the red button.
This setup ensures, that the segmented control is responsible for specifying the distance to the top of the parent view and the red button specifies the width of itself and the green button (test it, by changing the value of the horizontal space constraint)
I've turned the same principle upside down. So the views in the bottom are always pinned to the bottom. But as I said, there are many ways to achieve this. You could also create 3 container views for the elements in the top, center and bottom and pin those to the top, center and bottom.
The running app looks like this:
If you would like to display your content differently in landscape mode, it is possible (and most likely preferable) to create an alternate landscape interface.
Quoting the Apple developer's page on the subject:
"To support an alternate landscape interface, you must do the following:
Implement two view controller objects. One to present a portrait-only
interface, and the other to present a landscape-only interface.
Register for the UIDeviceOrientationDidChangeNotification notification.
In your handler method, present or dismiss the alternate view controller based on the current device orientation."
For more information about this, check out this apple developer page and scroll down to "creating an alternate landscape interface".
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html

UIWebView rotation overlapping buttons

I have a UIWebView set up to reach three edges of a page in portrait mode. there is a small space at the top of the page where I put a few UIButtons and a UITextField.
On page load, I load a web page into the UIWebView and in portrait all looks as expected. When I ask the simulator to rotate left or right to landscape, the buttons disappear or after playing a bit end up with the UIWebView behind the buttons that were at the top. I would like the UIWebView to stop just under the buttons as it did in portrait mode.
Any assistance would be appreciated.

Resources