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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:09:06+00:00 2026-05-17T00:09:06+00:00

Hey all, can anyone please explain how I can subclass UIButton and override some

  • 0

Hey all, can anyone please explain how I can subclass UIButton and override some method so that when the user drags off a button it comes up right away? The problem is that when I drag out of the button frame it remains active and down. I want it to stop as soon as the finger leaves the button frame. Any ideas?

(Cocoa Touch)

  • 1 1 Answer
  • 3 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-17T00:09:07+00:00Added an answer on May 17, 2026 at 12:09 am

    If anyone ever has this problem, the following code allows for extremely accurate edge sensing while dragging. If you drag out of the button, it wont extend past the button’s edge like normal.

    (I subclassed UIButton and made the following:)

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        touchBlocker = TRUE;
        self.highlighted = TRUE;
        NSLog(@"Touch Began");
    }
    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        UITouch *touch = [[event allTouches] anyObject];
        CGPoint location = [touch locationInView:self];
        if (touchBlocker) {
            if (!CGRectContainsPoint([self bounds], location)) {
                touchBlocker =FALSE;
                self.highlighted = FALSE;
                NSLog(@"Touch Exit");
            }   
        } else if (CGRectContainsPoint([self bounds], location)) {
            touchBlocker = TRUE;
            self.highlighted = TRUE;
            NSLog(@"Touch Enter");
        }
    
    }
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        touchBlocker = FALSE;
        self.highlighted = FALSE;
        NSLog(@"Touch Ended");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey all, Anyone guide me that how can i create cover Flow application for
Hey all. I've been looking for a while for something that can help me
Hey all how can i set this up for a loop? data.row9_1 I cant
Hey all, let's jump straight to a code sample to show how ECMAScript/JavaScript/AS3 can't
Hey, I need to delete all images from a string and I just can't
Hey there. I've read all the related articles on here and can't find one
Hey all i am in need of some help getting my code working correctly
Hey all I'm extremely new to jquery and ajax and I'm looking for some
Hey all, how can I reduce this: www.example.com/index.php?page=viewblog&category=awesome down to this: www.example.com/blog/awesome The above
Hey all- I'm working on some web flows for a Grails app we're building.

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.