一 概述
超級猜圖提示功能:
-
把答案區中所有的按鈕清空
-
把正常答案的第一個字,設置到答題區中
-
答題正確得分,使用提示功能減分
<!--more-->
二 效果圖
三 代碼
#pragma mark 提示功能 -(IBAction)tipClick { //1.把答題區中所有的按鈕清空 for (UIButton *btn in self.answerView.subviews) { //用代碼執行點擊答題按鈕的操作 [self answerClick:btn]; } //2.把正確答案的第一個字,設置到答題區中 Question *question=self.questions[self.index]; NSString *first=[question.answer substringToIndex:1]; UIButton *btn=[self optionButtonWithTitle:first isHidden:NO]; [self optionClick:btn]; //扣分 [self changeScore:-1000]; } #pragma 分數處理 -(void)changeScore:(int)score { //取出當前的分數 int currentScore=self.scoreButton.currentTitle.intValue; //使用score調整分數 currentScore+=score; //重新設置分數 [self.scoreButton setTitle:[NSString stringWithFormat:@"%d",currentScore] forState:UIControlStateNormal]; }