为什么 UIButton 的 font 属性 Deprecated 了?

2016-06-24 11:23:46 +08:00
 vincentxue

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

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

2748 次点击
所在节点    iDev
5 条回复
dxk611
2016-06-24 14:21:34 +08:00
setAttributedTitle:<#(nullable NSAttributedString *)#> forState:<#(UIControlState)#>
vincentxue
2016-06-24 14:25:31 +08:00
@dxk611 我认为压根不是这个原因, font 在 3.0 就被 Deprecated 了,但是这个方法在 6.0 才出现。
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
2016-06-24 15:49:34 +08:00
支持 markdown ,多行代码标记

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

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

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/287992

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX