Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Workaround for now is to set the inset to some negative fractional value if you are experiencing the issue. #26

Closed
cbwilliamsnh opened this issue May 24, 2016 · 33 comments
Assignees

Comments

@cbwilliamsnh
Copy link

I have a three month calendar (June - Aug, 2016). I've attached three images.

First is how the calendar initially appears, second is when I scroll from June to July and third is when I scroll back to June.

Here's the additional code in my controller:

    calendarView.dataSource = self
    calendarView.delegate = self
    calendarView.registerCellViewXib(fileName: "ScheduleCellView")
    calendarView.backgroundColor = UIColor.whiteColor()
    calendarView.cellInset = CGPoint(x: 2, y: 2)

    let currentDate = calendarView.currentCalendarDateSegment()
    setupViewsOfCalendar(currentDate.startDate, endDate: currentDate.endDate)

setupViewsOfCalendar is from the tutorial.

screenshot 2016-05-24 10 39 52

screenshot 2016-05-24 10 40 04

screenshot 2016-05-24 10 40 20

@patchthecode patchthecode self-assigned this May 24, 2016
@patchthecode
Copy link
Owner

OK. first thing. I update this calendar quite a bit. Which version are you using?

@cbwilliamsnh
Copy link
Author

Using JTAppleCalendar (3.0.0) // From pod install output

@patchthecode
Copy link
Owner

Note the latest version is 3.0.1
Can you do an update and let me know if it is fixed?

@cbwilliamsnh
Copy link
Author

It is fixed!

Thank you!

@patchthecode
Copy link
Owner

And leave a like! :) its much needed. thanks!

@cbwilliamsnh
Copy link
Author

Happy to do so (and did!)

Chuck

p.s. do I need to do anything special to support a touch or 3d touch?
Should I add that to the cell and the cell's controller?

love the cocoapod!

On Tue, May 24, 2016 at 1:13 PM, JTAppleCalendar [email protected]
wrote:

Hey mind putting that image of you calendar here?
I would really appreciate it. This is a new project and people needs to
see what can be done with it.
Can you post that image here? --> #2
#2
Wont bug you anymore if you do :]


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)

Chuck

@patchthecode
Copy link
Owner

patchthecode commented May 24, 2016

Touch and 3d touch? heh.. i dont even have an iPhone6 :(
I have not looked into 3d touch, but now that you mentioned it, i'll look into it in a bit. Well.. more like a bit bit.

And glad you enjoyed the pod. The others here on github was giving me a headache

@cbwilliamsnh
Copy link
Author

FYI a cellInset of 0,0 still gives sketchy results on the grid display.

@cbwilliamsnh cbwilliamsnh reopened this May 24, 2016
@patchthecode patchthecode added this to the Bugs 3.0 milestone May 24, 2016
@patchthecode
Copy link
Owner

taking a look

@patchthecode
Copy link
Owner

It looks fine on mines

  1. Are you free scrolling? or paged scrolling?
  2. What happens with inset 0,0?

@patchthecode
Copy link
Owner

patchthecode commented May 24, 2016

Ok i think i see something. It still leaves a space. It is a line that is off by one pixel.
Is this what you area talking about?

Fixing this issue now. It happens when i do an orientation change.

@patchthecode
Copy link
Owner

patchthecode commented May 24, 2016

Hmm.. on second thought. I cant tell if it is an error without looking to see if it is on a real device. The line space disappears when i zoom in the iOS simulator by pressing the CMD + 1 or CMD + 2 or CMD + 3 keys. You will have to tell me specifically what you are seeing. Looking into it further

@cbwilliamsnh
Copy link
Author

default scrolling (so paged?)

inset 0,0 gives results similar to the first image in the original issue.

On Tue, May 24, 2016 at 1:49 PM, JTAppleCalendar [email protected]
wrote:

It looks fine on mines

  1. Are you free scrolling? or paged scrolling?
  2. What happens with inset 0,0?


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)

Chuck

@patchthecode patchthecode changed the title Calendar grid not fully appearing and then disappears on scroll Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. There is a off by one pixel when orientation changes May 24, 2016
@cbwilliamsnh
Copy link
Author

Could be. I know that only some of the lines show when the inset is 0,0. My
app is portrait only so there is no orientation change.

On Tue, May 24, 2016 at 2:03 PM, JTAppleCalendar [email protected]
wrote:

Ok i think i see something. It still leaves a space. It is a line that is
off by one pixel.
Is this what you area talking about?

Fixing this issue now. It happens when i do an orientation change.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)

Chuck

@cbwilliamsnh
Copy link
Author

When inset is 0, 0, this is what I see:

[image: Inline image 1]

Different lines are missing when I scroll the calendar, but the same lines
are missing on each month when I scroll back and forth.

On Tue, May 24, 2016 at 2:07 PM, JTAppleCalendar [email protected]
wrote:

Hmm.. on second thought. I cant tell if it is an error without looking to
see if it is on a real device. The line space disappears when i zoom in the
iOS simulator by pressing the CMD + 1 or CMD + 2 or CMD + 3 keys. You will
have to tell me specifically what you are seeing. Looking into it further


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)

Chuck

@patchthecode
Copy link
Owner

patchthecode commented May 24, 2016

not seeing the image. its not showing on github. But i think i get it. Similar issue? Alright. Will look into this

@patchthecode
Copy link
Owner

Tell you what. Set the inset to -1, -1 as a work around. I'll have to look into this after dinner

@cbwilliamsnh
Copy link
Author

screenshot 2016-05-24 14 12 08

just for completeness, here's the screenshot.

patchthecode added a commit that referenced this issue May 24, 2016
Issue #26 #26

Cell inset 0,0 was not aligning properly
@patchthecode
Copy link
Owner

Ok, i have found fixed this issue and pushed it to github.
I have not released it in 3.0.2 yet just in case there is something else wrong with it (i dont think there should be though, i tested it much). Are you able to take a pull of master branch to see if it works for you?

@patchthecode
Copy link
Owner

I understand.
Ok, hmm.. i'm working on another upgrade you see. So i dont want to release another one yet. So here's what,

do a clone of this repository --> https://github.com/patchthecode/JTAppleCalendar.git
Next, just exchange these 3 files in your local cocoa pod folder, with these 3 files in the repository that you just cloned

The file names are:

  1. JTAppleCalendarDelegate.swift
  2. JTAppleCalendarFlowLayout.swift
  3. JTAppleDayCell.swift

Once you replace these 3 files, you should now have the fix.
When I do the official release next week, you can just do your regular pod install command.

Let me know if the fix worked.

@cbwilliamsnh
Copy link
Author

Thanks!

I'm working on another (unrelated) issue. As soon as that's solved I'll
give this a try.

Chuck

On Tue, May 24, 2016 at 8:03 PM, JTAppleCalendar [email protected]
wrote:

I understand.
Ok, hmm.. i'm working on another upgrade you see. So i dont want to
release another one yet. So here's what,

do a clone of this repository -->
https://github.com/patchthecode/JTAppleCalendar.git
Next, just exchange these 3 files in your local cocoa pod folder, with
these 3 files in the repository that you just cloned

The file names are:

  1. JTAppleCalendarDelegate.swift
  2. JTAppleCalendarFlowLayout.swift
  3. JTAppleDayCell.swift

Once you replace these 3 files, you should now have the fix.
When I do the official release next week, you can just do your regular pod
install command.

Let me know if the fix worked.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#26 (comment)

Chuck

@patchthecode
Copy link
Owner

Should be fixed in version 4.0.0

@hanishassim
Copy link

I'm having the same problem too, I'm on the 4.0.3
simulator screen shot 23 jun 2016 1 21 12 am
You can see there is like a gap there. Note that I've placed the imageview cell and set constraint 0 on all sides, and content mode fill

@patchthecode patchthecode reopened this Jun 22, 2016
@patchthecode
Copy link
Owner

patchthecode commented Jun 22, 2016

@hanishassim is it possible you can give me a copy of your .xib file?
You can drag your file and drop it straight into a conversation box on github here. If that is possible for you.

@patchthecode
Copy link
Owner

Hmm. It seems ok there. Would it be possible if i could see the bugged project? Or is it private?

@hanishassim
Copy link

Could you share the screenshot? Sorry but I can't share the project..

@patchthecode
Copy link
Owner

Understood. Hmm. Alright then i'll have to debug this on my end. In the mean time, try setting the inset to (-0.5, -0.5) or (-1, -1) as a work around (you can choose what ever number you like). Will get back to you.

@patchthecode
Copy link
Owner

Ok. I just setup the calendar.
And mine is working properly.
So some questions about your calendar:

  1. I see you December 2006 is being over lapped by the the black view. Are you doing anything extra in your configuration?
  2. Also, i see in your xib, you're using UIImageViews instead of UIViews. Is every thing ok here?
  3. Does this issue happen to the sample calendar project attached here on github?

@hanishassim
Copy link

  1. I removed it, instead using the header for section xib now, no extra config used.
  2. I'm using imagviews cause I want to apply calendar like airbnb's, they have date which is not selected, but set as blocked (not available for booking). Is still selectable if want to unbock it (which will remove the image view) .. Hmm is it okay to use the imageviews?
  3. It does not happen in the sample cause the selectedView is round and not filling till the edges, so can't see if there is gap or not.

Attached is what I'm trying to achieve, like aribnb:
iphone 6 plus copy 2

@patchthecode
Copy link
Owner

patchthecode commented Jun 24, 2016

Alright then, so in order for me the recreate the (0,0) error it seems i have to create a selected background view that is not circular in shape. I will do as you did and use a UIImageView and fill the cell to see if i can recreate it.

And btw, you can use any view on your calendar. So long as it can be dragged unto the canvas, it can be used.

I will now attempt to recreate your pixel error.

@hanishassim
Copy link

thanks noted.

@patchthecode patchthecode removed this from the Bugs 3.0 milestone Jul 14, 2016
@patchthecode patchthecode changed the title Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. There is a off by one pixel when orientation changes Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. There is a off by one pixel when orientation changes. This seems to be an iOS issue. Jul 18, 2016
@patchthecode patchthecode changed the title Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. There is a off by one pixel when orientation changes. This seems to be an iOS issue. Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Jul 24, 2016
@patchthecode patchthecode changed the title Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Workaround for now is to set the inset to some negative fractional value if you are wxperiencing the issue. Jul 24, 2016
@patchthecode patchthecode changed the title Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Workaround for now is to set the inset to some negative fractional value if you are wxperiencing the issue. Calendar Grid is not fully 0,0 when set to 0,0 Cell inset. It is off by one pixel when orientation changes. This seems to be an iOS issue. Workaround for now is to set the inset to some negative fractional value if you are experiencing the issue. Jul 24, 2016
@patchthecode
Copy link
Owner

Closed.
Changed behavior of calendar.

if cellInset.x == 0 { cellInset.x = -0.1 }
if cellInset.y == 0 { cellInset.y = -0.1 }

patchthecode added a commit that referenced this issue Dec 16, 2016
Added Workaround -

1.
// to handle #26
if cellInset.x == 0 { cellInset.x = -0.1 }
if cellInset.y == 0 { cellInset.y = -0.1 }

2.
Fixed issue
#235
patchthecode added a commit that referenced this issue Dec 21, 2016
Added Workaround -

1.
// to handle #26
if cellInset.x == 0 { cellInset.x = -0.1 }
if cellInset.y == 0 { cellInset.y = -0.1 }

2.
Fixed issue
#235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants