patchthecode / JTAppleCalendar

The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable
https://patchthecode.com
MIT License
7.57k stars 808 forks source link

is it possible to have islamic calender dates and gregorian calender dates in one cell????? #742

Closed RAMSHEER closed 6 years ago

RAMSHEER commented 6 years ago

IMPORTANT - BEFORE CREATING YOUR ISSUE PLEASE READ THE FOLLOWING:

  1. PLEASE STATE THE VERSION NUMBER you are using.
  2. Are you using the latest version of JTAppleCalendar? Latest version is currently 7.1.5
  3. PROVIDE ENOUGH INPORMATION SO I CAN RECREATE THE PROBLEM.
patchthecode commented 6 years ago

yes. it is possible. You are in control of your own cell. You can design it however you want. The exact same way you'd design an islamic/gregorian design for a UICollectionView or a UITableView, is the same way you'd design it for this library

RAMSHEER commented 6 years ago

but when we are giving date data to the cells, ie; " cell.dateLabel.text = cellState.text " . In the cellstate we are describing one calender either islamic or gregorian.. then how we will be able to add another Calender in cellstate and add to another label?? ie; "cell.datelabel2.text = cellstate.text" will not give the next calender details ..

patchthecode commented 6 years ago

You can design the cell however you want. In the example you mentioned above, you have one label.

cell.dateLabel.text = cellState.text

Why not put 2 labels on the cell instead of one? You can even put 3 labels, or 4,5....10000. :) The design is entirely up to you.

Do you know how to design your cell? ( I assume you have already watched the videos?)

RAMSHEER commented 6 years ago

yes. i already created an islamic calender..bt i need corresponding gregorian date in the same cell. cell.dateLabel.text = cellState.text this is how i set the datelabel text.. And my question is When i am adding another label for gregorian dates , say "gregDateLAbel".. how can i set the gregDAteLAbel text ??? gregDateLAbel.text = cellState.text will not give the results ..it will display one calender details only

patchthecode commented 6 years ago

@RAMSHEER can you join me here? https://gitter.im/patchthecode/JTAppleCalendar

patchthecode commented 6 years ago
let myCalendar = Calendar(...... // create a islamic calendar here)
let dateFormatter = DateFormatter()
dateFormater.calendar = myCalendar
let date = cellState.date
let islamicTextDate = dateFormatter.string(from: date)

you can use this strategy to create dates in any language

Note: please do not create the Calendar and the DateFormatter inside of the cellForItem function. These classes are HEAVY, and will mess with your performance if you place them in there

patchthecode commented 6 years ago

closing this issue, let me know if you have any other questions.