0

I have hours trying to solve this and researching about this problem without results. This is my problem:

I'm using a ViewController in a existing project and over this I use an UIIMageView and a UIView at the same level. Then I set them alpha value in these two elements (alpha = 0.5) using Interface Builder. When I run the project on Simulator the alpha value not make effect and they looks like with their alpha value = 1. I made this same procedure in a new project and when I run the alpha effect is visible. I tried check/uncheck opaque option, set alpha value programatically as property or using method setAlpha, as well as set opaque value with code and it doesn't works. This problem happens with device too.

Anyone have a solution?

2
  • please check if you're changing the alpha again to 1 Oct 22, 2015 at 7:26
  • @Inder Kumar Rathore It works in this way: First a UIView is set alpha 0 but I can see the View as alpha 1. When I move another view modifying location.y, it refresh and alpha in that View is visible and works normally Oct 22, 2015 at 7:59

2 Answers 2

0

Check whether you import

#import <UIKit/UIKit.h>

UIIMageView.alpha = 0.4;

OR check with this

UIImage *wheelImage = [UIImage imageNamed:@"[email protected]"];
UIImageView *imageView = [[UIImageView alloc]initWithImage:wheelImage];
imageView.frame = CGRectMake(50, 50, wheelImage.size.width,  wheelImage.size.height);
imageView.alpha = 0.2;
[self.view addSubview:imageView];
7
  • Yes, it has UIKit and I have the same result Oct 22, 2015 at 7:01
  • is UIIMageView imageView?
    – Jamil
    Oct 22, 2015 at 7:03
  • @property (strong, nonatomic) IBOutlet UIImageView *image; ----- [_image setAlpha:0.5]; ---- _image.alpha = 0.5 --- This with code Oct 22, 2015 at 7:11
  • sorry but with your code I had the same result: an image without alpha Oct 22, 2015 at 7:20
  • 3 comments before me is code and if I write this code in a new project I can see the alpha, but in the current project not Oct 22, 2015 at 7:29
0

Did you forget to connect your outlet in the storyboard and the property?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.