我有一个 UIView
的子类.每当我检测到触摸事件时,我都需要显示一个新的 UI View 。
我知道我必须重写以下方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
我的问题是我不知道如何显示全屏 View 。
我尝试了以下方法:
CGRect screenSize = [[UIScreen mainScreen] bounds];
UIView *mysubview = [[UIView alloc] initWithFrame : screenSize];
[self.window addSubview:mysubview];
但我不确定这是否是正确的方法。
谁能给我建议?
最佳答案
在这种情况下,我使用 mySubView.frame = self.view.frame
;
关于ios - UIView 子类,触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9410735/