I can t seem to achieve removing a subview of a subview of a view. Its like this:
[self.view add Subview:myView];
(自己.view add Subview:myView);
[我的查看添加Subview:overlay];
我的,h:
@interface
UIView *myView;
IBOutlet Overlay *overlay;
...
}
@property (strong, nonatomic) UIView *myView;
@property (strong, nonatomic) IBOutlet Overlay *overlay;
...
时 时:
-(void) method {
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(420.0f,0.0f,604.0f,768.0f)];
[self.view addSubview:myView];
Overlay *o = [[Overlay alloc] initWithFrame:CGRectMake(000.0f,000.0f,604.0f,768.0f)];
[myView addSubview:o];
}
I tried [myView removeFromSuperview]
and[myView removeFromSuperview]
inside the void method
, it works.
What I needed is to make it work outside or into a different void
but what Im doing is not working.
注:
上面写着当我将我的 View 连接到我的 View 的本地声明隐藏实例变量时。