x向右为正,y向下为正
1.y<0
UILabel *label=[[UILabelalloc] initWithFrame:CGRectMake(40,40, 250,50)];
label.backgroundColor=[UIColorclearColor];
label.textColor=[UIColorredColor];
label.text=@"和合谷";
label.shadowColor=[UIColorblueColor];
label.shadowOffset=CGSizeMake(0, -3);
执行结果为:
第二.y>0
UILabel *label=[[UILabelalloc] initWithFrame:CGRectMake(40,40, 250,50)];
label.backgroundColor=[UIColorclearColor];
label.textColor=[UIColorredColor];
label.text=@"和合谷";
label.shadowColor=[UIColorblueColor];
label.shadowOffset=CGSizeMake(0,3);
第三、x>0
UILabel *label=[[UILabelalloc] initWithFrame:CGRectMake(40,40, 250,50)];
label.backgroundColor=[UIColorclearColor];
label.textColor=[UIColorredColor];
label.text=@"和合谷";
label.shadowColor=[UIColorblueColor];
label.shadowOffset=CGSizeMake(3,0);
[self.viewaddSubview:label];
结果:
第四、x<0
UILabel *label=[[UILabelalloc] initWithFrame:CGRectMake(40,40, 250,50)];
label.backgroundColor=[UIColorclearColor];
label.textColor=[UIColorredColor];
label.text=@"和合谷";
label.shadowColor=[UIColorblueColor];
label.shadowOffset=CGSizeMake(-3,0);