zjfjack / JZCalendarWeekView

Calendar Week & Day View in iOS Swift
MIT License
454 stars 121 forks source link

Localize "all-day" String #6

Closed DanielBalsalobre closed 6 years ago

DanielBalsalobre commented 6 years ago

Hello,

First, VERY GOOD JOB BRO!

I need to localize this String but cannot see how to access lblTitle of JZAllDayCorner from my project.

Thanks

zjfjack commented 6 years ago

Hi, Daniel. I will fix this issue and let you know soon. Thanks

zjfjack commented 6 years ago

Hi, Daniel.

I find a way that you can achieve this easily. Also, if you want to change any other SupplementaryView or DecorationView, you can use this method or refer to the customWeekView.

Firstly, creating (or subclass from JZAllDayCorner) your own AllDayCorner (DecorationView), and override setupUI method or create your own one. Make sure you set the correct constraints for the lblTitle to support iPhone X landscape mode and bottom divider like what I have done in JZAllDayCorner, if you want to create your own AllDayCorner class.

// Sample of subclassing
override func setupUI() {
    super.setupUI()
    // Do your localization here
    lblTitle.text = localizedString
}

Secondly, just register this class in your own weekView registerViewClasses(like I did in customWeekView for the BlackGridLine)

self.flowLayout.register(YourAllDayCornerClass.self, forDecorationViewOfKind: JZDecorationViewKinds.allDayCorner)

By the way, if you have any other better solutions, please let me know, we can discuss about this and try to improve this project.

Thanks a lot.

DanielBalsalobre commented 6 years ago

Thanks a lot