简体   繁体   中英

canPerformAction:with sender method called on tap in ios 9

one thing I observed in iOS 9.0 is that when I tap on button or TableView, canPerformMethod:withSender: method is called with sender as UIButton type. I am using this method to prepare my customized option menu.

I did not observed that in previous iOS. Can anyone see me API changes, because I went through overall changes of iOS, but I did not find above mentioned changes in change log or change history.

Per Apple Documentation ,

iOS 3.0 introduced system capabilities for generating motion events, specifically the motion of shaking the device. The event-handling methods for these kinds of events are motionBegan:withEvent:, motionEnded:withEvent:, and motionCancelled:withEvent:. Additionally for iOS 3.0, the canPerformAction:withSender: method allows responders to validate commands in the user interface while the undoManager property returns the nearest NSUndoManager object in the responder chain.

So, all the UIResponder sub classes are entitled to receive a call back for canPerformAction:withSender: . You should use sender parameter to do the handling in this method.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM