О настроенном UINavigationBar - PullRequest
       17

О настроенном UINavigationBar

2 голосов
/ 29 декабря 2011

Я делаю приложение для iPad. Есть некоторые проблемы.

Я использую PopoverView, включая UINavigationViewController.

Сначала, когда я нажимаю, мой PopoverView выглядит как на рисунке ниже. Я четко вижу границы фонового изображения панели навигации.

enter image description here

Если я снова нажму кнопку [Genese 1], снова появится PopOverView. Он не видит границы фонового изображения панели навигации.

enter image description here

Пожалуйста, расскажите мне о моих ошибках. Спасибо !!!

AppDelegate.m

    // Create resizable images  
    UIImage *gradientImage44 = [[UIImage imageNamed: @"surf_gradient_textured_44.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

    // Set the background image for *all* UINavigationBars
    [[UINavigationBar appearance] setBackgroundImage:gradientImage44 forBarMetrics:UIBarMetricsDefault];

    // Customize the title text for *all* UINavigationBars
    [[UINavigationBar appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], 
      UITextAttributeTextColor, 
      [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], 
      UITextAttributeTextShadowColor, 
      [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], 
      UITextAttributeTextShadowOffset, 
      [UIFont fontWithName:@"Arial-Bold" size:0.0], 
      UITextAttributeFont, 
      nil]];

    // Customize UIBarButtonItems 
    UIImage *button30 = [[UIImage imageNamed:@"button_back_textured_30.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)];


    [[UIBarButtonItem appearance] setBackgroundImage:button30 forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

    [[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.5], UITextAttributeTextColor, [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, [UIFont fontWithName:nil size:0.0], UITextAttributeFont, nil] forState:UIControlStateNormal];

ViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.layer.cornerRadius = 0.0f; // I don't want corner's round edges.

    self.backView.layer.cornerRadius = 5.0f;
    self.backView.layer.borderWidth = 1;
    self.backView.layer.borderColor = [UIColor colorWithRed:0/255.0f green:0/255.0f blue:0/255.0f alpha:1].CGColor; 
    [self.navigationController setNavigationBarHidden:NO];

}

//when call again this view 
-(void)viewDidAppear:(BOOL)animated {

    self.view.layer.cornerRadius = 0.0f; 

    [super viewDidAppear:animated];
}
...