我面临两个具有相同代码的 UIView 的问题:
两个主要的 UIView:
UIView *firstView;
UIView *secondView;
UIView *thirdView;
self->thirdView = [[UIView alloc]initWithFrame(100,100,100,100)];
稍后在代码中:
self->firstView = [[UIView alloc]initWithFrame(0,0,200,200)];
self->secondView = [[UIView alloc]initWithFrame(0,0,200,200)];
然后在我做的代码中:
[self->firstView addSubView:self->thirdView];
[self->secondView addSubView:self->thirdView];
代码中发生的情况是,其中一个视图会以某种方式错过thirdView
,我想知道它是否与我使用相同的事实有关thirdView
。
如果是这样,thirdView
很重要,我需要在两个视图中都使用它,我该怎么做?