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

using setDraggingStartedBlock setDraggingEndedBlock #16

Closed
sundialsoft opened this issue Dec 15, 2015 · 5 comments
Closed

using setDraggingStartedBlock setDraggingEndedBlock #16

sundialsoft opened this issue Dec 15, 2015 · 5 comments

Comments

@sundialsoft
Copy link

  1. I though it would be fun to alter the background color & alpha of view while they moved so I tried out these blocks but the views do not land on the X,Y coords I leave them on. They jump a little.
    My Code is:
    __weak typeof(timerView) weakSelf = timerView;
    [timerView setDraggingStartedBlock:^
     {
         weakSelf.backgroundColor=switchColor;
         weakSelf.alpha = 0.9f;
     }];
    [timerView setDraggingEndedBlock:^
     {
         weakSelf.backgroundColor=[UIColor whiteColor];;
         weakSelf.alpha = 1.0f;
     }];

Without these blocks the views stop in the correct place. Is there something I can do to resolve this?
It's the EndedBlock that's the issue. Even an empty block caused the view to just at the end.

Not mission critical, just nice to try out the code.

@sundialsoft sundialsoft changed the title using setDraggingStartedBlock setDraggingEndedBlock & Bring subView to Front using setDraggingStartedBlock setDraggingEndedBlock Dec 15, 2015
@andreamazz
Copy link
Owner

This is probably related to #12
When a layout cycle kicks in, the view is moved away. I need to implement the dragging in another way once I get the time to work on it :/

@sundialsoft
Copy link
Author

Thanks for the feedback. My app is finished so after Christmas I will have time to look at this. I need to implement scroll view scrolling when a draggable view is moved out of the visible screen. I have code which does this in another app so will see if I can make it work here.

You are of course mentioned in the acknowledgements in my app 'Mama's Kitchen Timer' which should be off to Apple by tomorrow so live in 2 to 3 weeks from now I expect.

All the best for the festive season

Ian
Aka sundialSoft

Sent from my iPhone

On 16 Dec 2015, at 14:16, Andrea Mazzini notifications@github.com wrote:

This is probably related to #12
When a layout cycle kicks in, the view is moved away. I need to implement the dragging in another way once I get the time to work on it :/


Reply to this email directly or view it on GitHub.

@andreamazz
Copy link
Owner

That's great, happy to hear that. I'll keep you posted 👍

@ricozinn
Copy link

Hey, I was seeing this problem too, and commenting out this line here seems to fix it:

if (sender.state == UIGestureRecognizerStateEnded && self.draggingEndedBlock) {
//commenting this out fixes it
//        self.layer.anchorPoint = CGPointMake(0.5, 0.5);
        self.draggingEndedBlock(self);
}

@andreamazz
Copy link
Owner

Correct, see #23

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