Xiaoye220/EmptyDataSet-Swift

Side effect with JTAppleCalendar

ogezue opened this issue · 10 comments

Your framework has a side effect with JTAppleCalendar. When I use EmptyDataSet-Swift and assign it to a tableview (which can be on a completely different UIViewController that an invisible view from EmptyDataSet-Swift is on top of the calendar.

For an example project please see patchthecode/JTAppleCalendar#712

I run your demo, but I dont see EmptyDataSetView is on top of the calendar
1

I can see it it your screenshot. It is the transparent view above the calendar. Normally you can scroll the calendar, but the EmptyDataSetView prevents it.
Thanks for clarification.

I cant see the transparent view with View UI Hierarchy. How do you know there is a transparent view above the calendar?

Please click on the front UIView above Calendar. I marked it red in the image below. It is the line outside the red box. In the UIHirachy inspector you can see that it is of type EmptyDataSetView

bildschirmfoto 2018-02-11 um 17 48 16

Here another screenshots that makes it clear:
bildschirmfoto 2018-02-11 um 17 55 16

OK, I see. because your collectionView is empty
@IBOutlet weak var collectionView: JTAppleCalendarView!
so will show the EmptyDataSetView.

you can use this to hidden it
collectionView.emptyDataSetView { $0.shouldDisplay(false, view: self.collectionView) }

Wouldn't it be better if the collection view wich has never been associated with EmptyDataSetView would not display this view?
But temporary this fix helps a lot - thank you!

It is using Method Swizzing to replace UITableview/UICollectionview.reloadData() with other implemention. The EmptyDataSetView will display whenever tableview/collectionview reloadData.So if you don't want to display the EmptyDataSetView, you have to declare it yourself.
Such implemention has both advantages and disadvantages, and maybe the problem you have is one of the disadvantages.

Maybe one idea to improve it:

  • add a property to enable EmptyDataSetView on a TableView/CollectionView. Off by default.

  • let the developer decide if he wants this feature or not.

Another idea:

  • only show EmptyDataSetView if the delegate is implemented

Thank you for your suggestion. I will improve it.

Great - thank you!