@implementation UIButton (ContextualAction)
- (void)setContextualActionStyle
{
UIButton *button = self;
CGRect oldFrame = button.frame;
button.frame = CGRectMake(0.0f, 0.0f, 1000.0f, 1000.0f); // width and height must be bigger enough.
CALayer *layer = button.layer;
layer.cornerRadius = 5.0f;
layer.masksToBounds = YES;
layer.borderWidth = 1.0f;
layer.borderColor = [UIColor lightGrayColor].CGColor;
CALayer *shineLayer = [CALayer layer];
shineLayer.frame = button.layer.bounds;
UIImage *lightGrayBackgroundImage = [UIImage imageNamed:@"texture_light.
shineLayer.backgroundColor = [UIColor colorWithPatternImage:
shineLayer.borderWidth = 2.0f; // 1.0f px will be cover by layer.border.
shineLayer.borderColor = [UIColor whiteColor].CGColor;
[button.layer addSublayer:shineLayer];
button.titleLabel.textAlignmen
button.titleLabel.font = [UIFont boldSystemFontOfSize:10];
[button setTitleColor:[UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0fblue:102.0f/255.0f alpha:1.0f] forState:UIControlStateNormal]
[button setTitleShadowColor:[UIColor whiteColor] forState:UIControlStateNormal]
button.titleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
[button bringSubviewToFront:button.
button.frame = oldFrame;
}
@end