The below method which set the shadow effect to view but it is performance wise lacking when we apply animation to that view
-(void)setShadowEffectWithPerformanceLack{
self.view.layer.masksToBounds=NO;
self.view.layer.backgroundColor=[UIColor darkGrayColor].CGColor;
self.view.layer.shadowRadius=12;
self.view.layer.shadowOffset=CGSizeMake(0, 0);
self.view.layer.shadowOpacity=0.5;
}
UIBeizerPath which is used to avoid the performance lacking. (see Apple's Documentation)
-(void)setShadowEffectWithPerformanceLack{
self.view.layer.masksToBounds=NO;
self.view.layer.backgroundColor=[UIColor darkGrayColor].CGColor;
self.view.layer.shadowRadius=12;
self.view.layer.shadowOffset=CGSizeMake(0, 0);
self.view.layer.shadowOpacity=0.5;
}
UIBeizerPath which is used to avoid the performance lacking. (see Apple's Documentation)
-(void)setShadowEffectUsingUIBeizerPath{
self.view.layer.masksToBounds=NO;
self.view.layer.backgroundColor=[UIColor darkGrayColor].CGColor;
self.view.layer.shadowRadius=5;
self.view.layer.shadowOffset=CGSizeMake(0, 0);
self.view.layer.shadowOpacity=0.5;
UIBezierPath *path=[UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:12];
[self.view.layer setShadowPath:[path CGPath]];
}
Comments
Post a Comment