swift - UIToolBar with UICollectionView -
i have uitoolbar view has uicollectionview in it.
the toolbar text view collectionview collectionview filled user mentions. if in textview type "@m" display usernames begin match letter "m".
it used not in toolbar, realized didn't dismiss interactive dismisses of keyboard , adding toolbar fixed that. (it hover in middle of screen during interactive dismiss , wouldn't go away)
however user interaction doesn't work on anymore (despite being enabled in ib)
here set of toolbar:
override var canbecomefirstresponder: bool{ return true } override var inputaccessoryview: uiview?{ return self.typingview }
//inside 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 , data source
since created toolbar in ib, have height constraints on toolbar and/or collectionview, should update whenever contentsize of collectionview changes.
i think what's going on frame of collectionview (which subview of toolbar) larger frame of toolbar, that's why can't click it.
just self.collectionviewheightconstraint.constant = whatever
, self.typingviewheightconstraint.constant = whatever + defaultheight
, should solve problem.
Comments
Post a Comment