ios - how to block an action if user does not have enough coins? -


i'm fixing word game , i've made button allows user tip... tip cost 10 coins.

how can block action if user doesn't have coins left , @ same time alert user buy coins?

-(ibaction)btnhint:(id)sender {     [uiview beginanimations:nil context:null];     [uiview setanimationduration:0.5];      cgpoint center = [hints center];     center.x = 160;     center.y = 230;     [hints setcenter:center];      [uiview commitanimations];     hintview.text = @"founded in 1996, , sub of telecome";      coins = coins -10; } 

something this:

- (ibaction)btnhint:(id)sender {     if (/* condition determines if there enough coins */) {         [uiview beginanimations:nil context:null];         [uiview setanimationduration:0.5];          cgpoint center = [hints center];         center.x = 160;         center.y = 230;         [hints setcenter:center];          [uiview commitanimations];         hintview.text = @"founded in 1996, , sub of telecome";          coins = coins -10;     } else {         // show alert     } } 

btw - should migrate modern block-based uiview animation instead of old way using.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -