• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Button Image Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Button Image Behavior


  • Subject: Button Image Behavior
  • From: James Cicenia <email@hidden>
  • Date: Wed, 19 Aug 2015 20:46:45 -0500

Hello -

I am trying to toggle a button with three states.
In IB I have it set to “off”

In the code I toggle as such:

func toggleStatus() {
        if(product.favorite == false && product.avoid == false){
            product.favorite = true
            product.avoid = false
            favoriteButton.setImage(UIImage(named: "Favorites-On"), forState: .Normal)


        }else if(product.favorite == true && product.avoid == false){
            product.favorite = false
            product.avoid = true
            favoriteButton.setImage(UIImage(named: "Avoids-On"), forState: .Normal)

        }else {
            product.favorite = false
            product.avoid = false
            favoriteButton.setImage(UIImage(named: "Favorites-Off"), forState: .Normal)

        }
    }

When my screen comes up it is correctly in the off state.
When I touch it, it correctly goes to Favorites-On
When I touch it again, it correctly goes to Avoids-On
HOWEVER, when I next touch it, it briefly shows “Favorites-On” before going to “Favorites-Off”

Why is it flashing like that?
Thanks



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Re: Cocoa Auto Layout Warning in Xcode console
  • Next by Date: Will iOS app accepted on App Store if 80% of UI is rendered on UIWebView and 20% being native OCR
  • Previous by thread: Re: Cocoa Auto Layout Warning in Xcode console
  • Next by thread: Will iOS app accepted on App Store if 80% of UI is rendered on UIWebView and 20% being native OCR
  • Index(es):
    • Date
    • Thread