(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
UIButton
Subview when the button isn't in the window hierarchy would need to send
layoutIfNeeded
To 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)