Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:23:56+00:00 2026-06-12T07:23:56+00:00

Im using the below code for touches ended. After a few uiviews are moved

  • 0

Im using the below code for touches ended. After a few uiviews are moved around a bit I call a segue in my code like this:
[self performSegueWithIdentifier: @”segueToLevel2″ sender: self]

The segue’s transition types are set to “cross dissolve”.

With the code below everything works fine until I get to level 5. On level five when the segue is called it does a corner to corner flip instead of the cross dissolve and from this point on every segue in my app does this flip instead of what they were set to do. If I take out my touches ended method everything works as expected so the problem must be here. I just cant figure out why this works for levels 1-4 but craps out on level 5. Any help would be greatly appreciated….im loosing my mind here.

-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
switch (level) {
    case 1:{

        if ((piece11.hidden == YES) && (piece1moving.hidden == NO) && (piece1placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece1moving.frame = CGRectMake(-65, 153, 490, 422);
            [UIView commitAnimations];
            [NSTimer scheduledTimerWithTimeInterval:3 target:(self) selector:@selector(moveToFront) userInfo:(nil) repeats:NO];
            [NSTimer scheduledTimerWithTimeInterval:1 target:(self) selector:@selector(singlePieceCallback) userInfo:(nil) repeats:NO];   

        }    
    }
        break;
    case 2:{
        UITouch *touch1 = [[event allTouches] anyObject];
        if (([touch1 view] == piece1) && (piece1placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece1.frame = CGRectMake(47, 402, 305, 312);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece2) && (piece2placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece2.frame = CGRectMake(34, 4, 291, 399);
            [UIView commitAnimations];
        }
    }
        break;
    case 3:{
        UITouch *touch1 = [[event allTouches] anyObject];
        if (([touch1 view] == piece1) && (piece1placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece1.frame = CGRectMake(1, 419, 308, 356);
            [UIView commitAnimations];


        }
        if (([touch1 view] == piece2) && (piece2placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece2.frame = CGRectMake(-7, 67, 291, 315);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece3) && (piece3placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece3.frame = CGRectMake(-16, 169, 427, 310);
            [UIView commitAnimations];

        }
    }
        break;
    case 4:{
        UITouch *touch1 = [[event allTouches] anyObject];

        if (([touch1 view] == piece1) && (piece1placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece1.frame = CGRectMake(0, 76, 219, 261);
            [UIView commitAnimations];


        }
        if (([touch1 view] == piece2) && (piece2placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece2.frame = CGRectMake(89, 485, 255, 287);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece3) && (piece3placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece3.frame = CGRectMake(103, 197, 305, 330);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece4) && (piece4placedstate == 0)){
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece4.frame = CGRectMake(5, 277, 228, 294);

        }

    }
        break;
    case 5:{
        UITouch *touch1 = [[event allTouches] anyObject];
        if (([touch1 view] == piece1) && (piece1placedstate == 0)) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece1.frame = CGRectMake(115, 89, 247, 263);
            [UIView commitAnimations];


        }
        if (([touch1 view] == piece2) && (piece2placedstate == 0)) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece2.frame = CGRectMake(14, 497, 211, 271);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece3) && (piece3placedstate == 0)) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece3.frame = CGRectMake(92, 248, 244, 272);
            [UIView commitAnimations];

        }
        if (([touch1 view] == piece4) && (piece4placedstate == 0)) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece4.frame = CGRectMake(87, 458, 228, 294);

        }
        if (([touch1 view] == piece5) && (piece5placedstate == 0)) {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece5.frame = CGRectMake(-13, 102, 244, 303);

        }
    }
        break;


    default:
        break;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:23:58+00:00Added an answer on June 12, 2026 at 7:23 am

    I’m still not sure what was causing my issue with the above code but I have found a solution in re-writing my code and using a UIPanGestureRecognizer like the one below attached to each of the pieces. This works perfectly throughout.

    - (void) dragGesture5:(UIPanGestureRecognizer *) panGesture {
    CGPoint translation = [panGesture translationInView:self.view];
    
    switch (panGesture.state) {
        case UIGestureRecognizerStateBegan:{
    
            originalCenter = piece5.center;
            [self.view bringSubviewToFront:piece5];
    
    
        }
            break;
        case UIGestureRecognizerStateChanged:{
    
            piece5.center = CGPointMake(piece5.center.x + translation.x,
                                         piece5.center.y + translation.y);
            [self checkColision];
    
    
        }
            break;
        case UIGestureRecognizerStateEnded:{            
    
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
            piece5.center = originalCenter;
            [UIView commitAnimations];
    
    
    
    
        }
            break;
        default:
            break;
    }
    
    [panGesture setTranslation:CGPointZero inView:self.view];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using below code to upload excel and INSERT in mysql in php
I am using below code to get profile image of friends using Resfb. I
I am using below code to generate photo gallery from a folder. How can
I'm using below code to check some form fields and render datatable table on
I am using below code to show jquery dialog, its working perfectly, Sub OpenDialog(ByVal
i am using below code to change the the font type of text view.
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I am using below code to create a reminder in Google calendar (using Google
I am using below code for Embed MP3 Audio Files In Web Pages, <embed
I am creating excel file using below code public class ResultSetToExcel { private HSSFWorkbook

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.