Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JSQViewMessageViewController iOS中添加自定义标签_Ios_Objective C_Iphone_Ios7_Jsqmessagesviewcontroller - Fatal编程技术网

在JSQViewMessageViewController iOS中添加自定义标签

在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

我想在每个单元格中添加一个带有时间戳的自定义标签,以及JSQMessageViewController中警告消息的图像。我已经在使用bottomlabel和toplabel了。但是我无法得到我想要的结果。


对不起,我没有太多时间去看。。但同样,您可以在相同的消息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()