设置字体阴影

 self.view.backgroundColor = [UIColor grayColor];

    self.text = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 200, 110)];

    self.text.text = @"空间";

    self.text.font = [UIFont systemFontOfSize:50 weight:20];

    self.text.textColor = [UIColor redColor];

    [self.view addSubview: self.text];

    

    CALayer *layer = [self.text layer];

    layer.borderColor = [[UIColor blueColor] CGColor];

    layer.borderWidth = 2.0;

    self.text.layer.shadowColor = [[UIColor blueColor]CGColor];

    self.text.layer.shadowOpacity = 3;

    self.text.layer.shadowOffset = CGSizeMake(15, 3);

    self.text.layer.shadowRadius = 0.4;

    [self.view addSubview:self.text];

原文地址:https://www.cnblogs.com/wujie123/p/5285408.html