我試圖讓兩個子類:類的子類超類
// Old code
- (void)setPaging {
[pagingScrollView addSubview:self.ImageScrollView];
}
@interface ImageScrollView : UIScrollView <UIScrollViewDelegate> {
UIView *imageView;
NSUInteger index;
}
@property (assign) NSUInteger index;
- (void)displayTiledImageNamed:(CGPDFPageRef)page size:(CGSize)imageSize;
@end
@implementation ImageScrollView
@synthesize index;
// ... my methods ...
@end
更改爲:
// NEW Code__________________________________________________________*
- (void)setPaging {
if (D == 1) {
// error: request for member 'ISVportrate' in something not a
// structure or union
[pagingScrollView addSubview:self.ISVportrate];
} else if (D == 2) {
//error: request for member 'ISVLandscape' in something not a
// structure or union
[pagingScrollView addSubview:self.ISVLandscape];
}
}
@class ISVportrate;
@class ISVLandscape;
@interface ImageScrollView : UIScrollView <UIScrollViewDelegate> {
UIView *imageView;
NSUInteger index;
}
@property (assign) NSUInteger index;
- (void)displayTiledImageNamed:(CGPDFPageRef)page size:(CGSize)imageSize;
@end
@interface ISVportrate : ImageScrollView {}
@end
@interface ISVLandscape : ImageScrollView {}
@end
@implementation ISVportrate : ImageScrollView
// error: property 'index' attempting to use ivar 'index' declared in
// super class of 'ISVportrate'
@synthesize index;
// ... my methods ...
@end
@implementation ISVLandscape : ImageScrollView
// error: property 'index' attempting to use ivar 'index' declared in
// super class of 'ISVLandscape'
@synthesize index;
// ... my methods ...
@end
我不這樣做的權利,我是誰?見上面我有4個錯誤......這是我第一次上課......幫助我理解,我想我已經差不多了。
這是什麼編程語言?將來,請至少在標籤中提及編程語言,但最好也在問題本身中提及。 – Timwi 2010-08-23 00:14:32
對我來說看起來像Objective-C。 – 2010-08-23 00:21:30
iphone sdk xcode objc大聲笑抱歉maaaaate! :P – user422241 2010-08-23 00:29:51