我想在留言泡泡中显示图片。 代码:
class ViewController: UIViewController
{
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad()
{
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool)
{
getMaskView()
}
func getMaskView()
{
let maskView = UIImageView(frame: CGRectMake(0, 0, 200, 200))
maskView.image = UIImage(named: "BubbleGreen")?.stretchableImageWithLeftCapWidth(20, topCapHeight: 15)
imageView.layer.mask = maskView.layer
}
}
结果是:
现在,我想为此气泡设置边框,例如,width = 2,color = red。我尝试了很多方法,但无论如何都失败了。任何解决方案?