uzair dhada uzair dhada - 7 months ago 46
iOS Question

Giving shadow to segmented control

I would like to know if there is any way through .xib or by code, if shadow can be provided to the segmented control, if there is then how can it be done..

Thanks in advance.


You can add UISegmentedControl to a UIView as a subview. And give shadow to the UIView with the help of below code.

self.layer.masksToBounds = NO;
self.layer.shadowOffset = CGSizeMake(-15, 20);
self.layer.shadowRadius = 5;
self.layer.shadowOpacity = 0.5;

Don't forget to import QuartzCore Framework.

#import <QuartzCore/QuartzCore.h>

May be it will help you.