在JSQViewMessageViewController iOS中添加自定义标签
我想在每个单元格中添加一个带有时间戳的自定义标签,以及JSQMessageViewController中警告消息的图像。我已经在使用bottomlabel和toplabel了。但是我无法得到我想要的结果。在JSQViewMessageViewController iOS中添加自定义标签,ios,objective-c,iphone,ios7,jsqmessagesviewcontroller,Ios,Objective C,Iphone,Ios7,Jsqmessagesviewcontroller,我想在每个单元格中添加一个带有时间戳的自定义标签,以及JSQMessageViewController中警告消息的图像。我已经在使用bottomlabel和toplabel了。但是我无法得到我想要的结果。 对不起,我没有太多时间去看。。但同样,您可以在相同的消息bubble xib中添加该图像,并根据需要添加约束 如何在JSQMessageviewcontroller中添加自定义标签是。。。我在ViewDidLoad之前声明标签文本 // Add Text Label let myLabel
对不起,我没有太多时间去看。。但同样,您可以在相同的消息bubble xib中添加该图像,并根据需要添加约束 如何在JSQMessageviewcontroller中添加自定义标签是。。。我在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中添加此代码,或在任何您喜欢的地方调用
这就是我在应用程序中添加自定义标签的方式。希望这对你有帮助 谢谢你的回答。但我需要在JSQMessageviewcontroller的委托方法中使用。
// 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
}()
self.view.addSubview(myLabel)
setUpMyLabel()