Transparent GPUImageView? - ios

I am using a GPUImageView inside my iOS application. I want that the GPUImageView have a transparent background.
I tried setBackground:[UIColor clearColor]
It does not work.
Any workarounds?
Regards

I found you need to set both of these to get a transparent background. Neither works alone.
strengthPreviewImageView.backgroundColor = [UIColor clearColor];
[strengthPreviewImageView setBackgroundColorRed:0 green:0 blue:0 alpha:0];

...Did you try the method from the GPUImageView header?
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;

Related

How to set the background color of Customview(NSView)in mac applications?

I have tried to change the background color of NSView like this in iOS,
self.titleview.backgroundcolor = [UIColor redColor];
But no property like that exists so after it, I tried,
self.titleBarView.layer.backgroundColor = [[NSColor redColor]set];
But it shows some error.
self.titleBarView.layer.backgroundColor = [NSColor redColor].CGColor;
If you do not want to use view.layer. You can use NSBox (with custom style) over NSView. NSBox has fillColor property.

Why doesnt my background image show for iOS7 devices?

I am trying to display the default image as the background of a iOS7 simulator, but its just white. It works on simulators that are older.
UIColor *image = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"Default.png"]];
self.view.backgroundColor = image;
Since Xcode was updated for iOS7, the image file #"Default.png" is no longer created with new projects. So unless you name a file #"Default.png" and put it in the project, the UIImage you create won't have the desired image attached to it.
Also, the #"Default.png" image is usually just a black background. You can achieve the same thing by simply setting the background color to black.
self.view.backgroundColor = [UIColor blackColor];
I tried your above code and seems to be perfect.i tried this on my device and its work perfectly while i also faced the issue of white background with simulator.I will suggest:-
1)reset the simulator and quit it.
2)re-run your project.
your issue will get solved.It works perfect..
Hope this will help you out.
I was using an asset catalog. This seemed to work.
UIColor *image = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"LaunchImage"]];
self.view.backgroundColor = image;

How do I make a UISwitch under iOS 7 not take the background colour of the view behind it?

It looks like this whenever off:
While I'd prefer more of a grey background. Do I really have to use a UIImageView?
Here is how I changed the fill color of my iOS7 UISwitch.
First you need to import QuartzCore.
#import <QuartzCore/QuartzCore.h>
Then set the background color and round the UISwitch's corners.
UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0.0, 0.0, 51.0, 31.0)];
mySwitch.backgroundColor = [UIColor redColor];
mySwitch.layer.cornerRadius = 16.0; // you must import QuartzCore to do this.
[self addSubview:mySwitch];
This will give you a UISwitch with a custom off (background) color.
Hope this helps someone:)
You can set the setOnTintColor property of your UISwitch to the color you desire.
You can also set this for the switch in Interface Builder. Just set the background colour of the UISwitch to whatever colour you want (white, in the example below), then set a User Defined Runtime Attribute of layer.cornerRadius = 16:
There's no API support for changing the off fill color of a UISwitch.
Adjusting the tintColor will only affect the outline, and adjusting the backgroundColor will affect the whole frame, including the parts outside the rounded bounds.
You either have to place a properly shaped opaque UIView behind it or - easier - use a custom open source implementation, such as MBSwitch, which allows you to set the off fill color.
You can also use an image as background, using the [UIColor colorWithPatternImage];
mySwitch.onTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"toggle-bg-on"]];
mySwitch.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"toggle-bg-off"]];
Adding to Barry Wyckoff solution : set tint color also
UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0.0, 0.0, 51.0, 31.0)];
mySwitch.backgroundColor = [UIColor redColor];
mySwitch.layer.cornerRadius = 16.0; // you must import QuartzCore to do this.
mySwitch.tintColor = [UIColor redColor];
[self addSubview:mySwitch];

Remove tint on TableView iOS 7

I am trying to remove the white view behind the alphabet indexer but have had no luck.
I am trying to make it clear but nothing has worked for me so far.
sectionIndexBackgroundColor is what your looking for. You can do something like this,
tableView.sectionIndexBackgroundColor = [UIColor clearColor];
If you want to change the color of the highlighted state, use the following property.
tableView.sectionIndexTrackingBackgroundColor = [UIColor redColor];
Keep in mind that sectionIndexBackgroundColor became available in iOS7. So if your supporting iOS6 you might want to call something like this.
if ([tableView respondsToSelector:#selector(sectionIndexBackgroundColor)]) {
tableView.sectionIndexBackgroundColor = [UIColor clearColor];
}

UIView clearColor produce WhiteColor instead of Transparent in IOS5 Xcode4.2

I am facing a very strange issue ever since I updated the Xcode with IOS 5 ...
I can't able to set the background Color of UIView to Transparent ...
here is What I can do :!!
I can set the view to any color , green , blue , red and they are all shown correctly on UIVIEW
[self.view setBackgroundColor:[UIColor greenColor]]; // Working 100 %
I can set a background Image // it's Working too
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:#"abc2010.png"]]]; // Working 100 %
[self.view setBackgroundColor:[UIColor clearColor]]; // No Error but result is not what I need
instead of transparent Background , it is always WHITE ... !!
I'll appreciate the help in figuring out the problem!! :)
I've just had this same problem. Here's a couple things to do.
Firstly, make sure you set the view so it's not opaque:
[self.view setOpaque:NO];
Second, set the views layer so it's also clearColor:
[self.view.layer setBackgroundColor:[UIColor clearColor]];
See if that helps. It fixed my problem, and your's sounds just like mine.
Good luck.

Resources