Created
August 13, 2014 05:24
-
-
Save bimawa/e4eacf2dcd1acb358269 to your computer and use it in GitHub Desktop.
Configure navigationController method for TradeChat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)p_configureNavigationController | |
{ | |
[[[self navigationController] navigationBar] setTintColor:[UIColor colorWithRed:0.949 green:0.957 blue:0.961 alpha:1.000]]; | |
// Left Button | |
UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)]; | |
[leftView setBackgroundColor:[UIColor clearColor]]; | |
UIButton *leftViewButton = [UIButton buttonWithType:UIButtonTypeCustom]; | |
[leftViewButton setFrame:CGRectMake(0, 0, 30, 30)]; | |
[leftViewButton addTarget:self action:@selector(a_pressedNavigationButtonLeft) forControlEvents:UIControlEventTouchUpInside]; | |
[leftView addSubview:leftViewButton]; | |
NSString *navigationBarTitle; | |
navigationBarTitle = @"Title name"; | |
[leftViewButton setImage:[UIImage imageNamed:@"NavigationBarButtonBackDefault"] forState:UIControlStateNormal]; | |
[leftViewButton setImage:[UIImage imageNamed:@"NavigationBarButtonBackPressed"] forState:UIControlStateHighlighted]; | |
UIBarButtonItem *barButtonItemLeft = [[UIBarButtonItem alloc] initWithCustomView:leftView]; | |
self.navigationItem.leftBarButtonItem = barButtonItemLeft; | |
UILabel *navigationBarTitleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
[navigationBarTitleLabel setBackgroundColor:[UIColor clearColor]]; | |
[navigationBarTitleLabel setFont:[UIFont systemFontOfSize:18]]; | |
[navigationBarTitleLabel setTextColor:[UIColor colorWithRed:109 / 255.0 green:108 / 255.0 blue:107 / 255.0 alpha:1.0]]; | |
[navigationBarTitleLabel setText:navigationBarTitle]; | |
[navigationBarTitleLabel sizeToFit]; | |
[self.navigationItem setTitleView:navigationBarTitleLabel]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment