Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///========CUSTOM NAVIGATION BAR=============///
- @implementation UINavigationBar (UINavigationBarCustomDraw)
- - (void) drawRect:(CGRect)rect {
- [self setTintColor:[UIColor colorWithRed:0.5f
- green: 0.5f
- blue:0
- alpha:1]];
- if ([self.topItem.title length] > 0 && ![self.topItem.title isEqualToString:@"Back to ..."]) {
- [[UIImage imageNamed:@"CustomNavigationBar.png"] drawInRect:rect];
- CGRect frame = CGRectMake(0, 0, 320, 44);
- UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
- [label setBackgroundColor:[UIColor clearColor]];
- label.font = [UIFont boldSystemFontOfSize: 20.0];
- label.shadowColor = [UIColor colorWithWhite:0.0 alpha:1];
- label.textAlignment = UITextAlignmentCenter;
- label.textColor = [UIColor whiteColor];
- label.text = self.topItem.title;
- } else {
- [[UIImage imageNamed:@"CustomNavigationBar.png"] drawInRect:rect];
- self.topItem.titleView = [[[UIView alloc] init] autorelease];
- }
- }
- ///========CUSTOM SEARCH BAR=============///
- @implementation UISearchBar (CustomBG)
- - (void)drawRect:(CGRect)rect {
- UIImage *image = [UIImage imageNamed: @"CustomNavigationBar.png"];
- [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
- }
Add Comment
Please, Sign In to add comment