我想设计一个像这样的登录页面 
在采用箱阴影在IOS当前页我试图层阴影像这样 但是这一个未示出像上述图像PLZ指南.
我试过了
imageView.layer.shadowColor = [UIColor purpleColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(0, 1);
imageView.layer.shadowOpacity = 1;
imageView.layer.shadowRadius = 1.0;
imageView.clipsToBounds = NO;
Run Code Online (Sandbox Code Playgroud)
但它表明

提前致谢
更新
使用holex代码:
UIImageView *imag = (UIImageView*)[self.view viewWithTag:1];
imag = [[UIImageView alloc] initWithFrame:CGRectMake((screenWidth/100)*12, (screenHeight/100)*10, (screenWidth/100)*75, (screenHeight/100)*61)];
[imag setBackgroundColor:[UIColor whiteColor]];
[imag.layer setOpacity:0.4];
[imag.layer setShadowOpacity:1.0];
[imag.layer setShadowColor:[[UIColor blackColor] CGColor]];
[imag.layer setShadowOffset:CGSizeMake(0.0, 0.0)];
[imag.layer setShadowRadius:8.0];
[imag setClipsToBounds:FALSE];
[imag.layer setMasksToBounds:FALSE];
[self.view addSubview:imag];
Run Code Online (Sandbox Code Playgroud)
ios 6它显示如下图像,但它在ios 7上工作

我的屏幕上有这个:

使用此代码段:
[_backgroundBoxWithShadow.layer setOpacity:0.4];
[_backgroundBoxWithShadow setBackgroundColor:[UIColor whiteColor]];
[_backgroundBoxWithShadow.layer setShadowOpacity:1.0];
[_backgroundBoxWithShadow.layer setShadowColor:[[UIColor blackColor] CGColor]];
[_backgroundBoxWithShadow.layer setShadowOffset:CGSizeMake(0.0, 0.0)];
[_backgroundBoxWithShadow.layer setShadowRadius:8.0];
[_imaginaryTextBoxWithShadow.layer setShadowColor:[[UIColor blackColor] CGColor]];
[_imaginaryTextBoxWithShadow.layer setShadowOffset:CGSizeMake(-4.0, 4.0)];
[_imaginaryTextBoxWithShadow.layer setShadowRadius:4.75];
[_imaginaryTextBoxWithShadow.layer setShadowOpacity:0.4];
Run Code Online (Sandbox Code Playgroud)
注意:没有一个视图包含另一个视图,它们是同一个兄弟姐妹superview.但是结果看起来与我视图中的原始屏幕截图相同 - 您仍然可以使用值来优化结果以满足您的最终愿望.
您根据我的回答发布了代码片段,并说"不工作":
CGFloat screenWidth = self.view.bounds.size.width;
CGFloat screenHeight = self.view.bounds.size.height;
// BEGIN - your code
UIImageView *imag = (UIImageView *)[self.view viewWithTag:1]; // the line is pointless here, anyway...
imag = [[UIImageView alloc] initWithFrame:CGRectMake((screenWidth/100)*12, (screenHeight/100)*10, (screenWidth/100)*75, (screenHeight/100)*61)];
[imag setBackgroundColor:[UIColor whiteColor]];
[imag.layer setOpacity:0.4];
[imag.layer setShadowOpacity:1.0];
[imag.layer setShadowColor:[[UIColor blackColor] CGColor]];
[imag.layer setShadowOffset:CGSizeMake(0.0, 0.0)];
[imag.layer setShadowRadius:8.0];
// END - your code
[self.view addSubview:imag];
Run Code Online (Sandbox Code Playgroud)
这就是它在我身边真正的 iPhone5上看起来的样子,看起来效果很好:

如果您的不同,请发布截图(!).
注意:您必须同时保留视图clipsToBounds和图层masksToBounds FALSE,否则阴影将被切断.
在Interface Builder中看起来正确:

或者你可以明确地将它添加到你的代码中:
[imag setClipsToBounds:FALSE];
[imag.layer setMasksToBounds:FALSE];
Run Code Online (Sandbox Code Playgroud)
最终结果显示,你需要iOS6的解决方案,我发现该解决方案在我的iOS6.1设备上运行良好:
[_backgroundBoxWithShadow.layer setOpacity:0.4];
[_backgroundBoxWithShadow setBackgroundColor:[UIColor whiteColor]];
[_backgroundBoxWithShadow.layer setShouldRasterize:TRUE];
[_backgroundBoxWithShadow.layer setRasterizationScale:[[UIScreen mainScreen] scale]];
[_backgroundBoxWithShadow.layer setShadowOpacity:1.0];
[_backgroundBoxWithShadow.layer setShadowColor:[[UIColor blackColor] CGColor]];
[_backgroundBoxWithShadow.layer setShadowOffset:CGSizeMake(0.0, 0.0)];
[_backgroundBoxWithShadow.layer setShadowRadius:8.0];
Run Code Online (Sandbox Code Playgroud)
正如你可能会看到的那样,最终结果在iOS6.1上看起来像这样:
