I am cresting an app that uses a UITAbleView to display some data retrieved from an SQLite database. The app starts out with a splash screen then transitions to the main view. I used interface builder to add the UITableView object. When the app starts, the UITableView is not eh size that was created in IB. Also, when scrolling, the UITAbleView acts very erratic. It shakes, jumps, the header flies off the screen,etc.
I did some research and read where it may be because of the way I am transitioning from the splash screen to the main view.
This is the UIApplication method from the PorjectFiveAppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ProjectFiveSplashController alloc] initWithNibName:@"ProjectFiveSplashController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
This is the code from theSplashViewController’s loadView method:
- (void)loadView{
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
UIView *view = [[UIView alloc] initWithFrame:appFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
self.view = view;
[view release];
splashImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ProjectFiveSplash.png"]];
splashImageView.frame = CGRectMake(0,0,1024,768);
[self.view addSubview:splashImageView];
viewController = [[ProjectFiveViewController alloc] initWithNibName:@"ProjectFiveViewController" bundle:[NSBundle mainBundle]];
viewController.view.alpha = 0.0;
[self.view addSubview:viewController.view];
activityLoading = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityLoading.frame = CGRectMake(0, 0, 1024, 768);
activityLoading.center = self.view.center;
[self.view addSubview: activityLoading];
}
The UITableView object has been assigned these properties in IB:
Scrollers:Shows Vertical Scrollers; Scrolling Enabled
Interaction: User interaction enabled
Drawing:Autoresize Subviews
I ended up moving the UITableView to the viewWillAppear method and the behaviors stopped