Ios 当UIView超过UIView时,不调用touchesEnded 我有一个UIViewController 我有两种观点 第一个UIView显示在整个屏幕上 第二个UIView仅显示在屏幕的上半部分和第一个UIView的上方
触摸下部(仅在第一个UIView上)时,将调用ToucheSBegind,然后调用touchesEnded。->嗯 触摸第二个UIView时,会调用touchesBegind,但不会调用toucheSend->not ok 当移除第二个UIView并触摸第一个UIView的上部时,两个tocuhes方法都被调用->确定 是否有人有想法/提示我在哪里搜索未调用touchesEnded的案例 更新Ios 当UIView超过UIView时,不调用touchesEnded 我有一个UIViewController 我有两种观点 第一个UIView显示在整个屏幕上 第二个UIView仅显示在屏幕的上半部分和第一个UIView的上方,ios,swift,touch,Ios,Swift,Touch,触摸下部(仅在第一个UIView上)时,将调用ToucheSBegind,然后调用touchesEnded。->嗯 触摸第二个UIView时,会调用touchesBegind,但不会调用toucheSend->not ok 当移除第二个UIView并触摸第一个UIView的上部时,两个tocuhes方法都被调用->确定 是否有人有想法/提示我在哪里搜索未调用touchesEnded的案例 更新 override func viewDidLoad() { let worldmap
override func viewDidLoad() {
let worldmaprect=CGRectMake(0, 0, self.view.frame.width, worldmapHeigth);
worldmapview = Worldmapview(frame: worldmaprect);
view.addSubview(worldmapview); // first UIView
let statusbarrect=CGRectMake(0, 0, self.view.frame.width, 100);
statusbar=StatusBar(frame: statusbarrect);
view.addSubview(statusbar); //second UIVIew
你可以发布代码来显示你是如何创建和添加视图的吗?我添加了我的代码,在这里我添加了2个UIView。我又看了一遍代码,没有发现任何特别的东西。我的第一个问题是:在这种情况下,当我单击第二个UIView时是否应该调用touchesEnded?您在哪里创建yearBarView?view.addSubview(yearbarview)//第二,这是错误的。我更正了代码。刚刚重命名之后,您确定没有调用
touchesend
?无论您触摸的是哪个视图,touchesbeated
和touchesend
都应该始终被调用。