首先,我认为控制人员从下面的守则开始,但出于我的工作,我需要将以下守则单独列为一类。 因此,我创建了一个我下面所贴的习俗学课。
在这一点上,我有可能在我的控制师中树立起这一级的榜样,创建IBOut,并将其与界面建筑商的UIScrollView(或某种观点)连接起来,并获得同样的行为,我如何做这样的事情?
海关
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface CustomView : UIScrollView <UIScrollViewDelegate> {
UIScrollView *scrollView;
UIImageView *imageView;
}
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) UIImageView *imageView;
海关
#import <UIKit/UIKit.h>
@implementation CustomView
@synthesize scrollView, imageView;
- (id)init {
if (self = [super init]) {
// Initialization code
UIImageView *temp = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage.png"]];
self.imageView = temp;
[temp release];
scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);
//Other Scroll View Properties
scrollView.delegate = self;
[scrollView addSubview:imageView];
}
return self;
}
- (void)dealloc {
[scrollView release];
[imageView release];
[super dealloc];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
//Perform an action
}
@end