Skip to content

Instantly share code, notes, and snippets.

@floriankrueger
Last active December 29, 2015 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floriankrueger/7667447 to your computer and use it in GitHub Desktop.
Save floriankrueger/7667447 to your computer and use it in GitHub Desktop.
Cocoa (Touch) templates for common subclasses
#import "XQCView.h"
@interface XQCView ()
@end
@implementation XQCView
#pragma mark - Memory Management
- (void)dealloc
{
}
#pragma mark - Setup & Init
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
[self setupSubviews];
[self setupLayout];
}
#pragma mark - Setup & Init (Private)
- (void)setupSubviews
{
}
- (void)setupLayout
{
}
@end
#import "XQCViewController.h"
#import "XQCView.h"
@interface XQCViewController ()
@end
@implementation XQCViewController
#pragma mark - Memory Management
- (void)dealloc
{
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Setup & Init
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
[self setup];
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
self.title = @"Example View Controller";
}
#pragma mark - View Lifecycle
- (void)loadView
{
XQCView *view = [[XQCView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.view = view;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment