views:

37

answers:

1

Hi all,

I have an App and, when I press the 'i' button, to show the About App view, I need to have a view, with a background image, with a UINavigationController and a UITableView. How can I achieve that, with InterfaceBuilder, or progamatically? It's not done in AppDelegate. I need it to be done on a view. I have the following code, but it only creates the UINavController and the UITableView. But with this code I'me unable to put a UIImage in the background:

UITableViewController *tableViewController = [[UITableViewController alloc] initWithStyle: UITableViewStyleGrouped];
tableViewController.title = @"About";

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController: tableViewController];

navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navController animated:YES];

[navController release];
[tableViewController release];

How can I do it?

Thanks, RL

+2  A: 

Not sure if this will work but worth at try:

tableViewController.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"whatever.png"]];
Ben
It works like this:tableViewController.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background-dark.png"]];thanks :-)
Rui Lopes
How can i clear the edges of the cells?
Rui Lopes
Maybe you can set the cells background color to [UIColor clearColor] or I think you can set a backgroundView property to a view with a clear background color. UIView *blankview = [[UIView alloc] initWithFrame:cell.frame];blankview.backgroundColor = [UIColor clearColor];cell.backgroundView = blankview;
Ben
What i need is the tableView background to clear color, but I put the image as the background. I've tried with another project.That way does not work :(
Rui Lopes
That's why i think I need a UIViewController, to put the image in the background of the view, then the NavController, and the tableView with it's backgoround to clearColor.Any ideas?
Rui Lopes
You'll probably need to make the tableview a subview of another view, set the tableviews background color to clear then set the background color of the parent view to the image pattern. Essentially replace UITableViewController with UIViewController then add a UITableVIew as a subview.
Ben
As I'm new to iPhone dev, can you help me with that?Should I do:UIViewController *viewController = [[UIViewController allo] init];UINavigationController * navController = [[UINavigationConctroller alloc] initWithRootViewController: viewController];and then, inside the class, on viewDidLoad, add something like [self addDubView: tableView];??thanks,
Rui Lopes
Yup, exactly. You'll need to alloc the tableview before you add it though, UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame]]; Then set the background colors on self.view to image and tableView to clearColor, [self.view setBackgroundColor: [UIColor colorWithImagePattern...]]; [tableView setBackgroundColor: [UIColor clearColor]]; Then add it as a subview like you said.
Ben