ios - How do I assign a textcolor to a label from an array of colors? -
I'm trying to create one of the UILabel
five colors
- (zero) viewDidoadload [[Super Viewedload]; NSString * Random Collar = [ColorRayezObjectOntIndex: ARC4Random ()% [Color Count]]; Color = [[NSARLALO] Init]; [UIColor redColor], [UIColor bluecolor], [UIColor greenColor], [UIColor yellowColor]; ColorLabel.textColor = Random Color; }
How do I set an orange for the text of the label as UIColor
? Sorry, if it has already been answered, then I can not understand it correctly to understand it correctly.
try it ...
define #Concolor4 - (UIColor *) Random Caller {NSInteger colorIndex = arc4random ()% kNumColors; UIColor * color; Switch (Color Index) {Case 0: Color = [UIColor blueColor]; break; Case 1: Color = [UIColor redColor]; break; Case 2: Color = [UIColor yellowColor]; break; Case 3: Color = [UIColor greenColor]; break; } The color of the return; }
To assign a random color ...
colorLabel.textcolor = [auto random color];
Comments
Post a Comment