iphone – UIButton文本大小问题
我有以下代码:
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setTitle:@"My Title" forState:UIControlStateNormal]; button.frame = myCustomRect; UIColor *fontColor = [UIColor colorWithRed:0.43 green:0.84 blue:0.86 alpha:0.9]; [button setTitleColor:fontColor forState:UIControlStateNormal]; button.backgroundColor = [UIColor whiteColor]; button.titleLabel.textAlignment = NSTextAlignmentCenter; button.titleLabel.font = [UIFont fontWithName:@"Cooperplate" size:9]; [button addTarget:self action:@selector(moreDetails:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; 我试图以编程方式向视图添加按钮. 两件事情: 我究竟做错了什么? 解决方法
您可以在项目中使用自己的自定义字体作为
mentioned here
将自定义字体添加到项目后,可以将其用作, [button.titleLabel setFont:[UIFont fontWithName:@"Cooperplate" size:24.0]];
Image
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- objective-c – 如何将CMTime添加到NSMutableDictionary?
- cocos2dx在vs运行正常,在Android编译正常,运行错误的一个
- Flex自定义事件:一个地方派发(抛出),任何地方监听(捕获)
- cocos2dx修改引擎代码进行lua绑定
- c# – EF Code-first PluralizingTableNameConvention for
- Qt 读写 XML
- Swift3.0语言教程使用指针创建和初始化字符串
- c# – 以编程方式将图像添加到StackPanel
- ajax提交相同url,重复发送请求后台,页面无更新的问题解决
- 火云开发课堂 - 《使用Cocos2d-x 开发3D游戏》系列 第八节: