Как узнать, на каком просмотре завершилось сенсорное событие?

Я хочу перетащить UIImage на одну из нескольких кнопок UIB и переместить его в зависимости от того, на какую кнопку я его перетащил.

Проблема яЯ столкнулся с тем, что UITouch записывает только вид, где началось мое прикосновение, яЯ хотел бы получить доступ к представлению, на котором заканчивается мое касание. Как я могу это сделать?

Код:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:self.view];

    dealerBtnOrigin = [touch locationInView:self.view];

    //NSLog(@"%u %u",touch.view.tag, ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]).tag);
    //CHECK TO SEE WHICH BUTTON WAS TOUCHED
    if (touch.view == ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]))
    {
        ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]).center = location;
    }
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:self.view];


    if (touch.view == ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]))
    {
        ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]).center = location;
    }
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:self.view];
    UIView *endView = [self.view hitTest:location withEvent:nil];

    if (touch.view == ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]))
    {
        NSLog(@"%u %u",endView.tag, touch.view.tag);
        if([buttons containsObject:(UIButton *)endView])
        {
            [[dealerBtns objectAtIndex:[table getButtonSeat]] setHidden:YES];
            [table passButton:touch.view.tag];
            [[dealerBtns objectAtIndex: touch.view.tag] setHidden:NO];
        }
        ((UIView *)[dealerBtns objectAtIndex:[table getButtonSeat]]).center = dealerBtnOrigin;
    }

}

Ответы на вопрос(5)

Ваш ответ на вопрос