x向右为正,y向下为正
1.y<0
UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(40, 40, 250, 50)];
label.backgroundColor=[UIColor clearColor];
label.textColor=[UIColor redColor];
label.text=@"和合谷";
label.shadowColor=[UIColor blueColor];
label.shadowOffset=CGSizeMake(0, -3);
运行结果为:
第二.y>0
UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(40, 40, 250, 50)];
label.backgroundColor=[UIColor clearColor];
label.textColor=[UIColor redColor];
label.text=@"和合谷";
label.shadowColor=[UIColor blueColor];
label.shadowOffset=CGSizeMake(0, 3);
第三、x>0
UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(40, 40, 250, 50)];
label.backgroundColor=[UIColor clearColor];
label.textColor=[UIColor redColor];
label.text=@"和合谷";
label.shadowColor=[UIColor blueColor];
label.shadowOffset=CGSizeMake(3, 0);
[self.view addSubview:label];
结果:
第四、x<0
UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(40, 40, 250, 50)];
label.backgroundColor=[UIColor clearColor];
label.textColor=[UIColor redColor];
label.text=@"和合谷";
label.shadowColor=[UIColor blueColor];
label.shadowOffset=CGSizeMake(-3, 0);
原文:http://blog.csdn.net/richard_rufeng/article/details/25107799