I want to have rounded corners and shadow on a UIBarButtonItem
.
UIButton *useButton = [UIButton buttonWithType:UIButtonTypeCustom];
UIButton *useButton = [UIButton buttonWithType:UIButtonTypeCustom];
useButton.frame = CGRectMake(0, 0, 60, 30);
useButton.backgroundColor = [UIColor redColor];
useButton.layer.masksToBounds = NO;
useButton.layer.cornerRadius = 4;
useButton.layer.shadowOffset = CGSizeMake(0, 1.5);
useButton.layer.shadowRadius = 5;
useButton.layer.shadowOpacity = 1.0;
// useButton.layer.shadowColor = [UIColor blackColor].CGColor;
useButton.layer.borderColor = [UIColor blackColor].CGColor;
[self.view addSubview:useButton];
UIBarButtonItem *useItem = [[UIBarButtonItem alloc] initWithCustomView:useButton];
[self.navigationItem setRightBarButtonItems:@[useItem]];