66226

UIScrollView layoutSubviews behavior changes in iOS 5?

I'm working on a component that is a subclass from UIView and contains a UIScrollView. When scrolling, I noticed different behaviors depending on which SDK I build with. On iOS 4 the layoutSubviews message is send on the scroll view's superview (which is my component) but on iOS 5 it seems that the message is not send anymore...

After taking a look at the iOS 5 release notes and changelog, I did not find any mention of such a change. Did I miss somethin?

Answer1:

In iOS5, layoutSubviews is not called on a scrollView's superview. But it was in iOS4.

If you want this behavior in iOS5, do this in your subclass of UIScrollView:

- (void)layoutSubviews { [super layoutSubviews]; // causes layoutSubviews to get called on superview [self.superview setNeedsLayout];

This was probably changed to be more efficient. Just because UIScrollView is scrolling, doesn't mean it's superview needs to layout itself.

Answer2:

I had big probs with resizing the size of button witch was subview in tableview. The nib loaded the smaller button and after loading I resize it. But the table view content didn't. (In iOS 4.* it was perfect but in iOS 5). So I figured out that I have to place my resizing in ViewDidLoad. I hope it helps to some1 =)

Recommend

  • Show Message on first launch after install
  • Liquibase - multiple datasources in a mixed order
  • Attach GestureRecogniser to multiple imageviews
  • How can I add a gradient that spans two views?
  • how can i do UIView animateWithDuration in viewDidLoad? ios7
  • access an alertView's calling view
  • I can't show LinearLayout at bottom to scroll view
  • How to Update UILabel from Another ViewController
  • UIPageViewController delegate method similar to scrollViewDidScroll:(UIScrollview*)scrollview
  • Render html in springfox-swagger-ui
  • Angular Databinding doesnt Work
  • Append the commit message automatically to the file being committed in Git
  • glpk.LPX backward compatiblity?
  • Setting attributes of an EditText added dynamically in Android
  • wrong item changes in recyclerview
  • How to expand parent div to account for child's overflow?
  • C++ stl pop doesn't return [closed]
  • How to remove last utf8 char of a python string
  • Unable to set a breakpoint on main while debugging a program compiled with Rust 1.10 with GDB
  • Iterate twice through a DataReader
  • Cordova Apache wrong module path
  • C# Excel interop - how to test if interop object is still working and performing a task?
  • C# List of Panels
  • Why does java tzupdater add leap seconds?
  • jQuery: add elements until a particular height is reached
  • Align navbar back button on right side
  • Trying to switch camera back to front but getting exception
  • Why winpcap requires both .lib and .dll to run?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to set the response of a form post action to a iframe source?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • -fvisibility=hidden not passed by compiler for Debug builds
  • Getting Messege Twice Using IMvxMessenger
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android
  • Is there any way to bind data to data.frame by some index?
  • How can i traverse a binary tree from right to left in java?
  • How to load view controller without button in storyboard?