Skip to content

Instantly share code, notes, and snippets.

@bimawa
Created August 13, 2014 05:24
Show Gist options
  • Save bimawa/e4eacf2dcd1acb358269 to your computer and use it in GitHub Desktop.
Save bimawa/e4eacf2dcd1acb358269 to your computer and use it in GitHub Desktop.
Configure navigationController method for TradeChat
- (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