Adding image to background - iphone

When you add Default.png, it gets shown up when the app is launched, i need to add this same image to all my tableviews, and viewcontrollers back grounds.
1.) Is it permitted by apple to use the Default.png to backgrounds of tableview and uiviews (I think its permitted, but i need to confirm)
2.) how do i add this image (Default.png) to a TableView's background ?
3.) how do i add this image (Default.png) to a Grouped TableView's background (This has sections too) ?
4.) how do i add this image (Default.png) to a UiViewControllers background ?

Yes, it is permitted, but generally speaking you might want to do this. According to the iOS programming guidelines:
When the system launches an app, it temporarily displays a static launch image on the screen. Your app provides this image, with the image contents usually containing a prerendered version of your app’s default user interface. The purpose of this image is to give the user immediate feedback that the app launched, but it also gives your app time to initialize itself and prepare its initial set of views for display. When your app is ready to run, the system removes the image and displays your app’s windows and views.
In other words, if you have any sort of pre-rendered UIKit elements (UINavigationBar, for example) in your Default.png, it probably doesn't make sense for it to be added as the background image of a view.
In any case, here's how you would set your UITableView background to your launch image:
self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"Default.png"]];
And for a UIViewController:
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"Default.png"]];

simply add ImageView to all the controllers and set its image and it is acceptable to use any image.Also set the tableviews background color to clear color

view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"Default.png"]];

Related

Adding Background Image to FlowCover

I'm using FlowCover in an app and need to add a background, but inserting a UIImageView and sending to the back in .xib only gives me the background image and buttons and no coverflow animation. I also cannot see where i would programme a
self.backgroundColor = [[UIColor alloc]initWithPatternImage:[UIImage imageNamed:#"bground.png"]];
type thing in the implemetation.
Any clues?
It does appear that you can add an UIImageview to the ViewController's View in the MainWindow.nib:
In the editor dropdown you can send the image to the back. It means that the Flow Cover View MUST NOT be set to Opaque and then will sit on top of the ImageView.

iphone-uiview-background

I am new to iPhone development. I have one XIB file, the login page (a form).
Now I want to set the UIView background image.
When I supply an image from Interface Builder then there is no effect, and when I set it from the code then also no effect.
self.view.backgroundColor = [UIColor colorWithPatternImage:
[UIImage imageNamed:#"srk_ipad_Homepg.png"]];
I don't want to use a UIImageView because when I place an image, all my controls are hidden behind the UIView.
You can use UIImageView to set a background without harm, you just have to move it to the top of the view hierarchy. Look at this splashscreen view:
And this is the view's hierarchy tree:
This will prevent your controls from being covered.

can i change the black background of an iphone app?

My app is structured like this, a single MainWindow with window backgroundColor to white(which doesn't appear anywhere anyway), and in this nib i have a UINavigationController which doesn't seems to have a backgroundColor.
Any view controller is added from code and made from code and they have a gray background.
What happens is that when i rotate the iphone and the views are rotating as well, i see a black background under my views. Can this be changed? It looks ugly especially if i have a photo that is rotating in the same time with my gray background.
You need to use the embedded view in the UINavigationView
When you are your UINavigationview Class :
self.view.backgroundColor = [UIColor greyColor];
Or any other color you want.
Change the backgroundColor of UIWindow in the file 'MainWindow.xib'

Most performant way to use a background image throughout an iphone application

I have an image that I want to use as the background for every view in my application including several modal views.
Right now I'm just creating a new UIColor for each view:
view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"metal-bg.png"]];
This works for the most part but with the modal views there is a brief period during the sliding animation before the background image displays when I can see through the modal view to the view below it.
Is there a better way to do this?
Such as setting up some sort of global object that all the views can use?
Have you tried setting the background image in viewWillAppear:(BOOL)animated?
I was just wondering about this yesterday.
I haven't tried this, but I suspect that it may be possible to add a UIImage to the Application's delegate and then use that image in every view.
Try this:
[self.view setBackgroundColor:[[[UIApplication sharedApplication] delegate] bgImageColor]];
Perhaps you can add a subview that contains the image as the bottom view of the window object in the app delegate. Then, for any views that you add on top, you can do: self.view.backgroundColor = [UIColor clearColor] (assuming it's a UIViewController or one of its children that you're using).

Why will my custom background image work on the iPhone, but not iPad?

In my app delegate I am setting the view background of the view controller like this:
navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"iPhoneBackground.png"]];
And it works really well when i am running my iPhone app, but when I build it as an iPad app (its a universal application) the background is just gray.
The views that I am trying to get the image to set are simple drill down views of a uitableview. I just can't get an iPad image to show...
Thanks!
try to change the view's frame to be 1024x1024 before applying the background pattern
try setting tableView.backgroundView = nil