首页 > 代码库 > IOS Label
IOS Label
文字凹陷效果
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 100)];
label.text = @"文字凹陷效果";
label.shadowColor = [UIColor colorWithRed:0.855 green:0.863 blue:0.882 alpha:1.0];
label.textColor = [UIColor colorWithRed:0.298 green:0.337 blue:0.424 alpha:1.0];
label.backgroundColor = [UIColor cyanColor];
[mainView addSubview:label];
[label release];
文字阴影效果
UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 100)];
label.text = @"文字阴影效果";
label.textColor = [UIColor colorWithRed:0.4 green:0.6 blue:0.1 alpha:1.0];
label.textAlignment = UITextAlignmentCenter;
label.font = [UIFont fontWithName:[[UIFont familyNames] objectAtIndex:2] size:35];
label.adjustsFontSizeToFitWidth = YES;
label.numberOfLines = 0;
label.tag = 0;
label6.backgroundColor = [UIColor cyanColor];
label.shadowColor = [UIColor yellowColor];
label.shadowOffset = CGSizeMake(3, 3);
[mainView addSubview:label];
[label release];
label中文字跑马灯效果
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 100)];
label.text = @"噜啦啦噜啦啦噜啦噜啦噜,噜啦噜啦噜啦噜啦噜啦噜~~~";
[self.view addSubview:label];
CGRect frame = label7.frame;
frame.origin.x = -180;
label.frame = frame;
[UIView beginAnimations:@"testAnimation" context:NULL];
[UIView setAnimationDuration:8.8f];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationRepeatCount:999999];
frame = label.frame;
frame.origin.x = 350;
label.frame = frame;
[UIView commitAnimations];
IOS Label