{"id":2683,"url":"https://github.com/adad184/MMPopupView","last_synced_at":"2025-08-03T00:32:23.796Z","repository":{"id":51972738,"uuid":"41982294","full_name":"adad184/MMPopupView","owner":"adad184","description":"Pop-up based view(e.g. alert sheet), can be easily customized.","archived":false,"fork":false,"pushed_at":"2022-05-17T05:16:02.000Z","size":996,"stargazers_count":2107,"open_issues_count":46,"forks_count":374,"subscribers_count":65,"default_branch":"master","last_synced_at":"2024-05-17T03:04:14.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adad184.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-06T01:41:35.000Z","updated_at":"2024-05-14T03:24:45.000Z","dependencies_parsed_at":"2022-08-27T02:28:24.264Z","dependency_job_id":null,"html_url":"https://github.com/adad184/MMPopupView","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adad184%2FMMPopupView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adad184%2FMMPopupView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adad184%2FMMPopupView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adad184%2FMMPopupView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adad184","download_url":"https://codeload.github.com/adad184/MMPopupView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215439505,"owners_count":15879575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:20.083Z","updated_at":"2024-08-15T04:30:30.350Z","avatar_url":"https://github.com/adad184.png","language":"Objective-C","readme":"MMPopupView\n=============\n[![CocoaPods](https://img.shields.io/cocoapods/v/MMPopupView.svg)]()\n[![CocoaPods](https://img.shields.io/cocoapods/p/MMPopupView.svg)]()\n[![CocoaPods](https://img.shields.io/cocoapods/l/MMPopupView.svg)]()\n\n[中文介绍](http://adad184.com/2015/09/08/opensource-mmpopupview/)\n\nA basic Pop-Up Kit allows you to easily create Pop-Up view. You can focus on the only view you want to show.\n\nBesides, it comes with 2 common Pop-Up view, **MMAlertView** \u0026  **MMSheetView**. You can easily use \u0026 customize it.\n\n![demo](https://github.com/adad184/MMPopupView/blob/master/Images/0.jpg)\n\nor you can check the demo video below(click the image).\n\n[![youtube](https://github.com/adad184/MMPopupView/blob/master/Images/7.jpg)](https://www.youtube.com/watch?v=GiesTuusKCY)\n\n\nInstallation\n============\n\nThe preferred way of installation is via [CocoaPods](http://cocoapods.org). Just add\n\n```ruby\npod 'MMPopupView'\n```\n\nand run `pod install`. It will install the most recent version of MMPopupView.\n\nIf you would like to use the latest code of MMPopupView use:\n\n```ruby\npod 'MMPopupView', :head\n```\n\nUsage\n===============\n```objc\n//MMAlertView\nNSArray *items =\n@[MMItemMake(@\"Done\", MMItemTypeNormal, block),\n  MMItemMake(@\"Save\", MMItemTypeHighlight, block),\n  MMItemMake(@\"Cancel\", MMItemTypeNormal, block)];\n\n[[[MMAlertView alloc] initWithTitle:@\"AlertView\"\n                             detail:@\"each button take one row if there are more than 2 items\"\n                              items:items]\n showWithBlock:completeBlock];\n\n//MMSheetView\nNSArray *items =\n@[MMItemMake(@\"Normal\", MMItemTypeNormal, block),\n  MMItemMake(@\"Highlight\", MMItemTypeHighlight, block),\n  MMItemMake(@\"Disabled\", MMItemTypeDisabled, block)];\n\n[[[MMSheetView alloc] initWithTitle:@\"SheetView\"\n              items:items] showWithBlock:completeBlock];\n```\n\nMMPopupView\n===============\n\nMMPopupView is a basic Pop-Up view designed to be subclassed.\nIt provide 3 kind of animations(alert, sheet, drop), or you can provide your own animation by override the **showAnimation** and **hideAnimation**.\n\n```objc\ntypedef NS_ENUM(NSUInteger, MMPopupType) {\n    MMPopupTypeAlert,\n    MMPopupTypeSheet,\n    MMPopupTypeCustom,\n};\n\n@class MMPopupView;\n\ntypedef void(^MMPopupBlock)(MMPopupView *);\ntypedef void(^MMPopupCompletionBlock)(MMPopupView *, BOOL);\n\n@interface MMPopupView : UIView\n\n@property (nonatomic, assign, readonly) BOOL           visible;             // default is NO.\n\n@property (nonatomic, strong          ) UIView         *attachedView;       // default is MMPopupWindow. You can attach MMPopupView to any UIView.\n\n@property (nonatomic, assign          ) MMPopupType    type;                // default is MMPopupTypeAlert.\n@property (nonatomic, assign          ) NSTimeInterval animationDuration;   // default is 0.3 sec.\n@property (nonatomic, assign          ) BOOL           withKeyboard;        // default is NO. When YES, alert view with be shown with a center offset (only effect with MMPopupTypeAlert).\n\n@property (nonatomic, copy            ) MMPopupCompletionBlock   showCompletionBlock; // show completion block.\n@property (nonatomic, copy            ) MMPopupCompletionBlock   hideCompletionBlock; // hide completion block\n\n@property (nonatomic, copy            ) MMPopupBlock   showAnimation;       // custom show animation block.\n@property (nonatomic, copy            ) MMPopupBlock   hideAnimation;       // custom hide animation block.\n\n/**\n *  override this method to show the keyboard if with a keyboard\n */\n- (void) showKeyboard;\n\n/**\n *  override this method to hide the keyboard if with a keyboard\n */\n- (void) hideKeyboard;\n\n\n/**\n *  show the popup view\n */\n- (void) show;\n\n/**\n *  show the popup view with completiom block\n *\n *  @param block show completion block\n */\n- (void) showWithBlock:(MMPopupBlock)block;\n\n/**\n *  hide the popup view\n */\n- (void) hide;\n\n/**\n *  hide the popup view with completiom block\n *\n *  @param block hide completion block\n */\n- (void) hideWithBlock:(MMPopupBlock)block;\n\n@end\n\n/**\n *  hide all popupview with current class, eg. [MMAlertview hideAll];\n */\n+ (void) hideAll;\n```\n\nIf you want to create your own Pop-Up view,simply you only need to subclass from **MMPopupView**.\n\n```objc\n\n@interface YourCustomView : MMPopupView\n\n@end\n\n```\n\nafter you customize it, you can simply use it.\n\n```objc\n\n\n[YourCustomView show];\n[YourCustomView showWithBlock:completionBlock];\n\n[YourCustomView hide];\n[YourCustomView hideWithBlock:completionBlock];\n\n```\n\nMMAlertView\n===============\n**MMAlertView** is based on **MMPopupView**.\n\n```objc\ntypedef void(^MMPopupInputHandler)(NSString *text);\n\n@interface MMAlertView : MMPopupView\n\n@property (nonatomic, assign) NSUInteger maxInputLength;    // default is 0. Means no length limit.\n\n- (instancetype) initWithInputTitle:(NSString*)title\n                             detail:(NSString*)detail\n                        placeholder:(NSString*)inputPlaceholder\n                            handler:(MMPopupInputHandler)inputHandler;\n\n- (instancetype) initWithConfirmTitle:(NSString*)title\n                               detail:(NSString*)detail;\n\n- (instancetype) initWithTitle:(NSString*)title\n                        detail:(NSString*)detail\n                         items:(NSArray*)items;\n@end\n```\n\n**MMAlertViewConfig** is the global configuration of **MMAlertView**, you can fully customize by adjust it.\n\n```objc\n@interface MMAlertViewConfig : NSObject\n\n+ (MMAlertViewConfig*) globalConfig;\n\n@property (nonatomic, assign) CGFloat width;                // Default is 275.\n@property (nonatomic, assign) CGFloat buttonHeight;         // Default is 50.\n@property (nonatomic, assign) CGFloat innerMargin;          // Default is 25.\n@property (nonatomic, assign) CGFloat cornerRadius;         // Default is 5.\n\n@property (nonatomic, assign) CGFloat titleFontSize;        // Default is 18.\n@property (nonatomic, assign) CGFloat detailFontSize;       // Default is 14.\n@property (nonatomic, assign) CGFloat buttonFontSize;       // Default is 17.\n\n@property (nonatomic, strong) UIColor *backgroundColor;     // Default is #FFFFFF.\n@property (nonatomic, strong) UIColor *titleColor;          // Default is #333333.\n@property (nonatomic, strong) UIColor *detailColor;         // Default is #333333.\n@property (nonatomic, strong) UIColor *splitColor;          // Default is #CCCCCC.\n\n@property (nonatomic, strong) UIColor *itemNormalColor;     // Default is #333333. effect with MMItemTypeNormal\n@property (nonatomic, strong) UIColor *itemHighlightColor;  // Default is #E76153. effect with MMItemTypeHighlight\n@property (nonatomic, strong) UIColor *itemPressedColor;    // Default is #EFEDE7.\n\n@property (nonatomic, strong) NSString *defaultTextOK;      // Default is \"好\".\n@property (nonatomic, strong) NSString *defaultTextCancel;  // Default is \"取消\".\n@property (nonatomic, strong) NSString *defaultTextConfirm; // Default is \"确定\".\n\n@end\n```\n\nMMSheetView\n===============\n**MMSheetView** is based on **MMPopupView**.\n\n\n```objc\n@interface MMSheetView : MMPopupView\n\n- (instancetype) initWithTitle:(NSString*)title\n                         items:(NSArray*)items;\n\n@end\n```\n\n**MMSheetViewConfig** is the global configuration of **MMAlertView**, you can fully customize by adjust it.\n\n```objc\n@interface MMSheetViewConfig : NSObject\n\n+ (MMSheetViewConfig*) globalConfig;\n\n@property (nonatomic, assign) CGFloat buttonHeight;         // Default is 50.\n@property (nonatomic, assign) CGFloat innerMargin;          // Default is 19.\n\n@property (nonatomic, assign) CGFloat titleFontSize;        // Default is 14.\n@property (nonatomic, assign) CGFloat buttonFontSize;       // Default is 17.\n\n@property (nonatomic, strong) UIColor *backgroundColor;     // Default is #FFFFFF.\n@property (nonatomic, strong) UIColor *titleColor;          // Default is #666666.\n@property (nonatomic, strong) UIColor *splitColor;          // Default is #CCCCCC.\n\n@property (nonatomic, strong) UIColor *itemNormalColor;     // Default is #333333. effect with MMItemTypeNormal\n@property (nonatomic, strong) UIColor *itemDisableColor;    // Default is #CCCCCC. effect with MMItemTypeDisabled\n@property (nonatomic, strong) UIColor *itemHighlightColor;  // Default is #E76153. effect with MMItemTypeHighlight\n@property (nonatomic, strong) UIColor *itemPressedColor;    // Default is #EFEDE7.\n\n@property (nonatomic, strong) NSString *defaultTextCancel;  // Default is \"取消\"\n\n@end\n```\n\n\nChangelog\n===============\nv1.7.1  Fix black screen problem when attachView is the main keyWindow.\nv1.7    Add blur effect.\n\n```objc\n@interface UIView (MMPopup)\n@property (nonatomic, strong, readonly ) UIView            *mm_dimBackgroundBlurView;\n@property (nonatomic, assign           ) BOOL              mm_dimBackgroundBlurEnabled;\n@property (nonatomic, assign           ) UIBlurEffectStyle mm_dimBackgroundBlurEffectStyle;\n@end\n```\ne.g.\n```objc\nalertView.attachedView = self.view;\nalertView.attachedView.mm_dimBackgroundBlurEnabled = YES;\nalertView.attachedView.mm_dimBackgroundBlurEffectStyle = UIBlurEffectStyleLight;\n```\n\nv1.6    Add '+ hideAll' method, improve code struct.\n\nv1.5.3  Fixed touch problem with `touchWildToHide`\n\nv1.5.2  Fixed touch problem when there are scrollviews in custom view\n\nv1.5.1  Fixed showing problem\n\nv1.5    Fixed rotation problem\n\nv1.4    Adjust animation easing function. Rebuild the demo.(thx to @yoavlt)\n\nv1.3    Bug fixed\n\nv1.2    Now you could know whether MMPopupView is visible by using:\n\n```\n@property (nonatomic, assign, readonly) BOOL           visible;             // default is NO.\n```\n\n\nv1.1  Now you can attached MMPopupView to any UIView you want by using:\n\n```objc\n@property (nonatomic, strong          ) UIView         *attachedView; // default is MMPopupWindow. You can attach MMPopupView to any UIView.\n```\n\nv1.0  first version\n","funding_links":[],"categories":["UI","awesome-ios ##","Objective-C","OOM-Leaks-Crash","Minor"],"sub_categories":["Popup","Layout","Other free courses","Menu-PopupView","Pop Up"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadad184%2FMMPopupView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadad184%2FMMPopupView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadad184%2FMMPopupView/lists"}