開発環境は、Xcode4.3.3、エミュレータはiPhone iOS5.1です。
AppDelegate.mの修正
AppDelegate.mのapplication:didFinishLaunchingWithOptions:メソッドを以下のように修正します。広告のところはUIViewで領域を作って試しにUILabel置いてます。
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Window生成
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
//タブバー
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.view.frame = CGRectMake(0, -50, self.window.frame.size.width, self.window.frame.size.height);
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.window.rootViewController = self.tabBarController;
[self.window addSubview:self.tabBarController.view];
[self.window makeKeyAndVisible];
//広告用View
UIView *uiView = [[UIView alloc] initWithFrame:CGRectMake(0, 430, self.window.frame.size.width, 50)];
uiView.backgroundColor = [UIColor darkGrayColor];
[self.window addSubview:uiView];
UILabel *uiLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 10, 150, 30)];
uiLabel.text = @"ご自由に";
uiLabel.textAlignment = UITextAlignmentCenter;
uiLabel.textColor = [UIColor blackColor];
uiLabel.backgroundColor = [UIColor greenColor];
[uiView addSubview:uiLabel];
[self.window addSubview:uiLabel];
return YES;
}
これを実行すると以下のようになります。
0 件のコメント:
コメントを投稿