iOS SDK Release Notes for IOS 8.3 Beta 4 excerpt (UIKit)

Source: Internet
Author: User
Tags uikit

(There is no word translation, I hope to understand, if there is something wrong, please correct me)

UIKit
NoteNoteWhen linking against IOS 8.3, any code this relies on layout information (such as the frame) of a UIButtonSubview when the button isn't in the window hierarchy would need to send layoutIfNeededTo the button before retrieving layout information (such as button.titleLabel.frame) To ensure the layout values is up to date.when compiling a link under iOS8.3, if UIButton (including subclasses) is not a window-level control, any code that involves getting and manipulating the layout information of UIButton (including subclasses), You should first send a layoutifneeded event (in fact, the Layoutifneed method that executes UIButton) to make sure that the UIButton layout information you get is up-to-date.

For example, if you had something like this:

For example, if iOS8.3 before, you write code like this:

UIButton *button = [UIButton Buttonwithtype:uibuttontypesystem];
Code that sets the button, but doesn ' t yet add it to a window
CGRect titleframe = button.titleLabel.frame;
Code that relies on the correct value for Titleframe

You now need: Then, you need to write code like this:
UIButton *button = [UIButton Buttonwithtype:uibuttontypesystem];
Code that sets the button, but doesn ' t yet add it to a window
[Button layoutifneeded]; This is also safe Pre-ios 8.3
CGRect titleframe = button.titleLabel.frame;
Code that relies on the correct value for Titleframe



iOS SDK Release Notes for IOS 8.3 Beta 4 excerpt (UIKit)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.