-1

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 ?

2
  • This is downvoted because you could have Googled "image as background UITableView" and "image as background of UIViewController" and found the answer almost immediately.
    – Emil
    Jan 31, 2012 at 18:19
  • 1
    I wouldn't have wrote all these sentences if i knew what to google
    – sharon
    Jan 31, 2012 at 18:35

3 Answers 3

2

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"]];
1

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

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

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.