I have my mobile app in Objective C.
I have a scroll view page. In Simulator iPad Pro it works.
In Simulator iPhone 6 Plus, the scroll view starts at lower part of
page and I cannot get it back up to top. In fact all of
the iPhone ( 5,6,7) look like the iPhone 6 plus.ie the top of
the page shows "Grade" and "County". I cannot scroll up to see
"First Name". The only thing I am changing is the device.
Suggestions?
below is iPhone 6 Plus
SOLVED- During trying all several options, I
forgot I had:
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
// REMOVE the LINES BELOW
[self.scroller layoutIfNeeded];
self.scroller.contentSize = self.contentView.bounds.size;
self.contentView.center = self.view.superview.center;
}
After removing the 3 lines above, it worked correctly in iPhone 5, 6, 7.
The IPad worked WITH or WITHOUT those 3 lines.
I spent a lot of time on this. I hope this helps others.
are you using Constraints to setup your views? if so then try checking scrollview's top constraint whether its linked to Top Layout Guide's bottom ?
Related
I'm creating a simple app that includes a table view using Swift 5 and Xcode 11. Inside the table view(which, by the way, is fixed into landscape), there is a button on the right of the tableview cells and an image view with fixed constraints, size, and width on the left. Everything has been working out pretty well for my app, until I noticed that the image view would kind of 'disappear' if I changed the device to, for example, iPhone 5s, 4s, or even iPhone Pro(I'm testing with iPhone 11 Pro Max).
This is when the device is iPhone 11 Pro Max:
11 Pro Max
This is when the device is iPhone 11 Pro: 11 Pro
And here are my constraints for my image view: Constraints
Any help is appreciated
P.S. Ignore the image view that says 'img'
After seeing both of the screen shots and the constraints I see what is the issue here.
It's the way you have applied the trailing constraint for the image which in your case is 663 (Should not be fixed). What you can try is Give width constraint to the image view and then change the trailing constraint something like below
This should help you.
Also what you have to take care of moving forward is the constraints you choose to apply coz that is the most important thing while desigining Responsive UI
Happy Coding.
right Constraint should be negative,for example,
img.snp.right = view.right - 20
I am new to Xcode, and have been trying to figure out how to use AutoLayout and constraints. Long story short, after I hit 'add missing constraints' the Iphone 7 screen looks just as I intended, but both the Iphone 7 plus and Iphone SE screens look completely screwed up. What can I do to fix this so that every screen looks like the Iphone 7?
Iphone 7
Example Iphone SE (screwed up)
add missing constrains option means: adds the constraints needed to have a nonambiguous layout. may not work well for all iOS devices, and may not work well for device's rotation changes or view size changes, so, check view's constrains in size inspector panel
for more info:check Apple's auto layout guide
I have developed my App on XCODE 8 which by default removes iPhone 4 emulator and I didn't notice that until I finished my app, and I used Auto layout to make the UI fits all iPhone screens and that what happened (the layout was good on iPhone 7,6,5) the problem is when I additionally installed iPhone 4 emulator I found that the layout is totally missed up and unreadable/usable.
So what options do I have to solve this and make it fit the iPhone 4 screen too with Auto-Layout with missing up the other sizes ?
Here is screen shot of my Login screen on iPhone 6 (4.7") vs iPhone 4 (3.5")
You must always give constraints with respect to other alternative buttons or a view, it should not be hard coded. Try making views programatically, it will be more easy and helpful to you.
It seems like your constraint is set to have a fixed distance related to the top of your screen. So when the screen height get smaller, your views are pushed out of the screen. So to better adjust views position, you can have your views to be related to vertical center. Say your login box is in both horizontal and vertical center, not metter you are using iphone 6 or 4, you should always see your login box.
I have developed an app for iphone 6. It works well on iphone 5 also but on 4s the bottom part is being cut off. Is there any way i can make the app to work for iphone 4s without using autolayouts.
This works well for iphone 6
But not for 4s, below is how it looks. The buttons are not visible.
Thanks for your answer
You can use UIScrollView instead of UIView & add all your inner control to Scroll view.
This will make Buttons visible all the time & Scroll the content.
Second Option, you can use AutoLayout. (which you dont want to use.!!)
Third , You can create a new design for iPhone 4s (if & only if u want the look exactly same as others)
-although, not recommended!!!
You can use UIScrollView instead of UIView & add all your inner control to Scroll view. Otherwise use UITableView
It will solve your problem.
my client has an iPhone 6 and can't scroll down on a particular page that has a form in an "overlay" over the rest of the page.
It works fine in iPhone 5c, so I am a little confused why?
Here is the page: http://www.ingleandrhode.co.uk/appointment-form/
Many thanks
Dave
I have load the url in the webView and in iPhone 6 scrolling is smooth. Just added webview to my viewController and added autolayout constraint trailing, leading, top & bottom space. Check screenshots.