开发者

Objects on screen start blinking when dragging objects

I have an object that the user can drag around the screen in my app. But for some reason, when they start to drag it over another UIView, the items on screen start blinking. So part of the CAGradientLayer will appear in front of everything else, some things will seem to push themselves to the back, all sorts of bizarre activity. I haven't been able to take a screenshot of this unfortunately. This is the code that i've been using to drag the dragging.

NSSet *touches = [event touchesForView:sender];
    UITouch *myTouch = [touches anyObject];
    CGPoint startPoint = [myTouch locationInView:self.view];
    positionX = startPoint.x;
    positionY = startPoint.y;   

        colourDropView.center = CGPointMake(positionX-1开发者_如何学编程5, positionY-25);

colourDropView is the object that's being dragged, as you might guess. And it's when that last line is implemented when it starts the blinking, and it happens each time the user moves their finger. No other code is running when they drag their finger, only what is above.

Any ideas as to why this may be happening?


Turns out it's a bug. colourDropView had rounded corners, and had 'maskstobounds' set to YES. For some reason this causes a CAGradientLayer to freak out when this view is dragged over it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜