Skip to content

Instantly share code, notes, and snippets.

@marshluca
Created August 11, 2010 09:14
Show Gist options
  • Save marshluca/518728 to your computer and use it in GitHub Desktop.
Save marshluca/518728 to your computer and use it in GitHub Desktop.
custom view inherited from UIView
#import <UIKit/UIKit.h>
@interface PageView : UIView {
UIImageView *imageView;
UITextView *textView;
}
@property (nonatomic, retain) UIImageView *imageView;
@property (nonatomic, retain) UITextView *textView;
- (id)initWithImageView:(UIImageView *)imgView andTextView:(UITextView *)txtView;
@end
#import "PageView.h"
@implementation PageView
@synthesize imageView,textView;
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// Initialization code
}
return self;
}
- (id)initWithImageView:(UIImageView *)imgView andTextView:(UITextView *)txtView {
if (self = [super init]) {
imageView = imgView;
textView = txtView;
[self addSubview:imageView];
[self addSubview:textView];
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (void)dealloc {
[imageView release];
[textView release];
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment