Csabi
Csabi

Reputation: 3043

problem with changing view

hi I have a problem I made an application based on apples sample app called photoscroller and i want to add a login screen.but when i add it the showed view move upward 10-15 pixels and the main window is visible underneath.I ask why?

Parts of my code:

at view did load:

    InfoViewController *infoView =  [[InfoViewController alloc] initWithNibName:nil bundle:nil];
    self.view = infoView.view;
    [infoView release];

then later after validating the login:

    CGRect pagingScrollViewFrame = [self frameForPagingScrollView];
    pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
    pagingScrollView.pagingEnabled = YES;
    pagingScrollView.backgroundColor = [UIColor blackColor];
    pagingScrollView.showsVerticalScrollIndicator = NO;
    pagingScrollView.showsHorizontalScrollIndicator = NO;
    pagingScrollView.contentSize = [self contentSizeForPagingScrollView];
    pagingScrollView.delegate = self;
    self.view = pagingScrollView;
...

I do not know why is pushed upward when i add other view.

thank for every answer

Upvotes: 0

Views: 67

Answers (1)

Lepidopteron
Lepidopteron

Reputation: 6165

Could you past the method - (CGRect) frameForPagingScrollView, without that method it's bit harder to understand your code.

But i guess the self.view.frame and the CGRect returned from that method differ. Further guess would be, that the difference are not 10-15 pixels, but 20 pixels (for the height of the UIStatusBar), which might be enabled in your .xib-File but is actually not displayed.

Upvotes: 1

Related Questions