UIView的iPad图层阴影效果
我正在尝试显示类似于此图像url的UIView 这是一个包含UIimageview和标签的UIView。 有没有类似的方法来设置图层效果 提前谢谢 乔UIView的iPad图层阴影效果,ipad,uiview,uiviewanimationtransition,Ipad,Uiview,Uiviewanimationtransition,我正在尝试显示类似于此图像url的UIView 这是一个包含UIimageview和标签的UIView。 有没有类似的方法来设置图层效果 提前谢谢 乔 #import <QuartzCore/QuartzCore.h> imageView.layer.shadowRadius = 2.0; imageView.layer.shadowOpacity = 0.7; imageView.layer.shadowColor = [UIColor blackColor].CGColor;
#import <QuartzCore/QuartzCore.h>
imageView.layer.shadowRadius = 2.0;
imageView.layer.shadowOpacity = 0.7;
imageView.layer.shadowColor = [UIColor blackColor].CGColor;
imageView.layer.shadowPath = [self createArcShadowPathForRect:imageView.frame].CGPath
#define archeight 25
-(UIBezierPath *)createArcShadowPathForRect:(CGRect)rect {
CGFloat h_padding = (self.imageView.frame.size.width - rect.size.width) /2;
CGFloat v_padding = (self.imageView.frame.size.height - rect.size.height) /2-10;
CGPoint startPoint = CGPointMake(0 + h_padding, rect.size.height + v_padding) ;
CGPoint pointTwo = CGPointMake(0 + h_padding, rect.size.height + archeight + v_padding) ;
CGPoint controlCenterPoint = CGPointMake(rect.size.width/2 + h_padding, rect.size.height + v_padding+ 10);
CGPoint leftDownPoint = CGPointMake(rect.size.width + h_padding, rect.size.height + archeight + v_padding) ;
CGPoint leftUpPoint = CGPointMake(rect.size.width + h_padding, rect.size.height + v_padding) ;
UIBezierPath *path = nil;
if(!path) {
path = [[UIBezierPath bezierPath] retain];
[path moveToPoint:startPoint];
[path moveToPoint:pointTwo];
[path addQuadCurveToPoint:leftDownPoint controlPoint:controlCenterPoint];
[path addLineToPoint:leftUpPoint];
[path addLineToPoint:startPoint];
[path closePath];
}
return path;
}