iOS 9.1 UIScrollView leaving blank space - ios

I have a ViewController with a hierarchy as follows:
UIViewController
UIView
UIScrollView
UIView
UIImageView
UILabel
The layout is such that the UIScrollView fills the screen. There is no extra logic executed on this ViewController, such as programatic scrolling, listening to scrolling, etc.
When I run this on an iOS 9.0 simulator, the layout is correctly inflated, with the UIImageView drawn flush against the top margin.
But when I run this on an iOS 9.1 simulator, there is initially a large whitespace between the top margin and the image. Upon touching the UIScrollView it corrects itself, scrolling that the UIImageView is flush against the margin.
Setting automaticallyAdjustsScrollViewInsets does not have an effect (presumably because the scrollview isn't at my root).
My question is: What is different about iOS 9.1 scrollviews that it would be causing this, and what is the work around? Its bothering me since this isn't exactly a complex layout I'm trying to use.
Edit
Screen shot of my hierarchy and the constraints applied to them, maybe it helps.

I think the issue might be the hight constraints. try getting rid of them and add them back in, one at a time as needed.

Related

ScrollView height for 3.5" vs 4" iPhone

I have a UITableView in a UIViewController which is inside a UINavigationController which is inside a UITabBarController.
When Developing using a 3.5" Simulator and having my storyboard set to 3.5" and everything works fine.
However if I use a 4" simulator, the UITableView ends too short up the screen. And if I do it the other way around the table view ends off the bottom of the screen.
How do I go about correctly sizing my UITableView?
(P.S. I'm not sure it matters, but I'm loading an AdBannerView which goes at the bottom of the screen, so I'm adjusting the contentInset of the UITableView after it is loaded to make space for the AdBannerView, but I don't think that makes a difference to this situation).
You need to add auto layout constraints so that the components are resized according to the desired logic.
Read Apple's Auto Layout Guide and you'll know everything you need in order to accomplish this.

Scroll View is not scrolling

I have designed my app for 4inch devices using xcode 5 and storyboard builder. Since the 3.5inch screen is a little bit smaller, I want to make my view scrollable.
This is what I have done: I added a ScrollView using interface builder and added my View (that contains all elements) as a subview of it.
I start the app using the 4inch simulator and it does not scroll - exactly what I want. But when I open it with the 3.5inch simulator my content gets cut and scrolling is not possible. Why? And how can I activate it?
have you implement the UIScrollViewDelegate Protocol
Do you use Autolayout?
You also want to make sure your scrollview's contentSize is set to your view's size.

UIScrollView Skips at Bottom

In my app I have a UIScrollView with not many subviews that doesn't use Auto Layout but rather plain old Autosizing to fill itself to the size of the view controller. The only line of code that interacts with it is this:
settingScrollView.contentSize = CGSizeMake(320, 600);
The problem is that only on the iPhone 4/4S, it does this skip sort of thing when you reach the bottom of the scroll view. Here is a video of what happens.
Is this a UIKit bug or am I doing something wrong?
The problem seems to be a bug with iOS 7. This was a scrollview in a scrollview which, while I know is not best practice, worked just fine on the iPhone 5/5S form factor it had the strange behavior mentioned above on the iPhone 4/4S. Moving the daughter scrollview out of the parent scrollview and having it move as though it were in the parent scrollview.

Unresponsive area in UITableView in landscape orientation

I'm developing an iPad application where I have a screen with UITableView hosted on UIScrollView. UITableView's leading space and trailing space is being pinned to superview.
I'm using Autolayout in my project.
When this screen appearing in landscape mode or rotated to it all visible elements of UITableView being resized correctly. However area after x=768pt is being untouchable. It's definitely area because beginning of editable elements (text view and text field) are being touchable.
I checked contentSize of table, it's being OK (1024 in my case).
Also when I rotate iPad from landscape to portrait contentSize of table still stays landscape (1024). I tried solution from this topic: bug in UITableView layout after orientation change and it worked. Don't know if this is connected to my issue.
I tried to place regular view instead of my UITableView. On this view after rotation touch area was OK. However when I placed my table on this view right area still was unresponsive.
Table's property clipsToBounds set to YES so it seems that content is not becaming outside of UITableView.
Please point to what may cause this issue. Right now I'm completely out of ideas what may cause this.
I found a solution. The problem was in overriden method -(void)layoutSubviews in my custom cell. I simply forgot to call [super layoutSubviews] in it.
Never forget to call [super layoutSubviews] in any non-standard view.
Hope my solution will help someone not to waste hours on simple issue.

Using UIScrollview in iphone5 compatible app

I have a problem adapting my apps to the new iphone5 layout, I've made the following passes:
Added a retina 4" splash image
Modified the interface in my storyboard with "Size inspector" to change the anchoring of the widgets
Tested the app with iOS6 "retina 4" simulator.
The app works as expected except when the user pop up the keyboard to edit a text, I use the "stretching scrollview" method for this particular situation and this seems not compatibile with the "autosizing" properties of my widgets, here is an example, from iOS6 simulator, without and with keyboard:
And here is what happens:
I'm quite sure this is a coherent behaviour since my main view is stretched so the other items inside it are stretched following their anchoring, the fact is that I'd like to have the same behaviour of my previous fixed position (all widgets anchored to the top left corner) with the iphone5 gui expansion, is this possibile?
How do you solve the problem of showing a keyboard and scroll hidden content in an iphone 5 compatible way?
I have been having similar problems. From what I have found thus far, we may need to remove all constraints on the view within the scrollable view, because it appears that it's contents are being resized along with the frame of the scrollView. I know that setting the internal view's frame manually in viewWillAppear will work, but then you are stuck having a view that is the same size for both iPhone4 and iPhone5 (albeit it will scroll). Or you could "pin height and pin width" of the internalView right there in storyboard.
Two potential approaches that may work. Sorry I can't confirm these as I'm giving up and redesigning around this problem.
1. Programmatically add constraints to your internal view's subviews. The programmatic constraints will allow you to "spring" the distance between your elements proportionally. When adding constraints programmatically, you are given access to a factor called "multiplier" (not to be confused with priority), which I saw someone else on stackoverflow posting about.
2. You can design the internalView in Interface Builder as a separate viewController with it's .xib file, and then use storyboard to load it as an embedded viewController to a "containerView" object, which you would put in place as the new "internal view" of the scrollView. Perhaps then the .xib would first resize to the correct iOS device, and then you could use its frame to resize the containerView.
My advice is create a small test-case of these before implementing, else you end up like me, having spent hours down the wrong path and facing a dead-end.
UPDATE 12/4/12
Make your life easier by NOT setting the ScrollView as the main view of the ViewController.
--Instead, make ViewController.view a dummy/blank view, and embed a scrollView inside that view. Then, embed another view (my CustomView) in the ScrollView. CustomView contains all the visible controls and text boxes and buttons. There is NO HEIGHT CONSTRAINT on CustomView.

Resources