何度も修正したものをあげてすみません><
本当に申し訳ないです。
何とか解決したく試行錯誤を繰り返しているのですがイマイチうまくいきません。
先ほどの不具合を改善する為に自分なりに無理矢理作ったソースが下記になります。
デフォルトのビューの範囲を無理矢理変えております。
RootViewController.h と DataViewController.h の2つのページを作ってみたのですがタブを押しても画面遷移してくれません。
何とかここまで修正出来れば開発の流れがわかるのですが・・・。
アドバイスを頂けないでしょうか。
もしくはこれだけでは不十分でしたらプロジェクトを添付させて頂きます。
1点目
tabBarControllerを追加するとテーブルビューがスクロールしない
→ナビゲーションバーとバナーのビューの範囲を変えたので出来る様にはなったのですがこれが正しいやり方なのでしょうか?
2点目
なぞのナビゲーションバーがある
→無理矢理範囲を狭めて見えなく?したのですが多分まずい気もします・・・。
3点目
バナーをタッチできない
→修正してみたのですがこんなやり方でいいのでしょうか?
コード:
#import "MyTableViewCellAppDelegate.h"
#import "RootViewController.h"
#import "DataViewController.h"
@implementation MyTableViewCellAppDelegate
@synthesize window;
@synthesize navigationController;
@synthesize tabBarController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ナビゲーションカラーの変更
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
// タブの作成
self.tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
UITabBarController *tab1Controller = [[[UITabBarController alloc] initWithNibName:@"RootViewController" bundle:nil] autorelease];
UITabBarController *tab2Controller = [[[UITabBarController alloc] initWithNibName:@"DataViewController" bundle:nil] autorelease];
UITabBarController *tab3Controller = [[[UITabBarController alloc] initWithNibName:@"tab3" bundle:nil] autorelease];
UITabBarController *tab4Controller = [[[UITabBarController alloc] initWithNibName:@"tab4" bundle:nil] autorelease];
tabBarController.viewControllers = [NSArray arrayWithObjects:tab1Controller, tab2Controller, tab3Controller, tab4Controller, nil];
tab1Controller.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"調合表" image:[UIImage imageNamed:@"hoge1.png"] tag:0];
tab2Controller.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"キークエ" image:[UIImage imageNamed:@"hoge2.png"] tag:1];
tab3Controller.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"タブ3" image:[UIImage imageNamed:@"hoge3.png"] tag:2];
tab4Controller.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"タブ4" image:[UIImage imageNamed:@"hoge4.png"] tag:3];
tabBarController.view.frame = CGRectMake(0,375,320,45);
// バナーの作成
UIView *backGroundView = [[UIView alloc] init];
backGroundView.frame = CGRectMake(0,420,320,60);
backGroundView.userInteractionEnabled = YES;
UIButton *twitterButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
[twitterButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[twitterButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
twitterButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[twitterButton setBackgroundImage:[UIImage imageNamed:@"banner.png"] forState:UIControlStateNormal];
[backGroundView addSubview:twitterButton];
[twitterButton release];
[window addSubview:navigationController.view];
[window addSubview:tabBarController.view];
[window addSubview:backGroundView];
[window makeKeyAndVisible];
[backGroundView release];
return YES;
}