Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何创建;浮雕;在iOS中对文本的影响?_Objective C_Ios_Core Graphics - Fatal编程技术网

Objective c 如何创建;浮雕;在iOS中对文本的影响?

Objective c 如何创建;浮雕;在iOS中对文本的影响?,objective-c,ios,core-graphics,Objective C,Ios,Core Graphics,我想在UILabel中的文本上创建“压花的”文本效果。我无法选择正确的选项。请指导我如何使用正确的可用选项来实现这一点。我是否需要使用CoreGraphics或CoreText或自定义UILabel?。我只想知道信用卡上数字的显示方式 试试这个 [label setShadowColor:[UIColor darkGrayColor]]; [label setShadowOffset:CGSizeMake(0, -1)]; 你可以调整它以获得想要的效果。试试这个 [label setShado

我想在UILabel中的文本上创建“压花的”文本效果。我无法选择正确的选项。请指导我如何使用正确的可用选项来实现这一点。我是否需要使用CoreGraphics或CoreText或自定义UILabel?。我只想知道信用卡上数字的显示方式

试试这个

[label setShadowColor:[UIColor darkGrayColor]];
[label setShadowOffset:CGSizeMake(0, -1)];
你可以调整它以获得想要的效果。

试试这个

[label setShadowColor:[UIColor darkGrayColor]];
[label setShadowOffset:CGSizeMake(0, -1)];

您可以对此进行调整以获得所需的效果。

UILabel的
shadowColor
shadowOffset
提供了有限的定制。您还可以覆盖UILabel的
drawRect:

-(void)drawTextInRect:(CGRect)rect
{
    CGContextRef ref = UIGraphicsGetCurrentContext();
    CGContextSetShadowWithColor(ref, CGSizeMake(0.0, 2.0), 3.0, [UIColor blackColor].CGColor);
    [super drawTextInRect:rect];
}

UILabel的
shadowColor
shadowOffset
提供了有限的定制。您还可以覆盖UILabel的
drawRect:

-(void)drawTextInRect:(CGRect)rect
{
    CGContextRef ref = UIGraphicsGetCurrentContext();
    CGContextSetShadowWithColor(ref, CGSizeMake(0.0, 2.0), 3.0, [UIColor blackColor].CGColor);
    [super drawTextInRect:rect];
}

这需要再次对UILabel进行子类化?@pradeepreddypa,是的。要做到这一点,您需要将UILabel子类化。UILabel中已有阴影属性,因此您不必再次子类化。这需要再次子类化UILabel?@PradeepReddykPa,是的。要做到这一点,您需要将UILabel子类化。UILabel中已经有阴影属性,因此您不必再次子类化。浮雕和阴影是两种不同的效果。浮雕和阴影是两种不同的效果。