【发布时间】:2017-08-14 19:48:13
【问题描述】:
我有一个 UIToolbar 视图,其中有一个 UICollectionView。
工具栏是一个带有集合视图的文本视图,其中集合视图填充了用户提及。因此,如果在文本视图中输入“@m”,它将显示以字母“m”开头的用户名。
它曾经不在工具栏中,但我们意识到它没有通过键盘的交互式关闭正确关闭,并将其添加到工具栏中修复了该问题。 (它会在交互式关闭期间悬停在屏幕中间并且不会消失)
但是现在所有的用户交互都不再适用了(尽管在 IB 中启用了它)
这里是工具栏的设置:
override var canBecomeFirstResponder: Bool{
return true
}
override var inputAccessoryView: UIView?{
return self.typingView
}
//viewDidLoad里面:
let separator = UIView(frame: CGRect(x:0 , y: 0, width: ScreenSize.width(), height: 1))
separator.backgroundColor = UIColor.lightBackgroundGrey
self.typingView.addSubview(separator)
self.typingView.isTranslucent = false
self.typingView.setShadowImage(UIImage(), forToolbarPosition: .any)
self.typingView.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default)
self.typingView.removeFromSuperview()
self.setupMentionableCollectionView() //Sets delegate and data source only
【问题讨论】:
标签: swift uicollectionview uitoolbar