2013-07-15 3 views
1

У меня было приложение, в котором я создаю панель инструментов для навигации по веб-представлению. Все работает отлично, за исключением цвета кнопки. Когда я не позволяя кнопке отображать тот же цвет, что и цвет оттенка панели инструментов. И когда я включаю его, он отображается как white.but мне нужно представить кнопку, как она есть. Как я это делаю, `Как показать оригинальный цвет кнопки на панели инструментов

[self.navigationController setToolbarHidden:NO animated:YES]; 

    self.navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent; 


    self.navigationController.toolbar.tintColor=[UIColor colorWithRed:215/255.0 green:215/255.0 blue:215/255.0 alpha:1.0]; 
    buttonGoBack = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back_icon.png"] style:UIBarButtonItemStylePlain target:self action:@selector(backButtonTouchUp:)]; 

    UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 
    fixedSpace.width = 30; 

    buttonGoForward = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"forward_icon.png"] style:UIBarButtonItemStylePlain target:self action:@selector(forwardButtonTouchUp:)]; 

    UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 



    buttonAction = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(buttonActionTouchUp:)]; 

    UIBarButtonItem *buttonContainer = [[UIBarButtonItem alloc] initWithCustomView:containerView]; 
    [containerView release]; 
    NSMutableArray *toolBarButtons = [[NSMutableArray alloc] init]; 
    [toolBarButtons addObject:buttonGoBack]; 
    [toolBarButtons addObject:fixedSpace]; 
    [toolBarButtons addObject:buttonGoForward]; 
    [toolBarButtons addObject:flexibleSpace]; 
    [toolBarButtons addObject:buttonContainer]; 
    [toolBarButtons addObject:flexibleSpace]; 
    [toolBarButtons addObject:buttonAction]; 



    // Set buttons to tool bar 
    [self.navigationController.toolbar setItems:toolBarButtons animated:YES]; 

`

, как я могу получить Orginal цвет кнопки для кнопки Enabled = NO, может кто-нибудь помочь мне

+0

самый простой способ отключить userInteraction кнопки – Venkat

+0

@Erik я сделал это .but оно не дает мне Orginal цвет кнопка. Это проблема – hacker

+0

вы можете опубликовать снимок экрана? – Venkat

ответ

0

Я разработал решение, рад поделиться всем, если кто-то сталкивается с той же проблемой.

[[UIBarButtonItem appearance] setTintColor:[UIColor redColor]];

Таким образом, вы можете дать любой цвет в barbuttons.

Смежные вопросы