uiresponder

UIButton in cell in collection view not receiving touch up inside event

♀尐吖头ヾ 提交于 2019-11-27 07:51:20
The following code expresses my problem: (It's self-contained in that you could create a Xcode project with an empty template, replace the contents of the main.m file, delete the AppDelegate.h/.m files and build it) // // main.m // CollectionViewProblem // #import <UIKit/UIKit.h> @interface Cell : UICollectionViewCell @property (nonatomic, strong) UIButton *button; @property (nonatomic, strong) UILabel *label; @end @implementation Cell - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.label = [[UILabel alloc] initWithFrame:self.bounds]; self.label

UIWebView without Copy/Paste and selection rectangle when showing documents

时光怂恿深爱的人放手 提交于 2019-11-27 04:24:06
问题 In my App I want to disable the Copy/Paste/Cut of contents that are showed by a UIWebView object. To achieve this, I created a UIWebView subclass and overrode the - (BOOL)canPerformAction:(SEL)action withSender:(id)sender method: #pragma mark - UIResponderStandardEditActions - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (action == @selector(copy:) || action == @selector(paste:)|| action == @selector(cut:)) { return _copyCutAndPasteEnabled; } return [super canPerformAction

UIGestureRecognizer blocks subview for handling touch events

半腔热情 提交于 2019-11-26 23:41:06
I'm trying to figure out how this is done the right way . I've tried to depict the situation: I'm adding a UITableView as a subview of a UIView . The UIView responds to a tap- and pinchGestureRecognizer , but when doing so, the tableview stops reacting to those two gestures (it still reacts to swipes). I've made it work with the following code, but it's obviously not a nice solution and I'm sure there is a better way. This is put in the UIView (the superview): -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if([super hitTest:point withEvent:event] == self) { for (id gesture in

InputAccessoryView docked at bottom

你说的曾经没有我的故事 提交于 2019-11-26 18:55:09
问题 I'm trying to achieve similar positioning behavior as the bottom text input bar in Apple's Messages app. I have tried many approaches, searched high and low and there are many similar questions but none have been satisfactory. To specify: There is a UIToolbar at the bottom of the view The toolbar is to follow the keyboard as the keyboard appears and disappears The toolbar should stay on top of the keyboard when the keyboard is visible When the keyboard is hidden, the toolbar stays ("docked")

How to ignore touch events and pass them to another subview&#39;s UIControl objects?

做~自己de王妃 提交于 2019-11-26 15:08:14
I have a custom UIViewController whose UIView takes up a corner of the screen, but most of it is transparent except for the parts of it that have some buttons and stuff on it. Due to the layout of the objects on that view, the view's frame can cover up some buttons beneath it. I want to be able to ignore any touches on that view if they aren't touching anything important on it, but I seem to only be able to pass along actual touch events (touchesEnded/nextResponder stuff). If I have a UIButton or something like that which doesnt use touchesEnded, how do I pass the touch event along to that? I

Is there any way of asking an iOS view which of its children has first responder status? [duplicate]

青春壹個敷衍的年華 提交于 2019-11-26 14:59:34
问题 This question already has answers here : Get the current first responder without using a private API (28 answers) Closed 6 years ago . In Mac OS X, you can find the first responder like this: [[self window] firstResponder] Is there any way of doing it in iOS? Or do you need to enumerate the child controls and send an isFirstResponder message to each one? 回答1: You would need to iterate over all of the child controls and test the isFirstResponder property. When you encounter TRUE , break out of

UIButton in cell in collection view not receiving touch up inside event

杀马特。学长 韩版系。学妹 提交于 2019-11-26 13:17:58
问题 The following code expresses my problem: (It's self-contained in that you could create a Xcode project with an empty template, replace the contents of the main.m file, delete the AppDelegate.h/.m files and build it) // // main.m // CollectionViewProblem // #import <UIKit/UIKit.h> @interface Cell : UICollectionViewCell @property (nonatomic, strong) UIButton *button; @property (nonatomic, strong) UILabel *label; @end @implementation Cell - (id)initWithFrame:(CGRect)frame { if (self = [super

UIGestureRecognizer blocks subview for handling touch events

女生的网名这么多〃 提交于 2019-11-26 08:46:07
问题 I\'m trying to figure out how this is done the right way . I\'ve tried to depict the situation: I\'m adding a UITableView as a subview of a UIView . The UIView responds to a tap- and pinchGestureRecognizer , but when doing so, the tableview stops reacting to those two gestures (it still reacts to swipes). I\'ve made it work with the following code, but it\'s obviously not a nice solution and I\'m sure there is a better way. This is put in the UIView (the superview): -(UIView *)hitTest:

How to get touches when parent view has userInteractionEnabled set to NO in iOS

有些话、适合烂在心里 提交于 2019-11-26 08:14:27
问题 When the parent view has userInteractionEnabled=NO, its subviews will not accept touch events even if their userInteractionEnabled property is set to YES. Is there any way to still get touch events in subviews? 回答1: To get a view to let touches pass-through but give its subviews handle touches, let userInteractionEnabled on that view to YES and, instead, use this snippet: -(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event { id hitView = [super hitTest:point withEvent:event]; if (hitView =

How to ignore touch events and pass them to another subview&#39;s UIControl objects?

纵然是瞬间 提交于 2019-11-26 04:12:57
问题 I have a custom UIViewController whose UIView takes up a corner of the screen, but most of it is transparent except for the parts of it that have some buttons and stuff on it. Due to the layout of the objects on that view, the view\'s frame can cover up some buttons beneath it. I want to be able to ignore any touches on that view if they aren\'t touching anything important on it, but I seem to only be able to pass along actual touch events (touchesEnded/nextResponder stuff). If I have a