作者sinread (电脑真耗钱)
看板MacDev
标题Re: [问题] Custom UIImagePickerController
时间Thu Sep 26 19:22:41 2013
※ 引述《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)