0
我試圖顯示類似於該圖像URL爲的UIView
Click here to view uiview image
這一個UIView ipad公司層陰影效果是含有的UIImageView和標籤一個UIView。 有沒有設置圖層效果的方法?
在此先感謝 喬。
我試圖顯示類似於該圖像URL爲的UIView
Click here to view uiview image
這一個UIView ipad公司層陰影效果是含有的UIImageView和標籤一個UIView。 有沒有設置圖層效果的方法?
在此先感謝 喬。
#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;
}
謝謝你這麼多,FoJjen。這對我來說很好。 – 2011-06-16 07:08:02