uzair dhada uzair dhada - 1 year ago 105
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download