objective-c - iOS 中如何设置UITextView的字体样式
大家讲道理
大家讲道理 2017-04-17 14:54:15
[iOS讨论组]

比如我想把字体设置为空心的 比如类似这样的

在线等

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(2)
黄舟

你确定这不是粗体,或者其他字体??

    NSArray *array = [UIFont  familyNames];
    NSLog(@"%@",array);

    UITextField *textedd = [[UITextField alloc] initWithFrame:CM(15, 350, Screen_Width - 30, 40)];
    textedd.font = [UIFont fontWithName:@"Party LET" size:20];
    textedd.placeholder = @"dfsdfdf";
    textedd.textColor = BlackColor;
    textedd.backgroundColor = WhiteColor;
    [self.view addSubview:textedd];


你设置textfiled的font属性,placeholder也会跟着变化的。

迷茫

首先你这个还是 UITextField 比较适用,
然后你就设置一下背景颜色和 placeHolder就可以了
边框圆角通过layer.corderRadius修改
大致如下吧:

  _tv.layer.cornerRadius = 15.0;
  _tv.backgroundColor = [UIColor grayColor];
  NSDictionary *attributes = @{ NSForegroundColorAttributeName : [UIColor whiteColor] };
  _tv.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"搜索神马" attributes:attributes];

PS:这个方式是ios 6.0+ 才可以的,因为attributedString的原因

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号