LJ Wilson
LJ Wilson

Reputation: 14427

Move drag handle when dragging UIButton

I have a view that has UIButtons that respond to dragging events. That all works fine, the issue is that the button is only 70X70 and the image for the button gets largely covered up with your finger when dragging (the process is that the user drags the image (UIButton) onto a target area on a view). Is there a way to offset the drag handle so it isn't the center point of the UIButton? Ideally I would want it to be the top right of the image for the UIbutton, because the bottom left is the area I care most about the user seeing.

EDIT: Here is the code I am using to handle the touch (drag) events:

- (IBAction) imageTouch:(id) sender withEvent:(UIEvent *) event
{
    UIButton *thisButton = (UIButton *)sender;

    CGPoint centerPoint = [[[event allTouches] anyObject] locationInView:self.view];
    UIControl *control = sender;
    control.center = centerPoint;

    UIColor *selColor = [WebImageOperations getColorFromImage:self.targetImageView.image atX:point.x andY:point.y];

    NSInteger thisScore = [Scoring scoreFromUIColor:selColor withArrow:thisButton.tag];

    switch (thisButton.tag) {
        case 10:
            arrow10Score = thisScore;
            self.score10Label.text = [NSString stringWithFormat:@"%d", arrow10Score];
            break;
        case 12:
            arrow12Score = thisScore;
            self.score12Label.text = [NSString stringWithFormat:@"%d", arrow12Score];
            break;
        case 14:
            arrow14Score = thisScore;
            self.score14Label.text = [NSString stringWithFormat:@"%d", arrow14Score];
            break;

        default:
            break;
    }

    NSInteger totalScore = arrow10Score + arrow12Score + arrow14Score;
    self.totalScoreLabel.text = [NSString stringWithFormat:@"%d", totalScore];
}

Upvotes: 0

Views: 364

Answers (1)

LJ Wilson
LJ Wilson

Reputation: 14427

I don't think this is possible. If someone comes across this question and has a solution, please post it here and I will mark that answer as the correct one.

Upvotes: 0

Related Questions