简体   繁体   English

可以从ios版本获得fontWithSize(fontSize:CGFloat)

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

I was using this function to change the font size of a label in UIButton. 我正在使用此函数来更改UIButton中标签的字体大小。 Like this(SWIFT) :- 像这样(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. 我想看看ios 7的这个功能的可用性。所以我看到了Xcode的快速帮助文档。 There it was mentioned as iOS (8.0 and later) 有人提到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. 然后我继续在苹果网站上搜索合适的功能,但是它可以从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 我看到了答案,但我不满意,因为我检查了其他类,如NSMutableAttributedString

here it is written as available from iOS (3.2 and later) 这里写的是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. 我的强烈猜测是,自从Swift与iOS 8一起推出以来,Apple的文档在此之前不会显示任何可用内容。 If you check the same method on Objective-C side, you'll see the same as on the web: 如果在Objective-C端检查相同的方法,您将看到与在Web上相同的方法:

在此输入图像描述

I also have a project targeting iOS 7 with calls to fontWithSize in Objective C and they work fine. 我还有一个针对iOS 7的项目,在Objective C中调用了fontWithSize ,它们工作正常。 So there should be no reason for it to not be available on Swift side of things. 因此,没有理由不在Swift方面提供它。

Also found information from Apple's Radar system : 还从Apple的Radar系统中找到了相关信息:

Engineering has the following feedback for you: Engineering为您提供以下反馈:

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+. 这是预期的 - 直到2014年WWDC和iOS 8的推出,Swift才可用,因此Swift中这些方法和常量的可用性被正确记录为iOS 8+。

Thank you for your feedback. 感谢您的反馈意见。 Engineering has determined that this issue behaves as intended. Engineering已确定此问题的行为符合预期。

So clearly this is the Apple way of doing things, as usual. 很明显,这是Apple的做事方式,像往常一样。

in Objective C 在目标C中

it is still 2.0 它仍然是2.0

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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