danielsaidi / Sheeeeeeeeet

Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.
MIT License
1.74k stars 111 forks source link

itemTextAlignment proxy added #110

Closed mohammadghk closed 5 years ago

mohammadghk commented 5 years ago

itemTextAlignment added to item proxies for changing item's textLabel and detailedTextLabel , textAlignment to make Sheeeeeeeeet❤️ more RTL language friendly :)

danielsaidi commented 5 years ago

Amazing, thank you!

danielsaidi commented 5 years ago

@mohammadghk Hi again! I'm trying to get this to work, but setting textLabel?.textAlignment does nothing for me. Do I need to setup the device in another way?

mohammadghk commented 5 years ago

Yes Actually because textLabel?.textAlignment is being override in refresh() . Well I wanted it to work for the whole app so I changed refresh() in ActionSheetItemCell. Try to use it in AppDelegate like this: let item = ActionSheetItemCell.appearance() item.itemTextAlignment = .right

I guess I need to make it applicable for each item instead of setting in appearance proxy so should I try to change ActionSheetItem ? The result that I'm currently using is like this: Screen Shot 2019-10-12 at 10 19 58 AM

danielsaidi commented 5 years ago

Ah, ok I see! I have removed the explicit text alignment logic from the cells and moved it all to the appearance class, so it's easily overridable now. You can test it in master.

One thing I noticed, however, is that the rtl logic doesn't apply when the cell uses .subtitle as cell style. See the image.

I will create a bug for this. Hopefully it's easily resolved.

image