//根据button高度来设置字体大小

CGFloat dayLabelWidth = (viewWidth-10)/7-1;

cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(viewWidth/2, viewHeight-dayLabelWidth*1.2, viewWidth/2, dayLabelWidth*1.2)];

cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:dayLabelWidth*0.5];

[cancelButton setTitle:@"取消" forState:UIControlStateNormal];

cancelButton.backgroundColor = [UIColor grayColor];

[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

[cancelButton addTarget:self action:@selector(cancelSelectCurrentDate) forControlEvents:UIControlEventTouchUpInside];

[self addSubview:cancelButton fixedOn:viewName fixed:true];

ios字体大小适应不同屏幕的更多相关文章

  1. iOS字体大小

    1,iOS 字体大小单位是pt——磅. 英文字体的1磅,相当于1/72 英寸,约等于1/2.8mm. px:相对长度单位.像素(Pixel).(PS字体) pt:绝对长度单位.点(Point).(iO ...

  2. Android重写getResources规避用户调整系统字体大小影响Android屏幕适配

    Android屏幕适配一直是一个头疼的问题.除此之外还要考虑APP在实际应用场景中,用户千奇百怪的设置,最常见的用户设置行为就是设置手机的字体大小,比如把字体设置成超大或者超小,这对屏幕适配又带来额外 ...

  3. Android 根据屏幕分辨率自动调整字体大小

    1.在oncreate 里获取手机屏幕宽和高度 DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDispl ...

  4. UISegmentedControl字体大小,颜色,选中颜色,左边椭圆,右边直线的Button 解决之iOS开发之分段控制器UISegmentedControl

        NSArray *segmentedArray = [NSArrayarrayWithObjects:STR(@"Mynews"),STR(@"Systemmes ...

  5. iOS NSString 文本不同的颜色 标题+文本字体大小 行间距/删除不需要的字符 /以及自适应高度

    #import <Foundation/Foundation.h> @interface TextsForRow : NSObject @property(nonatomic,copy)N ...

  6. ios 运行时特征,动态改变控件字体大小

    需求:ex: 在不同尺寸的iPhone上面显示的字体大小不一样 https://github.com/rentzsch/jrswizzle #import <UIKit/UIKit.h> ...

  7. iOS开发之--如何修改TabBarItem的title的字体和颜色/BarButtonItem的title的字体大小和颜色/添加背景图片,并添加点击方法

    在进行项目的过程中,我们往往会遇到各种各样的自定义颜色和字体,下面提供一种修改系统自带的TabBarItem的字体和颜色的方法,希望能帮到大家: [[UITabBarItem appearance] ...

  8. iOS TableView索引字体大小设置

    -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger ...

  9. 用js判断屏幕的宽度,改变html字体大小用rem布局

    if (document.documentElement.clientWidth > 600) {//页面宽度大于600px让其宽度等于600px,字体大小等于60px,居中 document. ...

随机推荐

  1. 4、Spring+MyBatis增删改查

    0.oracle数据库脚本 create table userinfo (id ), name ), password telephone ), isadmin )); --4.2 用户表序列 cre ...

  2. Gentoo网络配置

    网卡识别配置 要开始配置你的网卡,你首先需要告诉Gentoo RC系统你的网卡. 可以用ifconfig命令查看自己网卡名字: ifconfig -a 网卡名字(如eth0)的识别是通过在/etc/i ...

  3. css3部分属性兼容性别扭写法(因为很多我就叫他别扭了,希望全面早早支持css3吧)

    /*圆角class,需要设置圆角的元素加上class名称*/ .roundedCorners{ -webkit-border-radius: 10px;/*webkit内核浏览器*/ -moz-bor ...

  4. 酷比魔方 iwork10 旗舰版

    平板电脑自带的win10的一键恢复不是一般的慢,简直慢出个性了,历经5个小时...必须是个有耐心的人才敢一键恢复,不然强制关机就变砖了...

  5. K - Balance(动态规划专项)

    K - Balance Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit  ...

  6. ClassLoader类加载解惑

    1.通过类加载器获取路径: String path = Thread.currentThread().getContextClassLoader().getResource("." ...

  7. Jekyll: .md to .html with self defined themes..

    theme is from here $ gem install jekyll bundler ~ $ jekyll new my-awesome-site ~ $ cd my-awesome-sit ...

  8. android常用工具类

    import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkIn ...

  9. ios xcode中所有自带的字体如下(最好结合NSMutableAttributedString相结合使用)

    // 打印系统中所有字体的类型名字 NSArray *familyNames = [UIFont familyNames]; for(NSString *familyName in familyNam ...

  10. apache 添加到windows服务

    cmd命令行下 输入 “d:\apache\bin\httpd.exe” -k install 如果是resin的话直接运行目录下的setup就可以了, 前提是需要.net framework 3.5