uiresponder

keyboardWillShow called twice

独自空忆成欢 提交于 2019-11-30 03:03:29
问题 I have a view with keyboard notifications such as keyboardWillShow and keyboardWillHide All the codes handles with the notification I use is taken from Apple's sample code "KeyboardAccessory" When I first enter this view, everything works fine. But when I return to this view from its subviews, every time I tap a button that says: [myTextField becomeFirstResponder]; the keyboardWillShow and keyboardWillHide methods will be called twice every time. It's really confusing, Could anyone helps me

How to send touch events to superview in iOS?

a 夏天 提交于 2019-11-29 15:41:47
问题 I am doing an iPad app. How do I send touch events to its superview? I am adding a view which is always some other activity. On that I am adding scrollview to half the screen and in the other half I add another view. It all works fine, now I want to add a button and a small description view that will appear when button is tapped and disappear again when button is tapped again. In order to implement this I took a view which covers the entire view and made its back ground color clear. I place

Perform copy/cut from UIResponderStandardEditActions

你离开我真会死。 提交于 2019-11-29 12:38:20
These are standart actions for UIMenuController declared http://developer.apple.com/library/ios/#documentation/uikit/reference/UIResponderStandardEditActions_Protocol/UIResponderStandardEditActions.html How can I perform these methods manually, like from another UIMenuItem or whatever? I can't find the right selector:( [self cut:sender]; [UIResponder cut:sender]; [[UIMenuController sharedMenuController] cut:sender]; (void) cut: (id) sender {[super cut:sender];} So far non of these don't work, selector not found. You need to send the action along the responder chain, starting with the "first

How to cancel a sequence of UITouch events?

梦想的初衷 提交于 2019-11-29 05:32:37
I have a UIImage view that responds to touch events. I want to cancel the touch sequence, i.e., further calls to touchesMoved: , if the touch goes outside of certain bounds. How can I do that? I know that in touchesMoved: I can inspect the coordinates of the touch object and ignore it, but what I don't know is how to cancel the sequence altogether. I don't see any method documented in the Apple Developer UIResponder Reference that I can call to cancel a touch sequence. This solution may be a bit kludgy, but you could implement and manually call - (void) touchesCancelled:(NSSet *)touches

Why does AppDelegate inherit from UIResponder?

余生颓废 提交于 2019-11-29 02:52:15
问题 I noticed that when creating a new project with the iPhone Master-Detail template in Xcode 4.2 beta 4, it does: // AppDelegate.h @interface AppDelegate : UIResponder <UIApplicationDelegate> Why does AppDelegate inherit from UIResponder instead of NSObject ? 回答1: From Converting to Storyboards Release Notes: Note: In the current Xcode templates, the application delegate class inherits from UIResponder. This is so that the delegate instance can participate in the responder chain and so handle

UITableViewCell skipped in responder chain

馋奶兔 提交于 2019-11-29 00:48:57
问题 I'm attempting to trigger an event in a subview of a UITableViewCell , and let it bubble up the responder chain and be handled by a custom UITableViewCell subclass. Basically: SomeView.m (which is a subview of the UITableViewCell ) [self.button addTarget:nil action:@selector(someAction:) events:UIControlEventTouchUpInside] SomeCustomCell.m - (void)someAction:(id)sender { NSLog(@"cool, the event bubbled up to the cell"); } And to test why this wasn't working, I've added the someAction: method

On iOS, if a superview's userInteractionEnabled is NO, then all subviews are disabled as well?

前提是你 提交于 2019-11-28 00:38:47
I thought when a view is touched or tapped on, its handler get called first, and then its superview's handler is called (propagate upward). But is it true that if the superview's userInteractionEnabled is set to NO, then all subviews and offspring is also disabled for user interaction? What if we want to disable for just the main view but don't want to disable for the subviews? You cant do that, Instead you would change the arrangment of your views like following: Main View-> subViews To Container View -> Main View that you want to set as inactive -> other views that you want to still active

UIWebView without Copy/Paste and selection rectangle when showing documents

﹥>﹥吖頭↗ 提交于 2019-11-27 19:56:03
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:action withSender:sender]; } Now the user no longer can make such operations, however the UIWebView still

InputAccessoryView docked at bottom

我是研究僧i 提交于 2019-11-27 17:15:02
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") at the bottom of the view The proposed solutions: Manually animate the toolbar in response to keyboard

How to effectively process UITouches in a multitouch sequence

我的未来我决定 提交于 2019-11-27 15:52:38
I am working with multitouch while writing, So basically what I am doing is, I am writing with hand support, because typically, its how user writes, I followed this link How to ignore certain UITouch Points in multitouch sequence Everything is working fine with single touch, but their is some problem when I write with my hand touching the screen i.e multiple UItouches Below is my code In touches began, I go through all touches and I find the touch with highest y position, below is my code Below is my code -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* topmostTouch =