基于UIView的menu分类,领导再也不会说我写个菜单效果慢了! 首先恭喜您发现了宝藏!其实这个分类的作用在于帮助开发者开发常见的菜单弹出效果而非菜单效果,开发者只需要专注于菜单本身的UIView开发便可。
备注:开发这一些列分类皆在于提高开发的效率以及改善代码的可读性和重用性,以此献上共勉!
- iOS 7.0 or later
- Xcode 9.0 or later
pod 'GXAlert'
- 其它版本 Swift版本
pod 'GXAlert-Swift'
首先#import "UIView+GXAlertView.h",然后专注于创建你的菜单的view就行,接下来菜单效果就交给GXAlert的扩展方法吧。
/**
* 基于window的alert
*/
- (void)showAlertStyle:(GXAlertStyle)alertStyle;
- (void)showAlertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable;
- (void)showAlertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring;
- (void)showAlertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring tapBlock:(GXAlertBlock)tapBlock;
- (void)showAlertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring tapBlock:(GXAlertBlock)tapBlock dismissBlock:(GXAlertBlock)dismissBlock;
/**
* 基于view的alert
*/
- (void)showToView:(UIView *)view alertStyle:(GXAlertStyle)alertStyle;
- (void)showToView:(UIView *)view alertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable;
- (void)showToView:(UIView *)view alertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring;
- (void)showToView:(UIView *)view alertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring tapBlock:(GXAlertBlock)tapBlock;
- (void)showToView:(UIView *)view alertStyle:(GXAlertStyle)alertStyle backgoundTapDismissEnable:(BOOL)backgoundTapDismissEnable usingSpring:(BOOL)usingSpring tapBlock:(GXAlertBlock)tapBlock dismissBlock:(GXAlertBlock)dismissBlock;
/**
* 手动hide
*/
- (void)hideToView;
- (void)hideToView:(BOOL)animated;
+ (BOOL)hideAlertForView:(UIView *)view;
+ (BOOL)hideAlertForView:(UIView *)view animated:(BOOL)animated;
MIT