Reputation: 803
I'm having a big issue here. I've created a couple of buttons programmatically. The appear on the screen but some preferences are missing.
- (void) processImage:(UIImage *)image
{
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) {
image = [UIImage imageWithCGImage:[image CGImage] scale:1.0 orientation: UIImageOrientationUp];
}
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight) {
image = [UIImage imageWithCGImage:[image CGImage] scale:1.0 orientation: UIImageOrientationDown];
}
if (capturedImageOneData == nil) {
capturedImageOneData = image;
[self resizeImage:image];
self.capturedImageOneSmall = [[UIButton alloc] init];
self.capturedImageOneSmall.frame = CGRectMake(3091, 50, 160, 120);
[self.capturedImageOneSmall setBackgroundImage:capturedImageResized forState:UIControlStateNormal];
[self.capturedImageOneSmall addTarget:self action:@selector(tappedOnImage:) forControlEvents:UIControlEventTouchUpInside];
self.capturedImageOneSmall.layer.cornerRadius = 8;
self.capturedImageOneSmall.tag = 401;
[self.capturedImageOneSmall addGestureRecognizer:longPressGesture];
[self.scrollView addSubview:self.capturedImageOneSmall];
As you can see, I did some customising to the button. But for example, the cornerRadius is not showing in the picture (sharp edges stay).
Any ideas?
Upvotes: 1
Views: 568
Reputation: 53121
Try adding:
self.capturedImageOneSmall.layer.masksToBounds = YES;
Upvotes: 1