ページ

2011年5月31日火曜日

Xcode Tabで表示内容をswitchする





FirstViewController.h
#import <UIKit/UIKit.h>


@interface FirstViewController : UIViewController {
 
 IBOutlet UIWebView *google;
}

@end


FirstViewController.m
#import "FirstViewController.h"


@implementation FirstViewController

-(void)awakeFromNib{
 
 [google loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}
- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
 
 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end

secondTabController.h
#import <UIKit/UIKit.h>


@interface secondTabController : UIViewController {
 IBOutlet UIWebView *twitter;

}

@end


secondTabController.m
#import "secondTabController.h"


@implementation secondTabController

-(void)awakeFromNib{
 
 [twitter loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.twitter.com"]]];
}

- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
 
 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end

thirdTabController.h
#import <UIKit/UIKit.h>


@interface thirdTabController : UIViewController {
 IBOutlet UIWebView *facebook;
}

@end

thirdTabController.m
#import "thirdTabController.h"


@implementation thirdTabController

-(void)awakeFromNib{
 
 [facebook loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.facebook.com"]]];
}

- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
 
 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end


参考

YouTube - iPhone SDK Tutorial: Tab Bar Application with Web View on Each Tab
http://www.youtube.com/watch?v=HF-cX6lxKyU&hd=1

0 件のコメント:

コメントを投稿