label 调整label高度
2015-06-26 14:12
302 查看
// CGFloat width1=[(NSString *)ob1 boundingRectWithSize:CGSizeMake(1000, FONTHEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;
//
//boundingRectWithSize: CGSize 对应 constrainedToSize: CGSize
//attributes:@{NSFontAttributeName: [ UIFont ] }
对应 sizeWithFont[ UIFont ]
//options: NSStringDrawingUsesLineFragmentOrigin
默认照填
//context: nil 默认照填
// - 返回一行的时候 str 的尺寸.
CGSize size = [str sizeWithAttributes:dic];
CGSize size = [@"sdfsf" sizeWithAttributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:12]}];
//
//boundingRectWithSize: CGSize 对应 constrainedToSize: CGSize
//attributes:@{NSFontAttributeName: [ UIFont ] }
对应 sizeWithFont[ UIFont ]
//options: NSStringDrawingUsesLineFragmentOrigin
默认照填
//context: nil 默认照填
// - 返回一行的时候 str 的尺寸.
CGSize size = [str sizeWithAttributes:dic];
CGSize size = [@"sdfsf" sizeWithAttributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:12]}];
相关文章推荐
- div中的背景图片不显示
- Objective-C语法学习 第三天
- Material Design效果实现
- 基于Tomcat7、Java、WebSocket的服务器推送聊天室项目
- iOS7修改NavigationItem上的标题名字大小颜色
- 数据结构问题汇总
- ftp server来源分析20140602
- 数据结构--双链表的创建和操作
- oracle11g备份导入oracle10g
- linux下mysql主从配置
- 程序猿们,快用Emoji表情写代码吧
- Android解决屏幕适配问题
- 黑马程序员——Xcode常用快捷键
- WPF的Binding学习笔记(三)
- 安卓按钮单击事件
- oracle 优化or 更换in、exists、union all几个字眼,测试没有问题!
- tomcat 优化策略
- Ibatis读写CLOB数据
- laravel Route::controller 使用路由命名
- 在我的年代不能陪伴你