Alex Hamilton
Alex Hamilton

Reputation: 77

Hide UIButton until specific number of points is reached

I am fairly new to iOS programming so don't criticize me if this is simple lol. So I am building a loyalty program application in which every time a user scans their QR code to the iPad they receive 5 points to their account. Once they scanned their QR code, the iPad will display how many points they have and the rewards the store is offering (in a table view) and which rewards they can redeem based on their points. How would I make a reward visible but not touchable (meaning if the user touches the reward in the table view cell, nothing would happen) until the user reaches a certain number of points (then the user can press the reward and navigate to the next view controller).

In other words, how could I make a UIButton appear once a certain number of points is reached?

Thanks in advance!

Upvotes: 3

Views: 80

Answers (1)

LJ Wilson
LJ Wilson

Reputation: 14427

Make sure you have an IBOutlet declared for your UIButton, set its initial state as Hidden (can do in Interface Builder):

@property(nonatomic, weak) IBOutlet UIButton *myPointsButton;

make sure that button is connected (again in Interface Builder) and then:

self.myPointsButton.hidden = NO;

Upvotes: 5

Related Questions