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

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

Related

How to make a tableview fill all the available space?

This is my first swift application, so apologize if it's very basic. I was unable to find it...
In my view, I've a Navigation on top (Navigation Controller) and It's using a TabBar Controller. I'd like to make the TableView fill the whole empty space no matter the size of the device nor orientation.
I set the property Content Mode to many different options, including Aspect Fill, but all the options can't cause any effect.
Any clue about it ?
First make your tableview completely fill the screen and then set the constraints to be in 0 margin from all sides, like in the image
use constraints for display full table view on empty space.enter image description here
Click on pin icon from bottom side of Xcode.
Select all for four(up,down,left,right) constraints and set 0 value for all.
after then click on add constraints button and refresh frame(click on right side button of Pin button and select Update Frame).

UIView inside UIScrollerView displays with -64 offset

I'm trying to create a form that will be larger than the screen size and I've decided to use a view inside a scrollerview, then I'm adding the rest of the UI widgets (textfields, buttons, etc.) inside the view.
The view displays and scrolls, but no matter what I try, it displays with a vertical offset of -64 below the navigation controller bar. Once there the view will happily scroll up down.
I want the view to anchored at the top, just below the navigation bar, and then scroll down.
I am using IB.
Lots of time researching and not many answers that have worked for me. UIScrollView seems to be like one of those dirty secrets the whole iOS world seems to avoid....
Thank you for your help.
You can fix this in the storyboard
1- Select the view Controller
2- GO to attributes inspector
3- Uncheck adjust scroll View insets
For your view controller, in the storyboard uncheck the option to extend edges under top bar.

How to pin button to bottom of view Storyboard iOS

I have a button that needs to "stick" to the bottom of the main view on both 3.5 inch and 4" iPhones. Currently, I can move it right to the bottom of the storyboard on a 3.5" view but then on a 4 inch view, it moves up.
How do I stick the button to the bottom of the view on both screen sizes?
Select your button which you want to pin to bottom. Click on add new constraints and select bottom constraints then click on add.
Use AutoLayout feature.
While you're laying UI components on the screen, you see some blue colored guidelines, those are just helper lines and have no effect whatsoever when you actually run the program.
Once you're done with placing all the UI components on the screen, you have to actually set the constraints for the AutoLayout using the few buttons that are placed in the bottom right part of the Storyboard view.
Is suggest that you right click on the Storyboard view, and go into "Interface Builder Help" option, and then click on "Understanding Layout Constraints" and "Aligning and Pinning Objects" to see how constraints are actually set.

iAd Banner disappearing on 3.5", but shows on 4" screen?

I am doing a simple one view layout, calculator style app. I have multiple input fields, where values are entered, and a calculate button. All this works well. When I change size to 3.5" screen, the iAd banner I have at the bottom of screen disappears. When I switch back to 4", the banner is back. How do I lock down the banner to display at bottom of screen regardless of screen size? Thanks~
Hopefully you're using Autolayout. It takes a while to understand, but when you do it is extremely powerful for laying out flexibly for multiple screen sizes.
Anyway, assuming you are using Autolayout:
Here's my ViewController with the banner ad at the bottom
I select the banner and then click "Pin" - I then add the constraints that you can see in the image - click "Add Constraints".
Now, if I view how it would look on a 3.5" screen, it is still fixed to the bottom.
This can be happening because the Autolayout. Go to Storyboard, select the iAd view, then click on the segment "Pin" (third button on the bottom of Storyboard) and add the bottom Constrain.
Hope it helps.

Portion of iPad simulator screen responsive to swipes, but not button clicks

I have a UICollectionViewController in a container. On a specific portion of the screen (bottom right area in Landscape), it will register swipes, but the sections of buttons in that area are non-responsive.
The buttons are the top items in the view, so nothing overlays them. Only a portion of the button is non-responsive, and only when it is in that area of the screen. It is consistently the same area in every collectionView that is in a container.
Has anybody encountered this issue? Any potential causes or fixes?
Figured it out. I was using "freeform" viewControllers, and they were messing with my superview size. So, as rdelmar pointed out, my problem was that the buttons were outside the superview.
I solved the problem by deselecting "Resizes View From NIB" in my freeform viewControllers.

Resources