Re: [問題] Custom UIImagePickerController
※ 引述《sinread (電腦真耗錢)》之銘言:
: ※ 引述《s8911124 (-.-)》之銘言:
: : 第一種:
: : 直接把不需要接收touch事件的view
: : view.userInteractionEnabled = NO;
: : 第二種:
: : 如果你的view有時候要接收touch有時候不接收,
: : 你要在 pickerctl.view的 uiview class裡面覆寫
: : //Returns the farthest descendant of the receiver in the view hierarchy
: : (including itself) that contains a specified point.
: : - (UIView *)hitTest:(CGPoint)point withEvent(UIEvent *)event
: : {
: : UIView *hitView = [super hitTest:point withEvent:event];
: : //如果你覺得這個hitview要能回應 touch 的事件,就把它傳出去
: : 否則就return nil, 系統會在往parent view送。
: : }
: 魯蛇我簡化一下我想做到的功能:
: 1. A 是 B的 subview, 並且A 和 B的frame 完全一樣大小 ( A完全把B蓋住 )
: 2. A 需要對 touch 事件有反應, 並且 "同時" B也要有反應
: 在s8911124的第二種方式下, A 跟 B只能同時有一個有反應,
: 但是魯蛇我想要兩個"同時"都有反應
: 請問這樣可以做到嘛 ????
報告, 我找到個解法了 (雖然實作尚未完全, 應該算是個解法)
首先, 魯蛇我先繼承 UIImagePickerController
然後再UIImagePickerController 內override
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
在觸控發生時這一個method會被觸發, 並且UIImagePickerController
也有做auto focus的動作
剩下的就是自己在 UIImagePickerController.view內加上 小框框的動作
感謝各位的幫忙, 本魯蛇人生中的小確幸來臨 XD
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.219.69.157
※ 編輯: sinread 來自: 114.36.29.220 (09/27 00:30)
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章