0
我使用的iMessage擴展創建標籤瀏覽器的代碼是:無法創建自定義的約束貼紙瀏覽器
func createStickerBrowser() {
let controller = MSStickerBrowserViewController(stickerSize: .small)
view.translatesAutoresizingMaskIntoConstraints = false
addChildViewController(controller)
view.addSubview(controller.view)
controller.stickerBrowserView.dataSource = self
controller.view.backgroundColor = UIColor.green
let leading = NSLayoutConstraint(item: controller.view, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0)
let trailing = NSLayoutConstraint(item: controller.view, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0)
let bottom = NSLayoutConstraint(item: controller.view, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0)
let top = NSLayoutConstraint(item: controller.view, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 0)
view.addConstraints([leading, trailing, top, bottom])
}
但我的故事板是這樣的:
爲什麼它不被添加到視圖層次?我需要把它放在按鈕旁邊。按鈕是固定的,但不乾膠標籤瀏覽有自己的滾動。這個怎麼做? MSMessagesAppViewController類的