TOSegmentedControl icon indicating copy to clipboard operation
TOSegmentedControl copied to clipboard

Doesn't work correctly with "initWithCustomView:" on `UIBarButtonItem` in `UIToolbar`

Open benguild opened this issue 6 years ago • 5 comments

Tried this out, and found that this didn't size correctly in this configuration. It squished whatever is on either side, and the buttons weren't visible.

benguild avatar Oct 11 '19 00:10 benguild

G'day Ben! :D

Oh no. I might have screwed up one of the initialisers if the buttons weren't appearing. I just pushed a fix to master. See if it's still happening for you. :)

TimOliver avatar Oct 21 '19 17:10 TimOliver

The buttons were appearing but they were massive. Normally within a UIBarButtonItem they'd be the minimum size but here they were taking up the whole bar.

benguild avatar Oct 23 '19 21:10 benguild

Uhhhh. Hmm. That might be implicit behavior of the UIBarButtonItem when it's dealing with what it thinks is a vanilla UIView. I'm not sure if there's a way I can intelligently block that from within the codebase.

You sure you can't just resize the frame manually and use flexible width items on either side? :D

TimOliver avatar Oct 24 '19 02:10 TimOliver

So to clarify, if I put UISegmentedControl (a view, heh) in instead it works and looks fine, but this takes up the entire bar's width and squishes all of the other items to nothing.

benguild avatar Oct 24 '19 03:10 benguild

Sounds fine to me. 🙃

Yeah, I don't know. Maybe there's a layout property in UIKit where you can set the preferred content size of a view. I'd need to play with it, but I've got other iOS 13 fires to put out at the moment. 😅

TimOliver avatar Oct 24 '19 03:10 TimOliver