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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:32:26+00:00 2026-05-25T16:32:26+00:00

I’ve made a custom zero-image, Core Graphics drawn UIButton based on Ray Wenderlich’s Tutorial

  • 0

I’ve made a custom zero-image, Core Graphics drawn UIButton based on Ray Wenderlich’s Tutorial (the only modifications are to CoolButton’s drawRect: method, altered drawing code), and it works great most of the time. However, sometimes when I click it for a short period of time, it stays in a depressed state and doesn’t return to normal.

From here, the only way to get it back to a normal state is via a long press. Simply clicking means it stays depressed.

Another thing to note is that I’ve hooked Touch Up Inside up to a chain of a few long methods – I don’t think it would take more than 0.1 seconds to complete. I’ve even used dispatch_async in the @selector that is hooked up to Touch Up Inside, so there shouldn’t be a delay in the UI updating, I think.


I’ve put an NSLog in the drawRect: which fires 3 times per button press usually, and it varies what UIControlState the button is in for each press:

  • For some short presses, it goes Highlighted, Highlighted, Normal
  • for longer presses, it’s Highlighted, Normal, Normal

However, for very short presses, it only fires twice, Highlighted -> Highlighted.

When it’s a long press to get it back to Normal, it goes H, N, N.


This has been puzzling me for a while, and I haven’t been able to work out why short presses only fire drawRect: twice, or why touchesEnded: doesn’t seem to call drawRect:. Perhaps touchesEnded: isn’t firing?

I really hope someone can help.

  • 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-25T16:32:27+00:00Added an answer on May 25, 2026 at 4:32 pm

    If you really want to generate the button images at runtime, generate them when the button is loaded. Then add them for different states using

    [button setImage:btnImage forState:UIControlStateNormal];
    

    You can always turn a view into an image using the following: http://pastie.org/244916

    Really though, I’d recommend just making images beforehand. If you don’t want to get photoshop, there’s plenty of alternatives. The upcoming pixelmator update looks pretty suave, ands it’s ridiculously cheap!

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.