0
我要讓headerfile Rimage.h和M,我可以在任何地方使用,但我在這裏有一個問題 這是我使頭文件比任何地方都可以使用iPhone
Rimage.h
@class Rahul_imageplaceCordinatesViewController;
@interface Rimage : NSObject {
Rahul_imageplaceCordinatesViewController *vc;
}
-(void)addImageSubViewAtX:(CGFloat)x atY:(CGFloat)y;
@property (nonatomic,copy) Rahul_imageplaceCordinatesViewController *vc;
+(void)check1;
@end
,這是我的.m
@implementation Rimage
@synthesize vc;
/// this method let you have image with given X n Y
- (void)addImageSubViewAtX:(CGFloat)x atY:(CGFloat)y {
CGRect myImageRect1 = CGRectMake(x, y, 30.0f, 30.0f);
UIImageView *myImage1 = [[UIImageView alloc] initWithFrame:myImageRect1];
[myImage1 setImage:[UIImage imageNamed:@"status_finish.gif"]];
myImage1.tag = 1000;
myImage1.userInteractionEnabled = YES;
[self.view addSubview:myImage1];
}
現在我mainVC
我是愈傷組織
NG這樣
- (void)viewDidLoad {
Rimage *hw = [[Rimage alloc] init];
//[hw check1];
[Rimage check1];
[hw addImageSubViewAtX:160.0 atY:190.0];
}
,但我不能顯示圖像我不知道爲什麼:(
所以我應該怎麼做才能使用這個頭文件只顯示圖像,以便它可以通用? – ram 2010-07-17 02:52:58
如果我這樣做[vc.view addSubview:myImage1]; 那麼它的運行無限 – ram 2010-07-17 04:10:00