|
|||
|
Ok here is how to make a simple webview
In your .h file Code:
@interface YourViewController : UIViewController<UIWebViewDelegate> {
UIWebView *dailyWebView;
}
@property(nonatomic, retain) UIWebView *dailyWebView;
@end
Code:
@synthesize dailyWebView
- (void)awakeFromNib{
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor lightGrayColor];
self.view = contentView;
[contentView release];
dailyWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 45, self.view.bounds.size.width, 375)];
dailyWebView.delegate=self;
dailyWebView.scalesPageToFit=YES;
[dailyWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
[self.view addSubview:dailyWebView];}
Code:
[dailyWebView release]; Last edited by macdaddy2201; 06-30-2008 at 10:26 PM. |
|
|||
|
Yes, you can reference specific items and it is faster to load. Whenever you make something in IB, the xib is parsed on the spot, where as UI stuff that has been programmed runs without having to parse a xib file. So performance is better when not using IB
Max |
|
|||
|
Thanks for your answer mxweas!
I have another litte question about UIWebView. What I want to do is to send variables in the url, like so: Code:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com/index.php?var1=%.f3&var2=%.3f",var1,var2]]]; edit: I just found the solution Code:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.example.comindex.php?var1=%.6f&var2=%.6f",variable1,variable2]]]];
Last edited by psychonikeo; 09-09-2008 at 03:38 PM. |