UITextView in UIScrollview is below visible screen on iPhone 5S - ios

I've an image and text view. Text view is pinned to the bottom, left and right to superview. On iPhone 11 text view visible as intended but on iPhone 5S it is hidden. On iPhone 5S I've to scroll up to see text view which is not what I want. I want text view to be visible at the bottom on all devices as it's pinned to bottom of superview. I can't figure out what is wrong. Below are screenshots of IB and device screenshots.
How to fix this issue?

If you want it to be visible regardless of the screen size, don't put it inside of the scrollview, put it outside. Right now it's constrained to its parent, which happens to be a view constrained to the scrollview, so it's positioned below, and you need to scroll to see it.

Related

Scrollview not working properly on iPad in xcode(iOS)

Recently, i've been building and app which requires a scrollview, for all the content to fit. I've had a few difficulties creating my scrollview. I've tried a few different methods for building it, but ended up building it in storyboard with autolayout. I've set the height of the view controller to 1000, and therefore also the simulated size to freeform. The width of the content view inside the scrollview, I've to the same as the view which contains the scrollview.
The hierarchy goes like this:
-View controller scene
-Top layout guide
-Bottom layout guide
-View
-Scroll view
-Content view
-Label with text here
-Constraints
-And so on
I've been replicating the process in this link, to create the scrollview:
https://www.ralfebert.de/snippets/ios/auto-layout-recipes/uiscrollview-storyboard/
When running the application on the simulator, I get the following result:
The scrollview is not working properly on the iPad. It seems like the scrollview doesn't adapt to the changes in the width, which happens when its ran on an iPad, since it's bigger. When the app is ran on the iPad, the scrollview stays the same width as if it were shown on the iPhone.
This is how it looks in the editor. The view controller on the left is the view controller which has the scrollview implemented, and the one on the right doesn't. The first image shows the storyboard, when I view it with the iPhone 8, and the second image is when I view it with an 9,7" iPad:
It would be greatly appreciated if anyone could give me a hint to whats going on!
EDIT:
Left side is what it looks like, and right side is what it should look like:
Add the UIScrollView to your main view
Set Top, Left, Right, Bottom constraints all to Zero
Add a UILabel inside the scroll view
Set number of lines to Zero
Set Top, Left, Right, Bottom constraints all to Zero
Set the label's width constraint equal to the scroll view's width
That should do it :)
This will keep the label's text aligned to the top of the scroll view. If you add enough text to fill more than the full screen, it will scroll vertically.

How to Re-Size Label to fit any screen size

Ok, here's what I'm trying to do:
I would like to create a scroll view to scroll vertically, in case my text is longer than the screen size (think iPhone 4 vs. iPhone 6).
I've added a scroll view and placed a view within that. I embedded by label for the text within the view.
However, the scroll view currently will scroll only horizontally.
Is there a way to constrain the label width to be the width of the screen? How do I do this?
You can constrain the width to contentview to be equal to scrollview width. And pin the four sides of label to the content view.
Also you will need to pin all sides of content view to scrollview, if you haven't already did that.
If you push the constraint button on the bottom of your storyboard pin it to both the left and right side. Uncheck constraint to margins and pin it both 0. :)

Scroll View Size not match with the device screen in xcode

Ok, I tried the page with several buttons but all of them will not fit in one screen. So, I create the scroll view and the view and then put all of buttons inside the view. The storyboard look fine. Other devices such as iPhone 5 and 5S look fine but when I tried 6 and 6 plus, the size of scroll view was incorrect. I couldn't figure what went wrong.
You have to modify constraint for
scrollview with uncheck constraint to margin with all left right
bottom and top is zero
Container view to super view set equel width constraint
container view to scrollview set horizontal center constraint.
Each UIBUtton set top/left/bottom with constant height not set bottom constraint.

Constraints inside Scroll View

I'm working on application for iOS. Trying to use Autolayout with Scroll View.
But there is some problem. I have View -> Scroll View -> Content View hierarchy. I pinned (top, bottom, left, right) of the Scroll View to the Main View, and also pinned Content View to Scroll View.
Then i've added imageView on the top of the screen and text label below, to the Content View. Added them constraints including vertical spacing (8pt) from image to label. In Preview everything looks ok and label placed right below image, however when i'm running the app on iOS Simulator, my label places right in the middle of image. Please, any help?
We found an answer in the comments: it was due to a wrong content scaling mode of the image. It needed to be ClipToBounds.

iOS layout woes - on 4s, the bottom button is unhittable

I'm making an app that supports 4s through to iPad (portrait only).
One view controller is set out roughly like this with these constraints:
http://i.stack.imgur.com/7tNlJ.png
The third button at the bottom when I launch on iPhone 4s can't be tapped.
Anyone have any idea why this might be?
I believe your problem is the bottom constraint of 128 pt on your bottom view. You should let your buttons drive the size of your bottom view. To do this, remove all constraints on the bottom view except for the align center to superview one.
Then, have your first and third buttons be tied to their superview through a top and bottom constraint respectively.
Also, have your first button be tied to it's superview with a leading and trailing constraints.
Finally, make sure all buttons have width and height constraints. And also, the second button should be tied to your first and last buttons, through top and bottom constraints, of course.

Resources