Last active
December 14, 2015 16:19
-
-
Save chrisallick/5114633 to your computer and use it in GitHub Desktop.
Custom UIView with Background Image and Navigation Bar.
This file contains 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
// | |
// SettingsView.m | |
// lastapp | |
// | |
// Created by Christopher Allick on 3/5/13. | |
// Copyright (c) 2013 Goon & Goblin. All rights reserved. | |
// | |
#import "SettingsView.h" | |
@implementation SettingsView | |
@synthesize bg; | |
- (id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) { | |
bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"settings_bg.png"]]; | |
[bg setFrame:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)]; | |
[self addSubview:bg]; | |
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; | |
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" | |
style:UIBarButtonItemStylePlain target:self action:@selector(dismiss:)]; | |
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Settings"]; | |
item.hidesBackButton = YES; | |
item.rightBarButtonItem = rightButton; | |
[item.leftBarButtonItem setEnabled:YES]; | |
[navBar pushNavigationItem:item animated:YES]; | |
[navBar setBarStyle:UIBarStyleBlack]; | |
[self addSubview:navBar]; | |
} | |
return self; | |
} | |
-(void)dismiss:(id)sender { | |
NSLog(@"cool"); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment