V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
vincentxue
V2EX  ›  iDev

为什么 UIButton 的 font 属性 Deprecated 了?

  •  
  •   vincentxue ·
    vincentsit · 2016-06-24 11:23:46 +08:00 · 2727 次点击
    这是一个创建于 2857 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在想这个问题,又没有 - (void)setFont:(UIFont *)font forState:(UIControlState)state; 这样的方法,为什么要把它置为 Deprecated ?是因为公开了 titleLabel 属性吗,两者都可以设置 font 属性,同一个属性有两个地方可以设置,不符合某个设计模式?我猜的。。

    似乎 v2 的 Markdown 语法不支持 `` 标记代码?

    5 条回复    2016-06-24 16:15:30 +08:00
    dxk611
        1
    dxk611  
       2016-06-24 14:21:34 +08:00
    setAttributedTitle:<#(nullable NSAttributedString *)#> forState:<#(UIControlState)#>
    vincentxue
        2
    vincentxue  
    OP
       2016-06-24 14:25:31 +08:00
    @dxk611 我认为压根不是这个原因, font 在 3.0 就被 Deprecated 了,但是这个方法在 6.0 才出现。
    lee0100317
        3
    lee0100317  
       2016-06-24 15:19:14 +08:00
    titleLabel 3.0 后开始可用

    font
    (iOS 3.0) Property
    The font used to display text on the button.

    Deprecation Statement
    Use the font property of the titleLabel instead.
    hyyy
        4
    hyyy  
       2016-06-24 15:49:34 +08:00
    支持 markdown ,多行代码标记

    ```
    NSLog(@"%@", @"Hello World");
    ```
    vincentxue
        5
    vincentxue  
    OP
       2016-06-24 16:15:30 +08:00
    @lee0100317 你没看明白我的问题。。

    @hyyy 你说的是多行的,我说的是这个:

    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2796 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 14:45 · PVG 22:45 · LAX 07:45 · JFK 10:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.