Chess
1-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {2 3 //Override point for customization after application launch.4 5Self.window =[[UIWindow alloc]initwithframe:[[uiscreen mainscreen] bounds];6 7Self.window.backgroundColor =[Uicolor Purplecolor];8 9 Ten One [self createlabels]; A - - the [Self.window makekeyandvisible]; - - returnYES; - + } - +-(void) createlabels{ A at - -Nsarray * array = @[@"Car",@"Horse",@"Phase",@"Wang",@"after",@"Phase",@"Horse",@"Car"]; - - - in for(inti =0; I <8; i++) { - to for(intj =0; J <8; J + +) { + - the * //0 $ Panax NotoginsengUILabel * label = [[UILabel alloc]initwithframe:cgrectmake (j* +, i* ++ the, +, +)]; - the + A //set label background color the + if((i + j)%2==0) { - $Label.backgroundcolor =[Uicolor Blackcolor]; $ -}Else{ - the - WuyiLabel.backgroundcolor =[Uicolor Whitecolor]; the - } Wu - About $ //Text to display - - if(i = =0|| i = =7) { - A //J 0--7 + theLabel.text =Array[j]; - $ } the the if(i = =1|| i = =6) { the theLabel.text =@"Soldiers"; - in } the the About the //Set Font Color the the if(i = =0|| i = =1) { + -Label.textcolor =[Uicolor Redcolor]; the Bayi } the the if(i = =6|| i = =7) { - -Label.textcolor =[Uicolor Yellowcolor]; the the } the theLabel.textalignment =Nstextalignmentcenter; - theLabel.adjustsfontsizetofitwidth =YES; the the [Self.window Addsubview:label];94 the } the the }98 About}
99 multiplication
1-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {2 3 4 5Self.window =[[UIWindow alloc]initwithframe:[[uiscreen mainscreen] bounds];6 7Self.window.backgroundColor =[Uicolor Whitecolor];8 9 Ten One [self ninelabels]; A - - the [Self.window makekeyandvisible]; - - returnYES; - + } - +-(void) ninelabels{ A at - - for(inti =1; I <=9; i++) { - - for(intj =1; J <= I; J + +) { - in - to //I describes the y-coordinate + - //J Description X coordinate the * $ Panax Notoginseng //width 32 void 2 height - theUILabel * label = [[UILabel Alloc]initwithframe:cgrectmake (J-1)*( ++2), (I-1)*( -+2)+ the, +, -)]; + ALabel.backgroundcolor =[Uicolor Graycolor]; the +Label.text = [NSString stringWithFormat:@"%d*%d=%d", j,i,j*i]; - $Label.textcolor =[Uicolor Greencolor]; $ - //font changes size according to label's width - theLabel.adjustsfontsizetofitwidth =YES; - Wuyi //Label changes width according to font height the - //[Label SizeToFit]; Wu - About $ [Self.window Addsubview:label]; - - } - A } + the}
ui-day02--yesterday Assignment Code (II)