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 6255031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:17:23+00:00 2026-05-24T14:17:23+00:00

http://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html I’m new to IOS development, and have been playing around with the IOS

  • 0

http://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html

I’m new to IOS development, and have been playing around with the IOS dev sample code, trying to learn how things work, etc… I came across this sample code (the classic version, not the gesture recognizers ver.) that does everything I’m looking for, except one thing. When the image views are dragged over another image view, they begin stacking up, and you have to double click the image to separate them.

I’ve spent forever trying to figure out how to make them not stack up. I think I have to store that a piece is getting being moved in an ivar, and stop it from getting the position of the other views… But I’m not sure how to go about doing it. If someone has the time to modify the sample code to not stack pieces, I’d really appreciate it! I’m dying to find out the solution after the forever I spent trying to do it!

I’ll try to be a little specific with what I’m trying to do here… I’ve made 26 of these image views, making them each a letter of the alphabet. I have 13 image views in two rows. A-M & N-Z. Currently, if I drag the A tile down from the top row, moving it down to a “spelling area” I have to cross over the N-Z row. When I do, the “A” tile (image view) picks up any tile it hovers over. So if I drag the A straight down, it’s going to pick up the N tile, because it’s going to hover right over it, before getting down to the “spelling” area.

Thanks in advance for any help or direction you can give me!

  • 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-05-24T14:17:23+00:00Added an answer on May 24, 2026 at 2:17 pm

    Well you have this function in the sample code

    // Checks to see which view, or views,  the point is in and then calls a method to perform the closing animation,
    // which is to return the piece to its original size, as if it is being put down by the user.
    -(void)dispatchTouchEndEvent:(UIView *)theView toPosition:(CGPoint)position
    {   
        // Check to see which view, or views,  the point is in and then animate to that position.
        if (CGRectContainsPoint([firstPieceView frame], position)) {
            [self animateView:firstPieceView toPosition: position];
        } 
        if (CGRectContainsPoint([secondPieceView frame], position)) {
            [self animateView:secondPieceView toPosition: position];
        } 
        if (CGRectContainsPoint([thirdPieceView frame], position)) {
            [self animateView:thirdPieceView toPosition: position];
        }
        // If one piece obscures another, display a message so the user can move the pieces apart
        if (CGPointEqualToPoint(firstPieceView.center, secondPieceView.center) ||
            CGPointEqualToPoint(firstPieceView.center, thirdPieceView.center) ||
            CGPointEqualToPoint(secondPieceView.center, thirdPieceView.center)) {
            touchInstructionsText.text = @"Double tap the background to move the pieces apart.";
            piecesOnTop = YES;
        } else {
            piecesOnTop = NO;
        }
    }
    

    wich you can try to modify to

    // Checks to see which view, or views,  the point is in and then calls a method to perform the closing animation,
    // which is to return the piece to its original size, as if it is being put down by the user.
    -(void)dispatchTouchEndEvent:(UIView *)theView toPosition:(CGPoint)position
    {   
        // Check to see which view, or views,  the point is in and then animate to that position.
        if (CGRectContainsPoint([firstPieceView frame], position)) {
            [self animateView:firstPieceView toPosition: position];
        } 
        if (CGRectContainsPoint([secondPieceView frame], position)) {
            [self animateView:secondPieceView toPosition: position];
        } 
        if (CGRectContainsPoint([thirdPieceView frame], position)) {
            [self animateView:thirdPieceView toPosition: position];
        }
        // If one piece obscures another, display a message so the user can move the pieces apart
        if (CGPointEqualToPoint(firstPieceView.center, secondPieceView.center) ||
            CGPointEqualToPoint(firstPieceView.center, thirdPieceView.center) ||
            CGPointEqualToPoint(secondPieceView.center, thirdPieceView.center)) {
    
            if (firstPieceView.center.x == secondPieceView.center.x)
                secondPieceView.center = CGPointMake(firstPieceView.center.x - 50, firstPieceView.center.y - 50);       
            if (firstPieceView.center.x == thirdPieceView.center.x)
                thirdPieceView.center  = CGPointMake(firstPieceView.center.x + 50, firstPieceView.center.y + 50);   
            if (secondPieceView.center.x == thirdPieceView.center.x)
                thirdPieceView.center  = CGPointMake(secondPieceView.center.x + 50, secondPieceView.center.y + 50);
            touchInstructionsText.text = @"";
        } else {
            piecesOnTop = NO;
        }
    }
    

    Let me know if it does what you want…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, http://developer.apple.com/cocoa/pyobjc.html is still for OS X 10.4 Tiger, not 10.5 Leopard.. And
I am trying to enable these debugging preferences (NSShowAllViews, NSShowAllDrawing) as shown here: http://developer.apple.com/technotes/tn2004/tn2124.html#SECAPPKITVIEWS
http://developer.yahoo.com/javascript/howto-proxy.html Are there disadvantages to this technique? The advantage is obvious, that you can
For the following example: http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html I would like to make the tabs right aligned
http://thedailywtf.com/Articles/The-Hot-Room.aspx You see how at the bottom there're links to the next and previous
I'm trying to develop a firefox extension that inserts additional HTTP header fields into
http://en.wikipedia.org/wiki/ICalendar I'm working to implement an export feature for events. The link above lists
http://en.wikipedia.org/wiki/Diamond_problem I know what it means, but what steps can I take to avoid
http://localhost/XYZ/Client/(S(enlodz55ov4ncafza0gpp045))/Info/Rates.aspx Does anyway know what /(S(enlodz55ov4ncafza0gpp045))/ means? Any help appreciated.
http://biochrom.fivesite.co.uk/catalogue4.asp On the page above there is an image floated to the left. To

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.