我在我的应用程序中有一个滚动视图。 如果我点击一个页面上的按钮,则添加一个子视图。我想在用户滚动视图时删除此子视图。该功能被称为:从不存在的视图中删除子视图
-(void) DisableViews {
[Annimation removeFromSuperview];
NSLog(@"scroll");
}
我得到的NSLog很多次,但风景也就是子视图,当我回来的页面。
我想这会发生,因为子视图的视图不是当前的视图,所以我不能删除子视图。
是否有任何可能从子视图的任何视图中删除子视图?
编辑: ViewController.h
@interface ViewController : UIViewController {
//...
UIView *Annimation;
}
@property (nonatomic,retain) UIView *Annimation;
实现:
ViewController.m
#import "ViewController.h"
#import "AppDelegate.h"
@implementation ViewController
@synthesize Annimation;
//...
- (void) Bild1ButtonKlickt{
Annimation = [[UIView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 480.0)];
Annimation.backgroundColor = [UIColor blackColor];
[self.view addSubview:Annimation];
}
NSLog相当无用。使它成为'NSLog(@“remove℅@”,[动画描述]);'。 – 2013-03-09 18:52:47
我的NSLog只查看这个函数是否被调用 – Pascal 2013-03-10 12:50:26
它还应该告诉“Animation”是否为非零。 – 2013-03-10 17:19:32