你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> iOS SDK Release Notes for iOS 8.3 (UIKit)

iOS SDK Release Notes for iOS 8.3 (UIKit)

編輯:關於IOS

UIKit

Note 注意

When linking against iOS 8.3, any code that relies on layout information (such as the frame) of a UIButton subview when the button is not in the window hierarchy will need to send layoutIfNeeded to the button before retrieving layout information (such as button.titleLabel.frame) to ensure that the layout values are up to date.

在iOS8.3下編譯鏈接的時候,如果UIButton(包括子類)不是窗口級別 的控件,任何涉及獲取和操作UIButton(包括子類)布局信息的代碼,都應該先發送一個layoutIfNeeded事件(其實就是執行 UIButton的layoutIfNeed方法),以確保獲取到的UIButton的布局信息是最新的。

For example, if you had something like this:

舉例如下,如果iOS8.3以前,你這樣寫代碼:

UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
// code that sets up 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: 那麼,現在你需要這樣寫代碼:
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
// code that sets up the button, but doesn’t yet add it to a window
; // This is also safe pre-iOS 8.3
CGRect titleFrame = button.titleLabel.frame;
// code that relies on the correct value for titleFrame
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved