在JSQViewMessageViewController iOS中添加自定义标签 [英] Add Custom label in JSQViewMessageViewController iOS

查看:60
本文介绍了在JSQViewMessageViewController iOS中添加自定义标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在每个单元格中添加一个自定义标签(带有时间戳),并在JSQMessageViewController中添加一个图像(用于警告消息).我已经在使用bottomlabel和toplabel.但是我无法获得想要的结果. 图像是我希望它看起来像的参考

I want to add a custom label (with a time stamp) in each cell as well as an image (for warning message) in JSQMessageViewController. I am already using bottomlabel as well as toplabel. But I am unable to get the result I want. The image is a reference of what I would like it to look like

推荐答案

如何在JSQMessageviewcontroller中添加自定义标签是...
我在ViewDidLoad之前声明 Label 文本.

How I add custom Label in JSQMessageviewcontroller is...
I declare Label text before ViewDidLoad.

 // Add Text Label
let myLabel: UILabel = {
    let lb = UILabel()
    lb.translatesAutoresizingMaskIntoConstraints = false
    lb.textAlignment = .center
    lb.numberOfLines = 1
    lb.textColor = UIColor.white
    lb.font=UIFont.systemFont(ofSize: 22)
    lb.backgroundColor = UIColor(red: 0.0/255.0, green:70.0/255.0, blue:110.0/255.0, alpha:1)
    lb.text = NSLocalizedString("No Notification", comment: "")

    return lb
}()


并将此代码添加到viewDidiLoad或在您喜欢的任何地方调用.


And add this code in viewDidiLoad or call anywhere you like.

 self.view.addSubview(myLabel)
 setUpMyLabel() 

这是我在应用程序中添加自定义标签的方式.希望这会帮助你. :)

This is how I add custom label in my app. Hope this will help you. :)

这篇关于在JSQViewMessageViewController iOS中添加自定义标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆