Why does UIImageView appear to be partially transparent - iphone

I have a simple app that just displays a UIImageView. For some reason the image appears that it is partially transparent as it is much lighter than if I view the same image in photoshop. Any suggestions...I though by default a UIView is opaque.

You have probably changed the alpha of your imageView or the view itself. check for the the transparency of your imageview also. Because the default alpha of the imageview is 1 and opacity is also set to 100%. You might have chane one of these otherwise this is the problem of your image only

I don't believe that UIImageView is by default partially transparent? Try changing the background colour of the application and see if that affects the outcome of your image, if it is transparent it should be darker with a black background rather than white.

Related

How to show UIImage background through transparent pixels of image

I have an image, that has transparent areas and a known backround. But wheh I set "image" property of the UIImage i see main view and not a color which i set in "background" property.
I think I tried that before and found no real solution. You could however put the uiimageview into an uiview with the same size and set the backgroundcolor to this view.
Had to create custom control with two UIImageViews bounded by obu UIView. It works, but i would prefer apple doing something about this behaviour

How do I blur whatever is behind a translucent UIImageView?

I have a translucent png image (made by turning down the opacity in Photoshop), and there's a UIImageView behind that translucent image. Is there any way to blur the parts of the UIImageView on the bottom that intersect with the UIImageView on top? Thanks!
Not aware of any code that will do that on its own, but you could 'fake it' by rendering the intersection of the views in a graphics context, then apply a blur effect to it. Then you could take the graphics context and insert a UIImageView with the resulting image in between the two views to simulate the effect. This method would not work very well if you have any sort of animation or otherwise changing the state of the images.
You may try setting alpha of the image to less than 1.

Scrolling png with text & alpha on top of a static UIImageView

I have a view controller that has a view structure as follows:
FilesOwner
FirstResponder
View
ImageView (.jpg)
ScrollView
ImageView (.png)
The text in the innermost imageview has white text and clear (alpha) all around. I want to scroll the innermost imageview, and see the background image (the .jpg) behind it.
Its not working. Its acting like the scrollview background obscures the underneath .jpg. I say this because if I change the background color of the scrollview, that's what I see i.e. if I set it black, I see black behind my .png, if I set it white, I see white. If I change the alpha of the scrollview that doesn't seem to work either. The one other thing I tried was unchecking drawing: Opaque, but that doesn't get it either.
Try setting the alpha value of your scrollviews background color to 0 (not the alpha value of the scrollview itself). The scrollview should be set to not opaque.
(didn't try, just guessing...)

How to draw an tiled background image with alpha transparency on iPhone OS?

When I use UIColor -colorWithPatternImage: to create a view with an tiled background pattern, everything that is supposed to be transparent appears to be black. Of course I can't assign clearColor to the background, since the background is already this pattern image UIColor object.
I believe that this internally is using CGContextDrawTiledImage function. Or must I go directly with CGContextDrawTiledImage in this case?
You need to have something in the back that is not transparent. Otherwise the backmost background (black) will show through your transparent image.
Claus

Removing image background in UIImageView at runtime

I have a ball assigned to a UIImageView in Interface Builder. An IBOutlet from the UIImageView is wired to a corresponding UIViewController. The image has a white background. When I assign it to the UIImageView in IB, the background is transparent. In IB, I have the UIImageView set to a transparent background and aspect fill.
When I assign the UIImageView an image at runtime:
self.ball.image = ballImage; //ballImage is a UIImage
self.ball.backgroundColor = [UIColor clearColor];
self.ball.contentMode = UIViewContentModeScaleAspectFill;
the UIImageView square has a white background where the ball doesn't display. Meaning all four corners. What is the difference that the IB version doesn't show a white background at runtime and the programmatic version does?
Make sure you set self.ball.opaque = NO; in addition to setting the background color to clear. Otherwise, a white background will still be drawn. I believe you have to set both of these whether you use IB or Xcode to create the view - but IB may have set them both for you.
If you need to remove background programmatically you may refer to "Bitmap Images and Image Masks" guide. I have no other idea on this point...just using CGImageCreateWithMaskingColors.
In case your *.PNG (or any graphic resource file) doesn't have built-in transparency (just white background) but with IB it looks like transparent - may be alpha property less then 1 for your UIImageView and you see partially transparent image.