danielsaidi / Sheeeeeeeeet

Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can an item with subtitle be align to center?

elanovasconcelos opened this issue · comments

I'm trying to get as much as possible to the native appearance of an action sheet, but I need a subtitle for one of the items. I cannot manager to align an item to the center. Is it possible?

IMG_6927887B7B49-1

I sat down with this yesterday, after some time away from this library. I first improved general RTL support, which now works great for all items. I then tried to get this to work, but I can't get it to work.

The problem is that for this style, the label frames are only as wide as the texts. For regular items, the label frame spans across the entire cell.

This means that RTL doesn't work when applying it with item alignment nor with the appearance proxy, which you apply like this: ActionSheetItemCell.appearance().semanticContentAttribute = .forceRightToLeft.

@mohammadghk made it work with constraints, but the fix affected the cells in a way that made me decide not to add it to the library. I was thinking about opening up the library's text alignment logic for modifications, to make it possible to inject functionality like the one @mohammadghk wrote. I haven't done so yet, though.

With that said, I'd love to review a PR with a clean solution to this problem :)

I'm trying to create custom tableCell to use with the others, but because the cell view is from a xib file I didn't manager to use it. The labels are always nil...

do you have an example how to use a custom view?

Hmmmm, have a look at how the demo handles custom items and collections. Those item types use xibs, but require another setup than standard table view cells.

I can't get this to work, so I'm closing this. It will be a non-issue when I add SwiftUI support to the library.