• NSAttributedString 属性


    /** NSAttributedString 属性字符串,可以用于图文混排,尤其在QQ聊天界面,使用最为广泛

     */

    - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component

    {// 1. 获取到数据模型

        CZFlag *flag = self.flags[row];

           // 2. 实例化文本附件

        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];

        // 2.1 设置文本附件的图片

        attachment.image = [UIImage imageNamed:flag.icon];

        // 2.2 设置文本附件的大小

        attachment.bounds = CGRectMake(0, 0, 160, 44);

        // 3. 使用文本附件创建属性字符串

        NSAttributedString *myString = [NSAttributedString attributedStringWithAttachment:attachment];

        return myString;

    }

  • 相关阅读:
    近两年目标
    Spring使用ajax异步上传文件
    java注解
    js 点击文本框,预览选择图片
    修改服务器系统时间(包括hive)
    队列原理
    EMR目录
    2个CDH的hive数据同步
    CDH建表字符集问题
    EMR的fair-scheduler.xml
  • 原文地址:https://www.cnblogs.com/bluceZ/p/4629378.html
Copyright © 2020-2023  润新知