Reputation: 49057
How do I change the black/gray color to white?
This is just a simple view with a UIView attached to the UIViewControllers property together a with a webview that fills the UIView.
UPDATE
Here's the code that works:
- (void)loadView {
UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 416.0f)];
[webView setBackgroundColor:[UIColor whiteColor]];
self.view = webView;
[webview release];
}
Thanks in advance.
Upvotes: 4
Views: 13593
Reputation: 10283
A few improvements for your code:
- (void)viewDidLoad {
[super viewDidLoad];
UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(self.view.bounds)];
[webView setBackgroundColor:[UIColor whiteColor]];
[self.view addSubview: webView];
[webview release], webview = nil;
}
Overall you should find this approach less brittle.
PS. If you keep a reference to the UIWebView
around, don't forget to release it in - viewDidUnload
.
Upvotes: 0
Reputation: 54425
You can use the UIScrollView's backgroundColor property to achieve this, the signature being:
@property(nonatomic, copy) UIColor *backgroundColor
As such to change it to white, you'd use:
[myScrollView setBackgroundColor:[UIColor whiteColor]];
Upvotes: 11