美文网首页
UIReaponser之API分析

UIReaponser之API分析

作者: 漠醉 | 来源:发表于2018-05-14 23:17 被阅读0次

    UIResponder API分析

    介绍:

    UIResponder主要用于事件响应,事件转发以方便用户交互操作

    1.首先UIResponder 实现了UIResponderStandardEditActions协议,协议方法有

    - (void)cut:(nullable id)sender NS_AVAILABLE_IOS(3_0);
    - (void)copy:(nullable id)sender NS_AVAILABLE_IOS(3_0);
    - (void)paste:(nullable id)sender NS_AVAILABLE_IOS(3_0);
    - (void)select:(nullable id)sender NS_AVAILABLE_IOS(3_0);
    - (void)selectAll:(nullable id)sender NS_AVAILABLE_IOS(3_0);
    - (void)delete:(nullable id)sender NS_AVAILABLE_IOS(3_2);
    - (void)makeTextWritingDirectionLeftToRight:(nullable id)sender NS_AVAILABLE_IOS(5_0);
    - (void)makeTextWritingDirectionRightToLeft:(nullable id)sender NS_AVAILABLE_IOS(5_0);
    - (void)toggleBoldface:(nullable id)sender NS_AVAILABLE_IOS(6_0);
    - (void)toggleItalics:(nullable id)sender NS_AVAILABLE_IOS(6_0);
    - (void)toggleUnderline:(nullable id)sender NS_AVAILABLE_IOS(6_0);
    
    - (void)increaseSize:(nullable id)sender NS_AVAILABLE_IOS(7_0);
    - (void)decreaseSize:(nullable id)sender NS_AVAILABLE_IOS(7_0);
    

    可以配合UIMenuController实现子类控件的复制、粘贴删除等操作,也可以自定义UIMenuItem实现自己的功能,再使用时要注意- (BOOL)canBecomeFirstResponder;方法和- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender NS_AVAILABLE_IOS(3_0);方法。具体参照UIMenuController和UIResponderStandardEditActions分析

    相关文章

      网友评论

          本文标题:UIReaponser之API分析

          本文链接:https://www.haomeiwen.com/subject/zzdsdftx.html