I'm trying to get the sample ScalingScrollView app to work in my App, though I wanted to make it a Tab in my Tab bar and I do not want to use a XIB file.
I've tried with and without adding to the Tab bar and I cannot seem to get the redbox to draw, my viewDidLoad is not getting fired.
My ScalingScrollViewViewController initWithFrame looks like this:
I see it adjusting the scale and stuff, but its just not displaying the view.
Here is my application didFinishLaunchingWithOptions code:
My other tabs show up just fine. So I'm thinking its the way I'm trying to recreate the ScalingScrollViewViewController.xib file in code.
Any tips would be great.
I've tried with and without adding to the Tab bar and I cannot seem to get the redbox to draw, my viewDidLoad is not getting fired.
My ScalingScrollViewViewController initWithFrame looks like this:
Code:
-(id)initWithFrame:(CGRect)viewRect{ self = [super init]; _masterView = [[UIView alloc] initWithFrame:viewRect]; _scalingScrollView = [[OUIScalingScrollView alloc] initWithFrame:viewRect]; _scalingView = [[ScalingView alloc] initWithFrame:viewRect]; [_scalingView setScale:2.0]; [_scalingScrollView setDelegate:self]; //[_scalingScrollView addSubview:_scalingView]; //[_masterView addSubview:_scalingScrollView]; [self setScalingView:_scalingView]; [self setScrollView:_scalingScrollView]; [self setView:_masterView]; UITabBarItem *tbi = [self tabBarItem]; [tbi setTitle:@"ScaleScroll"]; UIImage *i = [UIImage imageNamed:@"wateringcan.png"]; [tbi setImage:i]; [self setTabBarItem:tbi]; //[self sizeInitialViewSizeFromCanvasSize]; [self adjustScaleTo:2.0]; return self; }
Here is my application didFinishLaunchingWithOptions code:
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { tabBarController = [[UITabBarController alloc] init]; //Create Vierw Controllers UIViewController *vc1 = [[sprinklerViewController alloc] init]; UIViewController *vc2 = [[sprinklerViewController alloc] init]; UIViewController *vc3 = [[splitViewController alloc] init]; CGRect viewRect = CGRectMake(0.0, 0.0, 500, 400); ScalingScrollViewViewController *vc4 = [[ScalingScrollViewViewController alloc] initWithFrame:viewRect]; //Make array containing View Controllers NSArray *viewControllers = [NSArray arrayWithObjects:vc4, vc2, vc3, vc1, nil]; [vc1 release]; [vc2 release]; [vc3 release]; [vc4 release]; //Attach VC Array to TB [tabBarController setViewControllers:viewControllers]; [window addSubview:[tabBarController view]]; [window makeKeyAndVisible]; return YES; }
Any tips would be great.