Created
July 22, 2011 21:31
-
-
Save vincentlg/1100476 to your computer and use it in GitHub Desktop.
Simple exemple de composant Graphique en Objective C - UILabel et UIWebView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//(@implementation UIViewController) | |
- (void)loadView | |
{ | |
UIView* myView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
myView.backgroundColor = [UIColor whiteColor]; | |
self.view = myView; | |
[myView release]; | |
// create title label | |
UILabel* titleUILabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 4, 300, 20)]; | |
titleUILabel.font = [UIFont systemFontOfSize:18]; | |
titleUILabel.text = [_newsModel title]; | |
// create date label | |
UILabel* dateUILabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 28, 300, 14)]; | |
dateUILabel.font = [UIFont systemFontOfSize:12]; | |
dateUILabel.text = [[_newsModel date] description]; | |
// create webView | |
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 46, 320, 500)]; | |
NSString *FeedURL=@"http://www.google.com"; | |
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:FeedURL]]; | |
[webView loadRequest: theRequest]; | |
[self.view addSubview:titleUILabel]; | |
[self.view addSubview:dateUILabel]; | |
[self.view addSubview:webView]; | |
[titleUILabel release]; | |
[dateUILabel release]; | |
[webView release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment