帮酷LOGO
0 0 评论
文章标签:POP  BASE  customize  Sheet  VIEW  Alert  
Pop-up based view(e.g. alert sheet), can easily customize.

  • 源代码名称:MMPopupView
  • 源代码网址:http://www.github.com/adad184/MMPopupView
  • MMPopupView源代码文档
  • MMPopupView源代码下载
  • Git URL:
    git://www.github.com/adad184/MMPopupView.git
  • Git Clone代码到本地:
    git clone http://www.github.com/adad184/MMPopupView
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/adad184/MMPopupView
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
  • MMPopupView

    CocoaPodsCocoaPodsCocoaPods

    中文介绍

    基本的弹出工具包允许你轻松创建弹出视图。 你可以将焦点放在你想显示的唯一视图上。

    此外,它有 2个常见的弹出视图,英镑 MMAlertView & /。 你可以轻松使用&自定义它。

    demo

    或者你可以在( 单击图像) 下面查看演示视频。

    youtube

    安装

    安装的首选方式是通过 CocoaPods。 添加

    pod 'MMPopupView'

    运行 pod install 它将安装最新版本的MMPopupView。

    如果你想使用最新的MMPopupView使用代码:

    pod 'MMPopupView', :head
    用法
    //MMAlertViewNSArray *items =
    @[MMItemMake(@"Done", MMItemTypeNormal, block),
     MMItemMake(@"Save", MMItemTypeHighlight, block),
     MMItemMake(@"Cancel", MMItemTypeNormal, block)];
    [[[MMAlertView alloc] initWithTitle:@"AlertView"detail:@"each button take one row if there are more than 2 items"items:items]
     showWithBlock:completeBlock];//MMSheetViewNSArray *items =
    @[MMItemMake(@"Normal", MMItemTypeNormal, block),
     MMItemMake(@"Highlight", MMItemTypeHighlight, block),
     MMItemMake(@"Disabled", MMItemTypeDisabled, block)];
    [[[MMSheetView alloc] initWithTitle:@"SheetView"items:items] showWithBlock:completeBlock];
    MMPopupView

    MMPopupView是设计用于子类化的基本弹出视图。 它提供 3种动画,或者你可以通过覆盖的showAnimation 和英镑hideAnimation提供你自己的动画。

    typedefNS_ENUM(NSUInteger, MMPopupType) {
     MMPopupTypeAlert,
     MMPopupTypeSheet,
     MMPopupTypeCustom,
    };@class MMPopupView;typedefvoid(^MMPopupBlock)(MMPopupView *);typedefvoid(^MMPopupCompletionBlock)(MMPopupView *, BOOL);@interfaceMMPopupView : UIView@property (nonatomic, assign, readonly) BOOL visible; // default is NO.@property (nonatomic, strong ) UIView *attachedView; // default is MMPopupWindow. You can attach MMPopupView to any UIView.@property (nonatomic, assign ) MMPopupType type; // default is MMPopupTypeAlert.@property (nonatomic, assign ) NSTimeInterval animationDuration; // default is 0.3 sec.@property (nonatomic, assign ) BOOL withKeyboard; // default is NO. When YES, alert view with be shown with a center offset (only effect with MMPopupTypeAlert).@property (nonatomic, copy ) MMPopupCompletionBlock showCompletionBlock; // show completion block.@property (nonatomic, copy ) MMPopupCompletionBlock hideCompletionBlock; // hide completion block@property (nonatomic, copy ) MMPopupBlock showAnimation; // custom show animation block.@property (nonatomic, copy ) MMPopupBlock hideAnimation; // custom hide animation block./** * override this method to show the keyboard if with a keyboard*/- (void) showKeyboard;/** * override this method to hide the keyboard if with a keyboard*/- (void) hideKeyboard;/** * show the popup view*/- (void) show;/** * show the popup view with completiom block * * @param block show completion block*/- (void) showWithBlock:(MMPopupBlock)block;/** * hide the popup view*/- (void) hide;/** * hide the popup view with completiom block * * @param block hide completion block*/- (void) hideWithBlock:(MMPopupBlock)block;@end/** * hide all popupview with current class, eg. [MMAlertview hideAll];*/+ (void) hideAll;

    如果你想创建自己的弹出视图,只需从 MMPopupView subclass子类。

    @interfaceYourCustomView : MMPopupView@end

    自定义之后,你可以简单地使用它。

    [YourCustomView show];
    [YourCustomView showWithBlock:completionBlock];
    [YourCustomView hide];
    [YourCustomView hideWithBlock:completionBlock];
    MMAlertView

    英镑的MMAlertView 基于英镑的MMPopupView。

    typedefvoid(^MMPopupInputHandler)(NSString *text);@interfaceMMAlertView : MMPopupView@property (nonatomic, assign) NSUInteger maxInputLength; // default is 0. Means no length limit.- (instancetype) initWithInputTitle:(NSString*)titledetail:(NSString*)detailplaceholder:(NSString*)inputPlaceholderhandler:(MMPopupInputHandler)inputHandler;
    - (instancetype) initWithConfirmTitle:(NSString*)titledetail:(NSString*)detail;
    - (instancetype) initWithTitle:(NSString*)titledetail:(NSString*)detailitems:(NSArray*)items;@end

    英镑MMAlertViewConfig是全球的整体配置,可以通过调整它来完全定制。

    @interfaceMMAlertViewConfig : NSObject+ (MMAlertViewConfig*) globalConfig;@property (nonatomic, assign) CGFloat width; // Default is 275.@property (nonatomic, assign) CGFloat buttonHeight; // Default is 50.@property (nonatomic, assign) CGFloat innerMargin; // Default is 25.@property (nonatomic, assign) CGFloat cornerRadius; // Default is 5.@property (nonatomic, assign) CGFloat titleFontSize; // Default is 18.@property (nonatomic, assign) CGFloat detailFontSize; // Default is 14.@property (nonatomic, assign) CGFloat buttonFontSize; // Default is 17.@property (nonatomic, strong) UIColor *backgroundColor; // Default is #FFFFFF.@property (nonatomic, strong) UIColor *titleColor; // Default is #333333.@property (nonatomic, strong) UIColor *detailColor; // Default is #333333.@property (nonatomic, strong) UIColor *splitColor; // Default is #CCCCCC.@property (nonatomic, strong) UIColor *itemNormalColor; // Default is #333333. effect with MMItemTypeNormal@property (nonatomic, strong) UIColor *itemHighlightColor; // Default is #E76153. effect with MMItemTypeHighlight@property (nonatomic, strong) UIColor *itemPressedColor; // Default is #EFEDE7.@property (nonatomic, strong) NSString *defaultTextOK; // Default is"好".@property (nonatomic, strong) NSString *defaultTextCancel; // Default is"取消".@property (nonatomic, strong) NSString *defaultTextConfirm; // Default is"确定".@end
    MMSheetView

    英镑的MMSheetView 基于英镑的MMPopupView。

    @interfaceMMSheetView : MMPopupView- (instancetype) initWithTitle:(NSString*)titleitems:(NSArray*)items;@end

    英镑MMSheetViewConfig是全球的整体配置,可以通过调整它来完全定制。

    @interfaceMMSheetViewConfig : NSObject+ (MMSheetViewConfig*) globalConfig;@property (nonatomic, assign) CGFloat buttonHeight; // Default is 50.@property (nonatomic, assign) CGFloat innerMargin; // Default is 19.@property (nonatomic, assign) CGFloat titleFontSize; // Default is 14.@property (nonatomic, assign) CGFloat buttonFontSize; // Default is 17.@property (nonatomic, strong) UIColor *backgroundColor; // Default is #FFFFFF.@property (nonatomic, strong) UIColor *titleColor; // Default is #666666.@property (nonatomic, strong) UIColor *splitColor; // Default is #CCCCCC.@property (nonatomic, strong) UIColor *itemNormalColor; // Default is #333333. effect with MMItemTypeNormal@property (nonatomic, strong) UIColor *itemDisableColor; // Default is #CCCCCC. effect with MMItemTypeDisabled@property (nonatomic, strong) UIColor *itemHighlightColor; // Default is #E76153. effect with MMItemTypeHighlight@property (nonatomic, strong) UIColor *itemPressedColor; // Default is #EFEDE7.@property (nonatomic, strong) NSString *defaultTextCancel; // Default is"取消"@end
    变更日志

    v1.7.1修复attachView是主要keyWindow时的黑屏问题。 v1.7添加模糊效果。

    @interfaceUIView (MMPopup)@property (nonatomic, strong, readonly ) UIView *mm_dimBackgroundBlurView;@property (nonatomic, assign ) BOOL mm_dimBackgroundBlurEnabled;@property (nonatomic, assign ) UIBlurEffectStyle mm_dimBackgroundBlurEffectStyle;@end

    : )

    alertView.attachedView = self.view;
    alertView.attachedView.mm_dimBackgroundBlurEnabled = YES;
    alertView.attachedView.mm_dimBackgroundBlurEffectStyle = UIBlurEffectStyleLight;

    v1.6添加'+ hideAll'方法,改进代码结构。

    v1.5.3 touchWildToHide 固定触摸问题

    v1.5.2固定的触摸问题在自定义视图中存在scrollviews时

    v1.5.1固定显示问题

    v1.5固定旋转问题

    v1.4调整动画缓动函数。 重建演示。( @yoavlt) 到

    v1.3 Bug 固定

    v1.2现在你可以通过使用以下命令了解MMPopupView是否可见:

    
    @property (nonatomic, assign, readonly) BOOL visible;//default is NO.
    
    
    
    

    v1.1现在你可以使用以下命令将MMPopupView附加到任何 UIView:

    @property (nonatomic, strong ) UIView *attachedView; // default is MMPopupWindow. You can attach MMPopupView to any UIView.

    v1.0第一个版本



    文章标签:BASE  VIEW  POP  customize  Alert  Sheet  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语