简体   繁体   中英

fontWithSize(fontSize: CGFloat) is available from which ios Version

I was using this function to change the font size of a label in UIButton. Like this(SWIFT) :-

Button!.titleLabel?.font = Button!.titleLabel?.font.fontWithSize(12)

I want to see the availability of this funtion for ios 7. So i see the quick help documentation of Xcode. There it was mentioned as iOS (8.0 and later)

Xcode帮助文本

Then i went on to search for the appropiate funtion on apple website but there it is wriiten that its available from Available in iOS 2.0 and later. See Here for ref.

Please do let me know which one to trust.

I saw answer but i am not that satisfied as i check the other class Like NSMutableAttributedString for swift

here it is written as available from iOS (3.2 and later) NSMutableAttributedString可用性

My strong guess is that since Swift came out together with iOS 8 Apple's documentation won't show anything being available before that. If you check the same method on Objective-C side, you'll see the same as on the web:

在此输入图像描述

I also have a project targeting iOS 7 with calls to fontWithSize in Objective C and they work fine. So there should be no reason for it to not be available on Swift side of things.

Also found information from Apple's Radar system :

Engineering has the following feedback for you:

This is expected - Swift was not available until WWDC 2014 and the introduction of iOS 8, therefore the availability of these methods and contstants in Swift is correctly documented as iOS 8+.

Thank you for your feedback. Engineering has determined that this issue behaves as intended.

So clearly this is the Apple way of doing things, as usual.

in Objective C

it is still 2.0

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM