views:

66

answers:

0

Hi.

i have an application that must run on portrait and landscape.

All is working, but i have this issue:

i have the Navigation Controller in this way

http://img225.imageshack.us/i/schermata20100913a23511.png/

immediately under it there is another view(fixed static position, overlaying the rear view) in the image, it contains the number "7" In this example, i have the following structure /rootController.view -subViewWithNavigationController -graySubView

when i rotate, i have this problem http_//img255.imageshack.us/i/schermata20100913a23531.png/

the ubViewWithNavigationController title shrink by about 10-15px and take all the view upper , so i find a white space between title and my graySubView. in interface builder, i used many config, now it's like

http_//img295.imageshack.us/i/schermata20100913a23534.png/

to set the title, i also use this snippet

    - (void)SetNavigationTitle:(NSString*)title AndSubtitle:(NSString*)subtitle {
if (subtitle == nil)
 {
  self.navigationItem.titleView = nil;
  self.navigationItem.title = title;
  return;
 }

 // set the default title anyway, so the next view controllers will have the correct text on their "back" button
 self.navigationItem.title = title;

 #define LEFT_OFFSET 15

 // Replace titleView
 CGRect headerTitleSubtitleFrame = CGRectMake(LEFT_OFFSET, 0, 200, 44);    
 UIView* _headerTitleSubtitleView = [[UILabel alloc] initWithFrame:headerTitleSubtitleFrame];
 self.navigationItem.titleView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
 _headerTitleSubtitleView.backgroundColor = [UIColor clearColor];
 _headerTitleSubtitleView.autoresizesSubviews = NO;

 CGRect titleFrame = CGRectMake(LEFT_OFFSET, 10, 160, 24);  
 UILabel *titleView = [[UILabel alloc] initWithFrame:titleFrame];
 UIFont *font = [UIFont fontWithName:@"Georgia" size:20];
 titleView.backgroundColor = [UIColor clearColor];
 titleView.font = font;
 titleView.textAlignment = UITextAlignmentCenter;
 titleView.textColor = [UIColor whiteColor];
 titleView.shadowColor = [UIColor darkGrayColor];
 titleView.shadowOffset = CGSizeMake(0, -1);
 titleView.text = title;
 titleView.adjustsFontSizeToFitWidth = NO;
 [_headerTitleSubtitleView addSubview:titleView];
 [titleView release];

 CGRect subtitleFrame = CGRectMake(LEFT_OFFSET, 24, 160, 44-24);   
 UILabel *subtitleView = [[UILabel alloc] initWithFrame:subtitleFrame];
 subtitleView.backgroundColor = [UIColor clearColor];
 subtitleView.font = [UIFont boldSystemFontOfSize:13];
 subtitleView.textAlignment = UITextAlignmentCenter;
 subtitleView.textColor = [UIColor whiteColor];
 subtitleView.shadowColor = [UIColor darkGrayColor];
 subtitleView.shadowOffset = CGSizeMake(0, -1);
 subtitleView.text = subtitle;
 subtitleView.adjustsFontSizeToFitWidth = YES;
 [_headerTitleSubtitleView addSubview:subtitleView];
 [subtitleView release];

 self.navigationItem.titleView = _headerTitleSubtitleView;
 [_headerTitleSubtitleView release];}

also been taken from StackOverflow.

So, where i'm wrong? :-(

thanks for the help