UIView Doesn't allow swipe down to see rest of the screen - ios

I build a view that has contents which exceed the height of the iphone 6 screen vertically.
To test that out, I've set a specific height for my image (600pts) to guarantee that the whole content wouldn't fit on the screen of an iphone 6 and that you should swipe down to see the rest (the label "BYE").
However, when I run the simulator, I cannot swipe down to see the rest of the screen.
I've used Autolayout constraint and set a margin top/bottom between each components and the superview (I don't have any autolayout constraints issues/warning).
Here's the screenshot of the storyboard of my UIViewController:
Here's when I run the simulator, I cannot see the Label "BYE"(which is normal) but I cannot swipe down to see it.
I am using Xcode 6.1 and Swift.
Any suggestion and explanations?
Thanks a lot!

I have redone your screen and here are the steps. The reason for your issue is not setting proper constraints in autolayout. First you need to choose AnyWidth AnyHeight in Xcode which is in bottom of the storyboard.
Here is the screenshots of View in StoryBoard and its constraints
Constraints
Final Result in Simulator
Setting the constraint properly will work for you. Let me know if you have any issues in doing so. Sorry for the image i used its low quality one and its just for test.
EDIT
In Storyboard if you see the bottom of the screen you will see below image. In center of that image there is wAnyhAny.

you need add constraint to thoes components!
Otherwise, some components will be placed out of the screen!
You can learn how to use Autolayout from here

![enter image description here][1]At right bottom of storyboard in xcode you will see triangel Resolve autolayout isuue select in Reset to suggested constraint.

Related

UIbutton stretching after runtime

I have form page with few textfields and a button.
I have added constraints for each component as well.
The issue is that the button getting stretched after running the app.
Please see below screenshots for my issue.
1- button size in storyboard
2- constraints
3- result in simulator
This is happening because the height of the device you running is larger than the device you have selected on your storyboard. To overcome this issue.
You can give a fixed height for the UIButton and remove the bottom layout constraint(lazy fix).
The better and easiest way is to use vertical UIStackView and give proportional heights to all the components. Read this article to gain more knowledge about UIStack views.
The height of the device you implement your constraints in is smaller than the device you test in , since you have leading , trailing , top and bottom your button will stretch depending on current device , so either remove the top/bottom constraint according to your design need
You can optionally add height to the button or leave it with it's intrinsic size

How to adjust this view with constraints

I'm totally new to Swift and in general, to iOS development. I just want to center a rounded profile picture with a table view above. In iPhone 5 it looks centered, but in iPhone 6 and 7 it look aligned to left, I don't know how to fix with constraints, I'm a little bit confuse.
This is my constraint tree:
How it looks storyboard for iPhone5
How it looks storyboard for iPhone 6/7
This is how it looks in emulator with iPhone 6
Can you guys help me to figure out what I'm doing wrong?
Thanks in advance!
Cheers.
It looks like you've set the width and height of your image view to hard-coded values, which will result in it looking centred for some views, but not all.
Reset your constraints, then set your distance from each of the four sides to zero. That'll centre your image!
Go to Editor -> Resolve Auto Layout Issues -> Reset to Suggested Constraints...
...then click that button down the bottom right and set each of your four sides' distances to zero.
Make sure you set Update Frames to "All Frames in Container" before clicking "Add 4 Constraints".
Try setting horizontal constrain between your My UI Image View and HeaderView. You can set centre hozintal with HeaderView.
Go to button down the bottom right and set centre vertical and centre horizontal to your My UI Image View.
Hope it helps. Happy Coding!!

Issue displaying uitableview in UIViewController - Not aligned

I dragged a uitableview component to my UIViewController in the Storyboard.
It appears as
Then when I ran the application, there's a space on the side. How to prevent this?
Note: Initially this application was enabled autoLayout, and I removed it later on. Hope there's no effect for this error.
Add constraints on your tableview.
If you don't know how to, here is a simple step by step :
Right clic or ctrl+drag the tableview (on the left side list) to
View.
Select Top space to top layout guide Repeat with Bottom
space to bottom layout guide
Repeat with Leading space to
container margin
Repeat with Trailing space to container margin
That should fix your issues.
The answer on this link will surely help you.
https://stackoverflow.com/a/26708486/3396270
Though its Table view in your case you can use it with all the components by changing the settings as per their requirements.
Check your screen size in Storyboard:
And make sure you are running the application on same size of Simulator as in your storyboard.
If you uncheck the Translucent property of your Navigation Bar, it's going to fix it.
If you are not using AutoLayout then just write this code in your viewDidLoad Method
[tableView setAutoresizingMask:UIViewAutoresizingMaskFlexibleWidth | UIViewAutoresizingMaskFlexibleHeight];
You could also set the AutoresizingMask from your nib file.
What version of the xcode are you using? If it's okay with 5s and not okay with 6 and 6+ then you should change the size of the table manually or use autolayout. Storyboard which you'v used should have optimised for devices below 6. I you're using #3x image for splash screen then your app supports 6 and 6+ but it uses the same table size as what it is designed for 5s device size on simulator.
Solutions-
Use auto layout so this will solve the issue itself.
Else create outlet for table and changes it size according to the device width and height.
I have released an app using the above 2 solutions and its in the store now.

iOS 8 swift application, content not centered

Everytime I run my iOS application, everything is off-centered. In this screenshot, you can see that the text seems a little off, and the black box is definitely not vertically centered along the page, although the text and box are centered according to the storyboard.
simulator screenshot
storyboard screenshot
I am guessing that the issue must have something to do with the size settings on the bottom of the storyboard. I am using wCompact and hAny.
Any help would be appreciated so that all this will look centered properly.
This is probably because you don't have your constraints set. You can click on the UIImage or UILabel and go to Editor -> Resolve Auto Layout Issues -> Add Missing Constraints (For All Views) if you want to use Auto Layout. Otherwise, look up some constraint tutorials and you'll have to set them manually. It's not too bad once you get the hang out it!

Launch image adds margin

After adding my launch image using a xib (and I even tried the traditional launch image way as well) some of my view controllers have a strange right margin now. For example before I might have had a label whose width was the entire screen, and used auto layouts such that it was leading/trailing to the content margins, and now despite that after adding a launch image there is a margin (it's not on every screen, but definitely some). On one of my screens where this is most prevalent i'm using autolayout but overriding with constraints that I add programmatically. Not sure if that's related.
Has anyone experienced anything like this or does anyone know if adding launch screens affect the story board / view controllers in any way?
Thanks!
On the launch screen select your image view, then select the pin at the bottom right of xcode (3rd option). Make sure all constraints are set to 0, while making sure the red I is selected for each one when they are set and uncheck constraint to margins. Finally click add constraints :)
Hope this helps you!
Rachel

Resources