ViewController behaving oddly when pushed on the window

Posted by ayazalavi on Stack Overflow See other posts from Stack Overflow or by ayazalavi
Published on 2010-05-14T07:29:54Z Indexed on 2010/05/14 7:34 UTC
Read the original article Hit count: 198

Filed under:
|

I am using multiple controller during launch of an application in app delegate. One controller is for registration and the second controller is tabbar. tabbar was loading fine but when I pushed registration controller on window, contents went up by 20 units and I have good white blank screen at bottom. Therefore I recreated frame of my registration view controller in its viewdidload method and slided it 20 units down. The code is

self.view.frame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height);

and code in my app delegate for launch application was

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    if (![self accountExists]) {
                //code if account does not exists on iphone app database
        self.registerAccount = [[registerViewController alloc] initWithNibName:@"registerViewController" bundle:nil];
        [window addSubview:registerAccount.view];
    }
    else if([self autoLoginForAnyAccount]){
        //code for autologin to app
    }
    else {
        self.tabBarController.selectedIndex = 1;
        self.tabBarController.delegate = self;
        [window addSubview:tabBarController.view];
    }
    [window makeKeyAndVisible];
    return YES;
}

if anyone knows why there is a white space at bottom when registration controller is pushed then please share it with me.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c