我正在为swift3中的I message应用程序实现贴纸包装应用程序
我的代码如下所示
func loadStickers() {
for i in 1...6 {
if let url = Bundle.main.url(forResource: "flower\(i)", withExtension: "jpg") {
do {
let sticker = try MSSticker(contentsOfFileURL: url, localizedDescription: "")
stickers.append(sticker)
} catch {
print(error)
}
}
}
}
func createStickerBrowser() {
let controller = MSStickerBrowserViewController(stickerSize: .large)
addChildViewController(controller)
view.addSubview(controller.view)
controller.stickerBrowserView.backgroundColor = UIColor.blue
controller.stickerBrowserView.dataSource = self
view.topAnchor.constraint(equalTo: controller.view.topAnchor).isActive = true
view.bottomAnchor.constraint(equalTo: controller.view.bottomAnchor).isActive = true
view.leftAnchor.constraint(equalTo: controller.view.leftAnchor).isActive = true
view.rightAnchor.constraint(equalTo: controller.view.rightAnchor).isActive = true
}//委托
func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
return stickers.count
}
func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
return stickers[index]
}这里的输出也没有bug
但是问题是什么是贴纸显示的列表,我需要网格意味着每行3贴纸我搜索了很多教程,但我没有得到任何人可以帮助我…
提前感谢
https://stackoverflow.com/questions/44518773
复制相似问题