簡體   English   中英

uiview頂部的我的Imageview沒有響應觸摸事件

[英]My Imageview on top of uiview is not responding to touch events

viewImageView=[[UIImageView alloc] initWithImage:viewImage];
viewImageView.center=self.center;
[[self superview] addSubview:viewImageView];

我已經將imageview添加到superview.selfUIView子類。 但是,當我點擊或從右向左滾動時,會touchesbegin: withEvent:touchesEnded:withEvent: 但是,當我點擊或從左向右移動時touchesEnded:withEvent:不會被調用。 touchesCancelled:withEvent:正在調用touchesCancelled:withEvent:請幫助我解決此問題。

代替

[[self superview] addSubview:viewImageView];

嘗試這個:

[[self view] addSubview:viewImageView];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM