例如,我创建了一个方法changeColor
来调用我们使用的方法
[self changeColor];
但我怎样才能取消这些方法?
已编辑:这是我的代码我有几个按钮,它们将一些图像添加到图像视图
- (void) setImagesFrame1 {
NSMutableArray *imageArray = [[NSMutableArray alloc]initWithCapacity:12];
for (int i = 0; i <= 12; i++) {
NSString *fileName = [NSString stringWithFormat:@"a%d.png",i];
UIImage *j = [UIImage imageNamed:fileName];
UIImageView *tempImage = [[UIImageView alloc]initWithImage:j];
[imageArray addObject:tempImage];
[self createPageWithImage:tempImage forPage:i];
}
}
- (void) setImagesFrame2 {
NSMutableArray *imageArray = [[NSMutableArray alloc]initWithCapacity:12];
for (int i = 0; i <= 12; i++) {
NSString *fileName = [NSString stringWithFormat:@"s%d.png",i];
UIImage *j = [UIImage imageNamed:fileName];
UIImageView *tempImage = [[UIImageView alloc]initWithImage:j];
[imageArray addObject:tempImage];
[self createPageWithImage:tempImage forPage:i];
}
}
等等 ...
我用这个动作调用我的方法:
- (IBAction)openFrames:(UIButton *)sender {
[captureView addSubview:framesPreviewView];
[framesPreviewView sendSubviewToBack:captureView];
framesPreviewView.frame = CGRectMake(img.bounds.origin.x, img.bounds.origin.y, img.bounds.size.width, img.bounds.size.height);
//buttons
if (sender == frame1) { [self setImagesFrame1]; }
if (sender == frame2) { NSLog(@"frame2"); }
if (sender == frame3) { [self setImagesFrame3]; NSLog(@"frame3"); }
}
当我按下 frame1 按钮时,图像将被添加到我的视图中,问题是当我按下 frame2 按钮时,此方法的图像也会添加到我的视图中我需要避免这种情况,这意味着当我触摸每个按钮时,其他按钮的方法应该取消