#pragmaMark-Answer Area button click Method-(void) Answerclick: (UIButton *) button{//1. If the button does not have a word, return directly if(Button.currentTitle.length = =0)return; //2. If there is a word, clear text, the Candidate Area button displays//1> using the title of the button to find the corresponding button in the candidate areaUIButton *btn =[self optionButtonWithTilte:button.currentTitle ishidden:yes]; //2> Display the corresponding buttonBtn.hidden =NO; //3> Clear the text of a button[Button Settitle:@""Forstate:uicontrolstatenormal]; //4> Just click on the text on the button, meaning the content of the answer area is incomplete[self Setanswerbuttonscolor:[uicolor blackcolor];}-(UIButton *) Optionbuttonwithtilte: (NSString *) title Ishidden: (BOOL) ishidden{//Traverse all the buttons in the candidate area for(UIButton *btninchself.optionsView.subviews) {if([Btn.currenttitle isequaltostring:title] && Btn.ishidden = =Ishidden) { returnbtn; } } returnNil;}//Disorderly Order- (void) randamoptions{//chaotic ordering of options arraysSelf.options = [Self.options sortedarrayusingcomparator:^nscomparisonresult (NSString *str1, NSString *str2) { intSeed = Arc4random_uniform (2); if(seed) {return[str1 COMPARE:STR2]; } Else { return[str2 COMPARE:STR1]; } }]; NSLog (@"%@", self.options);}-(Instancetype) Initwithdict: (Nsdictionary *) dict{ Self=[Super Init]; if(self) {[self setvaluesforkeyswithdictionary:dict]; //Random order of the alternate button, only in the time of loading, do a disorderly sequence[self randamoptions]; } returnSelf ;}
Click events
@implementation Hmviewcontroller /* * Not able to interact with alpha <= 0.01 hidden = YES userinteraction = no* /-(ibaction) Click { NSL OG (@ "%s", __func__);} @end
iOS fourth day (6: Answer area button click and Disorderly Order)