Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shadow in UIPageViewController

Tags:

ios

uikit

cocoa

Can anyone tell me, how to make shadow, using UIPageViewController, around of my background image instead of the view bounds?

In other words, I have an "irregular background image" which bounds looks like a wave. And when I go from page to page, shadow must be around "waves of backgrounds image" instead of pages rectangle.

Thanks.

like image 207
Lexandr Avatar asked Nov 26 '25 14:11

Lexandr


1 Answers

You can use the QuartzCore.framework.

Every UIView has a CALayer which can help u on that

  1. Add QuartzCore.framework to ur project (Build Phase => Link Binary With Libraries)
  2. #import "QuartzCore/QuartzCore.h" to the file that u will make shadow

Then you can do something like:

- (void) stylingUIView:(UIView *) _view
{    
    [_view.layer setBorderWidth:3]; // add border to the UIView
    [_view.layer setBorderColor:[UIColor colorWithRed:0.7f green:0.7f blue:0.7f alpha:0.2].CGColor]; // set border Color for the UIView
    [_view.layer setShadowColor:[UIColor blackColor].CGColor]; //set shadow color for the UIView
    [_view.layer setShadowRadius:10]; // set Shadow radius 
}

For your case: You can do something like:

[(UIViewController) viewController.view.layer setShadowRadius:10];
[(UIImageView) *imageView setShadowRadius:10];
like image 197
TedCheng Avatar answered Nov 30 '25 07:11

TedCheng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!