Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.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
Ios iPad3上缺少层阴影(但可在模拟器中工作)_Ios_Objective C_Quartz Graphics_Shadow - Fatal编程技术网

Ios iPad3上缺少层阴影(但可在模拟器中工作)

Ios iPad3上缺少层阴影(但可在模拟器中工作),ios,objective-c,quartz-graphics,shadow,Ios,Objective C,Quartz Graphics,Shadow,我使用以下代码在UIView后面绘制阴影 self.view.layer.borderColor = [UIColor whiteColor].CGColor; self.view.layer.shadowColor = [UIColor blackColor].CGColor; self.view.layer.shadowOpacity = 1.0; self.view.layer.shadowRadius = 25.0; self.view.layer

我使用以下代码在UIView后面绘制阴影

    self.view.layer.borderColor = [UIColor whiteColor].CGColor;
    self.view.layer.shadowColor = [UIColor blackColor].CGColor;
    self.view.layer.shadowOpacity = 1.0;
    self.view.layer.shadowRadius = 25.0;
    self.view.layer.shadowOffset = CGSizeMake(0, 3);
    self.view.clipsToBounds = NO;

    CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
    [self.view.layer setShadowPath:shadowPath];
这在模拟器和iPhone5上都能正常工作。然而在我的iPad3上:根本没有阴影


知道怎么回事吗?

我找到了解决办法。这与模拟器无关。这是关于肖像画与风景画方向界限的回归。我必须将阴影路径的设置移动到viewdidedidRotateFromInterfaceOrientation方法中,才能在所有可能的启动方向上正确渲染阴影

-(void)viewDidAppear:(BOOL)animated{
    CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
    [self.view.layer setShadowPath:shadowPath];
}

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
    [self.view.layer setShadowPath:shadowPath];
}