Jtapplecalendar: selectedView is not completely circular

Created on 9 Feb 2017  路  14Comments  路  Source: patchthecode/JTAppleCalendar

Hi,
I followed the tutorial to make circular selectedView, but found something strange.
I set selectedView's width and height to 30 in Xib and in code I gave it cornerRadius of 15.
I expected it would be a circle.
It looks like a circle, but some sides like top, bottom, left, or right isn't very circular.
It looks like circle is cut somehow.
I saw many calendar images created by using JTAppleCalendar from other developers, but I found some images too have not fully circular selectedViews.
Is there any way to solve this problem?

img_1228

Thank you

Most helpful comment

Hey, I just fixed the problem by using UIImageView in xib and a circle image file.

All 14 comments

looks like your circle is being cut by the size width/height of the cell.

Let's test it to see if this is the problem.
Try width 26/ radius 13.
Is it a circle now?

If this fixes the problem then good. Make sure the SelectedView width/height is not bigger than the cell.

I tried set width 26, radius 13, but it is the same.
My autolayout is like below just in case it is wrong.
2017-02-09 17 50 28

hmm.. i think mines look ok

screen shot 2017-02-09 at 12 57 51 am

Have you set the item size of the calendar? or no?

Yours look ok.
No, I didn't set the item size.

Is it possible you can provide your code zipped ?
If yes, then -> [email protected]

will check in the morning. heading to sleep. have a good one.

Ok, I'll send you a mail before you wake up :)
Thank you !

Hey, I just fixed the problem by using UIImageView in xib and a circle image file.

@DaewoonKim thanks man. I was digging deep trying to find the solution to the problem. I do not think that this problem is caused by the calendar. But I'm glad you found a work around. Now I can help others.

I also want to say thank you for your hard work. It really helps me save a lot of time!

cool. If you have any other issues. Then let me know.

Same issue here. First one looks cut on the left and bottom margins.
Second date looks just fine. Did you find a solution to this problem (using UIViews and cornerRadius) ?

Thanks a lot for your great work. Really.

not round
round

@gmoraleda Does this happen on the actual device? Or does it only happen on the simulator?

There is one thing to note however. This is not caused by the calendar library. This is caused by the UICollectionView itself based on the size of the view, and based on the size and offset of the cells.

I have created a sample project with a UICollectionView (not the calendar library). The sample project contains a UICollectionView with no changes or modifications. And I am still seeing the circle view cut on the top sides.

screen shot 2017-04-08 at 9 18 12 am

screen shot 2017-04-08 at 9 18 33 am

Here is the project so you can see for yourself -> testCollectionView.zip

As can be seen here, it does not seem to be a problem of the calendar library.
I do not do anything that manipulate the views in the library, i use exactly what i get from the UICollectionView.

What users have found to work around the problem was using an Image. That way, a view does not have to be rendered using layers. It will be displayed correctly one time, every time.

If you have more information as to why this may be happening then do let me know. Because all my investigations (for now) tells me that it is caused by the collection view.

It happens on a real device as well on the simulator.
I'll use images instead of UIViews. Thanks for your reply :-)
Cheers.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VladFrolov picture VladFrolov  路  4Comments

gotamafandy picture gotamafandy  路  3Comments

Fatalution picture Fatalution  路  3Comments

dbmrq picture dbmrq  路  5Comments

oddpandadesign picture oddpandadesign  路  5Comments