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
chenyf119
V2EX  ›  iDev

Size Class 布局元素时,怎么为不同的设备类型( iPhone 5、 iPhone 6、 iPhone 6+)设置不同的字体大小

  •  
  •   chenyf119 · Feb 5, 2015 · 5547 views
    This topic created in 4143 days ago, the information mentioned may be changed or developed.
    项目只需要适配iPhone portrait,尝试Size Class布局,在给不同设备类型设置不同字体大小时,发现storyboard并不能完成这项工作,需要代码配合。

    大家有没有遇到这种情况,是怎么解决的。
    3 replies    2015-02-05 16:08:31 +08:00
    EggmanQ
        1
    EggmanQ  
       Feb 5, 2015
    宏定义一个font size,再判断不同设备的时候有不同的值。
    rannie
        2
    rannie  
       Feb 5, 2015
    定义一个UIConfig的类 定义了一些字体颜色什么的 启动程序的时候判断设备 设置一套值 然后程序里直接读这个类中的属性就好了
    chenyf119
        3
    chenyf119  
    OP
       Feb 5, 2015
    @EggmanQ
    @rannie
    感谢回复!

    我目前的做法是,storyboard基于一个设备类型(比如iPhone5)设置字体,程序里根据当前设备类型计算缩放比例,然后计算出当前设备类型对应的字体大小。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2598 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 16:02 · PVG 00:02 · LAX 09:02 · JFK 12:02
    ♥ Do have faith in what you're doing.