am using this code to get the shadow effect in my UIViewcontroller
in My ViewDidLoad
// Add drop shadow to the view.
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = CGRectMake(0, 0, 90, self.view.frame.size.height);
gradientLayer.colors = [NSArray arrayWithObjects:
(id)[UIColor lightGrayColor].CGColor,
(id)[UIColor clearColor].CGColor,
nil];
gradientLayer.startPoint = CGPointMake(-7, 0.1);
gradientLayer.endPoint = CGPointMake(1, 0.15);
[self.view.layer addSublayer:gradientLayer];
i got the correct shadow in the view,but the problem is when i go to another view controller and comes back the show is getting darker and darker for each time.am using UIPopOverController for navigating to another view.
What is the problem with my code?
Thanks in advance.
I just ran some tests with your exact code and it worked correctly. The only way I could replicate the problem you are having is by putting your code into either
viewWillAppear:orviewDidAppear:. Is it possible you have some code in either of those functions that is drawing a shadow?