Created
August 11, 2010 09:14
-
-
Save marshluca/518728 to your computer and use it in GitHub Desktop.
custom view inherited from UIView
This file contains hidden or 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
#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