How to make UIWindow transparent - iphone

I need to see the HomeScreen from the UIWindow by making the UIWindow background as transparent. How to achieve this ?
I have tried with [UIColor ClearColor]; But its displaying BlackColor only.

It's not possible to see the homescreen inside your app. Apple did this to save power (who needs to render the homescreen while he's using an app) and to prevent devs from irritating users by making them think they are on their homescreen.

This is not good to do but its necessary then i think you use like below might be userful to you
self.window.backgroundColor = [UIColor colorWithRed:55.0f green:55.0f blue:55.0 alpha:0.05];

Related

Changing between 3 pictures in the UIImageView

Hey, I was wondering how I could make the user being able to change the background of the app? I have 3 Images that the user will be able to choose from. I've seen it in many apps. How would I do this? If possible please provide some code! :)
Thank you in advance!
It's quite easy. All you need is to set the background property of your view to an image. Here's how it's done:
self.view.backgroundColor = [UIColor colorWithPatternImage:
[UIImage imageNamed:#"yourimage.png"]];
Now, when the user selects a different image, simply repeat the above code with a different image each time.
The question should be more clear.
You can change the background of the UIView or parent UIWindow by using,
view/window.backgroundColor = [UIColor colorWithPatternImage: image]
or Use the UIImageView,
imageView.image = image

How can I make a variable background image in my iOS APP

I am making an iPhone app, and I want know how make a variable background image a background that the user can choose one of the options ?
I don't know what you want in the foreground, but anything based on the UIView class has a backgroundColor property that you can set to an image like this:
yourView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"YourImage.png"]];
It didn't work for me, what it worked was:
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"background.png"]];
I think is the same, but don't know why the other answer didn't work for me.
Hope it helps.

Badge icon resource/view

Is there a built in badge icon like the info icon so that I can show status updates on other views in my app? It's easy enough to duplicate manually but I'd like to use a built in resource if it's available.
Check out CustomBadge, the site is in German, but theres sample source code there.
You can also steal a badge from a tabbar view like this:
.h
IBOutlet UITabBarItem *tabbarItem;
UIView *badgeView;
.m
badgeView = [[UIView alloc] initWithFrame:CGRectMake(25,100, 32, 32)];
badgeView.backgroundColor = [UIColor clearColor];
badgeView.clipsToBounds = NO;
[badgeView addSubview:[((UIView *)[tabbar.subviews objectAtIndex:0]).subviews objectAtIndex:0]];
and to set the value for that badge:
tabbarItem.badgeValue = unreadCount;
Note that you don't have to use a UITabbar thats visible in your app, you are simple stealing the badge resource.
I'm sure it's not available for developers since Apple doesn't like to reuse assets for different purposes. Those badges have one definitive and simple purpose -- show the number of updates on the app icon. That's the only purpose they serve.

Change the color of a Tabbar on the iPhone

Our designers want to change the color of the default UITabBar. Of course they do.
They want the background to be green, and the icon highlights to be white, as opposed to the black/blue default color scheme.
Anyone have any experience or suggestions to do this?
You have to subclass the UITabBarController and implement custom drawing.
Check out this SO question. Changing Tint / Background color of UITabBar
Since iOS5 is released, you can now use the property tintColor.
i.e.:
tabBar.tintColor = [UIColor greenColor];
I have try this one and its working for me!!!
[self.TabBarController.tabBar setTintColor:[UIColor colorWithRed:0.1294 green:0.5686 blue:0.8353 alpha:1.0]];
[self.TabBarController.tabBar setTintColor:[UIColor "YOUR COLOR"];
Hope it'll help you also!!!
iOS 5.0 fixes this issue but the solution is under NDA. Look up UITabBar in your documentation for an EASY way to do what you want to do.
Be careful. If your app is going for submission to the app store, Apple may reject it if you're modifying their prescribed color scheme.
Theres a useful link here: http://duivesteyn.net/2010/01/16/iphone-custom-tabbar-background-image/
This can be done with a little private API hacking.

Repeating background image in native iPhone app

Short of putting a UIWebView as the back-most layer in my nib file, how can I add a repeating background image to an iPhone app (like the corduroy look in the background of a grouped UITableView)?
Do I need to create an image that's the size of the iPhone's screen and manually repeat it using copy and paste?
Apparently a UIColor is not necessarily a single color, but can be a pattern as well. Confusingly, this is not supported in Interface Builder.
Instead you set the backgroundColor of the view (say, in -viewDidLoad) with the convenience method +colorWithPatternImage: and pass it a UI Image. For Instance:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:#"gingham.png"]];
}
Of course, don't forget to add the image file to your application bundle.
There are also some built-in background pattern "colors":
groupTableViewBackgroundColor
viewFlipsideBackgroundColor
Because the are used globally across all iPhone apps, you incur the double-edged sword of an OS update updating the look and feel of your application (giving it a fresh new look that may or may not work right).
For instance:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
}
You should have a look at the QuartzDemo iPhone example code from Apple, specifically QuartzImageDrawing.m. Should use the following method call.
CGContextDrawTiledImage
You can even have an animated tiled background images that move. :D
Apps Amuck has a simple tutorial that show you how to do this on their site.
31 Days of iPhone Apps - Day 16: World Tour
You should use colorWithPatternImage