{"id":13743347,"url":"https://github.com/Friend-LGA/LGAlertView","last_synced_at":"2025-05-09T01:30:49.474Z","repository":{"id":34108753,"uuid":"37937411","full_name":"Friend-LGA/LGAlertView","owner":"Friend-LGA","description":"Customizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one. You can customize every detail. Make AlertView of your dream! :)","archived":false,"fork":false,"pushed_at":"2024-09-06T21:49:53.000Z","size":1784,"stargazers_count":1065,"open_issues_count":25,"forks_count":212,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-11-05T03:36:25.708Z","etag":null,"topics":["action-sheet","actionsheet","alert-view","alert-view-controller","alertview","alertviewcontroller","carthage","cocoapods","ios","lgalertview","objective-c","swift"],"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/Friend-LGA.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,"governance":null}},"created_at":"2015-06-23T18:33:04.000Z","updated_at":"2024-10-17T02:34:37.000Z","dependencies_parsed_at":"2022-07-29T20:19:53.249Z","dependency_job_id":"c9891439-ffa8-4c8f-8d9b-8f4eb9c7362d","html_url":"https://github.com/Friend-LGA/LGAlertView","commit_stats":{"total_commits":66,"total_committers":7,"mean_commits":9.428571428571429,"dds":"0.36363636363636365","last_synced_commit":"06c5c0608c93b4f23f9253858d67133652dc43d4"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGAlertView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGAlertView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGAlertView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Friend-LGA%2FLGAlertView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Friend-LGA","download_url":"https://codeload.github.com/Friend-LGA/LGAlertView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224194201,"owners_count":17271431,"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":["action-sheet","actionsheet","alert-view","alert-view-controller","alertview","alertviewcontroller","carthage","cocoapods","ios","lgalertview","objective-c","swift"],"created_at":"2024-08-03T05:00:45.013Z","updated_at":"2024-11-15T14:31:14.456Z","avatar_url":"https://github.com/Friend-LGA.png","language":"Objective-C","readme":"# LGAlertView\n\nCustomizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one.\nYou can customize every detail. Make AlertView of your dream! :)\n\n[![Platform](https://img.shields.io/cocoapods/p/LGAlertView.svg)](https://github.com/Friend-LGA/LGAlertView)\n[![CocoaPods](https://img.shields.io/cocoapods/v/LGAlertView.svg)](http://cocoadocs.org/docsets/LGAlertView)\n[![Carthage](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Friend-LGA/LGAlertView)\n[![License](http://img.shields.io/cocoapods/l/LGAlertView.svg)](https://raw.githubusercontent.com/Friend-LGA/LGAlertView/master/LICENSE)\n\n## Preview\n\n### Default Alert View\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/Preview.gif\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/3.png\" height=\"360\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/4.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/5.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/6.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/7.png\" height=\"360\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/8.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/9.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/10.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/11.png\" height=\"360\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/12.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Alert_View/13.png\" height=\"360\"/\u003e\n\n### Default Action Sheet\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/Preview.gif\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/3.png\" height=\"360\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/4.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/5.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/6.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/7.png\" height=\"360\"/\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Default_Action_Sheet/8.png\" height=\"360\"/\u003e\n\n### Blurred Alert View\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Alert_View/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Alert_View/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Alert_View/3.png\" height=\"360\"/\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Alert_View/4.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Alert_View/5.png\" height=\"360\"/\u003e\n\n### Blurred Action Sheet\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Action_Sheet/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Action_Sheet/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Action_Sheet/3.png\" height=\"360\"/\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Action_Sheet/4.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Blurred_Action_Sheet/5.png\" height=\"360\"/\u003e\n\n### Custom Alert View\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Alert_View/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Alert_View/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Alert_View/3.png\" height=\"360\"/\u003e\n\n### Custom Action Sheet\n\n\u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Action_Sheet/1.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Action_Sheet/2.png\" height=\"360\"/\u003e \u003cimg src=\"https://raw.githubusercontent.com/Friend-LGA/ReadmeFiles/e86caa0a37236d03642747a379f4a92f5384c317/LGAlertView/Custom_Action_Sheet/3.png\" height=\"360\"/\u003e\n\n\u003e Screenshots above are just few examples that you can achieve, you are free to create any other style\n\n## Installation\n\n| LGAlertView version | iOS version |\n|---------------------|-------------|\n| \u003c= 2.0.13           | \u003e= 6.0      |\n| \u003e= 2.1.0            | \u003e= 8.0      |\n\n### With source code\n\n[Download repository](https://github.com/Friend-LGA/LGAlertView/archive/master.zip), then add [LGAlertView directory](https://github.com/Friend-LGA/LGAlertView/blob/master/LGAlertView/) to your project.\n\nThen import header files where you need to use the library\n\n##### Objective-C\n\n```objective-c\n#import \"LGAlertView.h\"\n```\n\n##### Swift\n\nFor swift you need to create [bridging header](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)\n\n```objective-c\n// BridgingHeader.h\n#import \"LGAlertView.h\"\n```\n\n### With CocoaPods\n\nCocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. To install with cocoaPods, follow the \"Get Started\" section on [CocoaPods](https://cocoapods.org/).\n\n#### Podfile\n\n```ruby\nplatform :ios, '8.0'\nuse_frameworks!\npod 'LGAlertView'\n```\n\nThen import framework where you need to use the library\n\n##### Objective-C\n\n```objective-c\n#import \u003cLGAlertView/LGAlertView.h\u003e\n// OR\n@import LGAlertView;\n```\n\n##### Swift\n\n```swift\nimport LGAlertView\n```\n\n### With Carthage\n\nCarthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage/).\n\n#### Cartfile\n```\ngithub \"Friend-LGA/LGAlertView\"\n```\n\nThen import framework where you need to use the library\n\n##### Objective-C\n\n```objective-c\n#import \u003cLGAlertView/LGAlertView.h\u003e\n// OR\n@import LGAlertView;\n```\n\n##### Swift\n\n```swift\nimport LGAlertView\n```\n\n## Usage\n\n### Initialization\n\nYou have several methods for initialization:\n\n##### Objective-C\n\n```objective-c\n- (nonnull instancetype)initWithTitle:(nullable NSString *)title\n                              message:(nullable NSString *)message\n                                style:(LGAlertViewStyle)style\n                         buttonTitles:(nullable NSArray\u003cNSString *\u003e *)buttonTitles\n                    cancelButtonTitle:(nullable NSString *)cancelButtonTitle\n               destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;\n\n- (nonnull instancetype)initWithViewAndTitle:(nullable NSString *)title\n                                     message:(nullable NSString *)message\n                                       style:(LGAlertViewStyle)style\n                                        view:(nullable UIView *)view\n                                buttonTitles:(nullable NSArray\u003cNSString *\u003e *)buttonTitles\n                           cancelButtonTitle:(nullable NSString *)cancelButtonTitle\n                      destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;\n\n- (nonnull instancetype)initWithActivityIndicatorAndTitle:(nullable NSString *)title\n                                                  message:(nullable NSString *)message\n                                                    style:(LGAlertViewStyle)style\n                                             buttonTitles:(nullable NSArray\u003cNSString *\u003e *)buttonTitles\n                                        cancelButtonTitle:(nullable NSString *)cancelButtonTitle\n                                   destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;\n\n- (nonnull instancetype)initWithProgressViewAndTitle:(nullable NSString *)title\n                                             message:(nullable NSString *)message\n                                               style:(LGAlertViewStyle)style\n                                   progressLabelText:(nullable NSString *)progressLabelText\n                                        buttonTitles:(nullable NSArray\u003cNSString *\u003e *)buttonTitles\n                                   cancelButtonTitle:(nullable NSString *)cancelButtonTitle\n                              destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;\n\n- (nonnull instancetype)initWithTextFieldsAndTitle:(nullable NSString *)title\n                                           message:(nullable NSString *)message\n                                numberOfTextFields:(NSUInteger)numberOfTextFields\n                            textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler\n                                      buttonTitles:(nullable NSArray\u003cNSString *\u003e *)buttonTitles\n                                 cancelButtonTitle:(nullable NSString *)cancelButtonTitle\n                            destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;\n```\n\n##### Swift\n\n```swift\npublic init(title: String?,\n          message: String?,\n            style: LGAlertViewStyle,\n     buttonTitles: [String]?,\ncancelButtonTitle: String?,\ndestructiveButtonTitle: String?)\n\npublic init(viewAndTitle title: String?,\n                       message: String?,\n                         style: LGAlertViewStyle,\n                          view: UIView?,\n                  buttonTitles: [String]?,\n             cancelButtonTitle: String?,\n        destructiveButtonTitle: String?)\n\npublic init(activityIndicatorAndTitle title: String?,\n                                    message: String?,\n                                      style: LGAlertViewStyle,\n                               buttonTitles: [String]?,\n                          cancelButtonTitle: String?,\n                     destructiveButtonTitle: String?)\n\npublic init(progressViewAndTitle title: String?,\n                               message: String?,\n                                 style: LGAlertViewStyle,\n                     progressLabelText: String?,\n                          buttonTitles: [String]?,\n                     cancelButtonTitle: String?,\n                destructiveButtonTitle: String?)\n\npublic init(textFieldsAndTitle title: String?,\n                             message: String?,\n                  numberOfTextFields: UInt,\n              textFieldsSetupHandler: LGAlertView.LGAlertViewTextFieldsSetupHandler?,\n                        buttonTitles: [String]?,\n                   cancelButtonTitle: String?,\n              destructiveButtonTitle: String?)\n```\n\nMore init methods you can find in [LGAlertView.h](https://github.com/Friend-LGA/LGAlertView/blob/master/LGAlertView/LGAlertView.h)\n\n### Setup\n\nYou can change properties only before you show alert view, after this to change something is impossible.\n\n### Appearance\n\nInstead of change properties for every new alert view, you can use `appearance` to set them all only once and\nnew alert views will use it by default:\n\n##### Objective-C\n\n```objective-c\n[LGAlertView appearance].tintColor = UIColor.greenColor;\n[LGAlertView appearance].cancelOnTouch = NO;\n[LGAlertView appearance].dismissOnAction = NO;\n[LGAlertView appearance]...\n[LGAlertView appearance]...\n```\n\n##### Swift\n\n```swift\nLGAlertView.appearance().tintColor = .green\nLGAlertView.appearance().cancelOnTouch = false\nLGAlertView.appearance().dismissOnAction = false\nLGAlertView.appearance()...\nLGAlertView.appearance()...\n```\n\n### Action Sheet Safe Area\n\nBy default `LGAlertView` with `LGAlertViewStyleActionSheet` style doesn't use safe area insets.\nSo for now it's up to you to set the offset, and it as easy as this:\n\n##### Objective-C\n\n```objective-c\nif (@available(iOS 11.0, *)) {\n    [LGAlertView appearance].cancelButtonOffsetY = UIApplication.sharedApplication.windows.firstObject.safeAreaInsets.bottom;\n}\n```\n\n##### Swift\n\n```swift\nif #available(iOS 11.0, *) {\n    LGAlertView.appearance().cancelButtonOffsetY = UIApplication.sharedApplication.windows.firstObject.safeAreaInsets.bottom\n}\n```\n\n### Buttons\n\nIf you want to set properties for each button individually, you can use method:\n\n##### Objective-C\n\n```objective-c\n- (void)setButtonPropertiesAtIndex:(NSUInteger)index handler:(void(^ _Nonnull)(LGAlertViewButtonProperties * _Nonnull properties))handler;\n\n[alertView setButtonPropertiesAtIndex:0 handler:^(LGAlertViewButtonProperties * _Nonnull properties) {\n    properties.titleColor = UIColor.yellowColor;\n    properties.image = [UIImage imageNamed:@\"SuperImage\"];\n    // properties...\n    // properties...\n}];\n```\n\n##### Swift\n\n```swift\nopen func setButtonPropertiesAt(_ index: UInt, handler: @escaping (LGAlertViewButtonProperties) -\u003e Swift.Void)\n\nalertView.setButtonPropertiesAt(0) { (properties: LGAlertViewButtonProperties) in\n    properties.titleColor = .yellow\n    properties.image = UIImage(named: \"SuperImage\")\n    // properties...\n    // properties...\n}\n```\n\n#### Enable / Disable\n\nYou can enable and disable buttons:\n\n##### Objective-C\n\n```objective-c\nalertView.cancelButtonEnabled = YES;\nalertView.destructiveButtonEnabled = YES;\n[alertView setButtonEnabled:YES atIndex:0];\n```\n\n##### Swift\n\n```swift\nalertView.cancelButtonEnabled = true\nalertView.destructiveButtonEnabled = true\nalertView.setButtonEnabled(true, index: 0)\n```\n\n### Retain Cycle\n\nWhen you use blocks and if you need to use `self` inside it, then you need to make weak reference to `self` to avoid retain cycle:\n\n##### Objective-C\n\n```objective-c\n__weak typeof(self) wself = self;\n\nalertView.cancelHandler = ^(LGAlertView *alertView) {\n    __strong typeof(wself) sself = wself;\n\n    [sself someMethod];\n};\n```\n\n##### Swift\n\n```swift\nalertView.cancelHandler = { [unowned self](alertView: LGAlertView) in\n    self.someMethod()\n}\n```\n\n### Blur\n\nYou can use UIBlurEffect with next properties:\n\n```objective-c\nUIBlurEffect *coverBlurEffect;\n```\n\nFor example:\n\n##### Objective-C\n\n```objective-c\nalertView.coverBlurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];\n```\n\n##### Swift\n\n```swift\nalertView.coverBlurEffect = UIBlurEffect(style: .regular)\n```\n\nIf you want to change color of blurred view, use:\n\n```objective-c\nUIColor *coverColor;\n```\n\nFor example:\n\n##### Objective-C\n\n```objective-c\nalertView.coverColor = [UIColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.1];\n```\n\n##### Swift\n\n```swift\nalertView.coverColor = UIColor(red: 0.0, green: 0.5, blue: 1.0, alpha: 0.1)\n```\n\nIf you want to change intensity of blurred view, use:\n\n```objective-c\nCGFloat coverAlpha;\n```\n\nFor example:\n\n```objective-c\nalertView.coverAlpha = 0.9;\n```\n\n### Handle actions\n\nTo handle actions you can use blocks, delegate or notifications:\n\n#### Delegate\n\n##### Objective-C\n\n```objective-c\n\u003cLGAlertViewDelegate\u003e\n\n@optional\n\n- (void)alertViewWillShow:(nonnull LGAlertView *)alertView;\n- (void)alertViewDidShow:(nonnull LGAlertView *)alertView;\n\n- (void)alertViewWillDismiss:(nonnull LGAlertView *)alertView;\n- (void)alertViewDidDismiss:(nonnull LGAlertView *)alertView;\n\n- (void)alertView:(nonnull LGAlertView *)alertView clickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;\n- (void)alertViewCancelled:(nonnull LGAlertView *)alertView;\n- (void)alertViewDestructed:(nonnull LGAlertView *)alertView;\n\n- (void)alertView:(nonnull LGAlertView *)alertView didDismissAfterClickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;\n- (void)alertViewDidDismissAfterCancelled:(nonnull LGAlertView *)alertView;\n- (void)alertViewDidDismissAfterDestructed:(nonnull LGAlertView *)alertView;\n\n- (void)showAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;\n- (void)dismissAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;\n```\n\n##### Swift\n\n```swift\n\u003cLGAlertViewDelegate\u003e\n\noptional public func alertViewWillShow(_ alertView: LGAlertView)\noptional public func alertViewDidShow(_ alertView: LGAlertView)\n\noptional public func alertViewWillDismiss(_ alertView: LGAlertView)\noptional public func alertViewDidDismiss(_ alertView: LGAlertView)\n\noptional public func alertView(_ alertView: LGAlertView, clickedButtonAtIndex index: UInt, title: String?)\noptional public func alertViewCancelled(_ alertView: LGAlertView)\noptional public func alertViewDestructed(_ alertView: LGAlertView)\n\noptional public func alertView(_ alertView: LGAlertView, didDismissAfterClickedButtonAtIndex index: UInt, title: String?)\noptional public func alertViewDidDismissAfterCancelled(_ alertView: LGAlertView)\noptional public func alertViewDidDismissAfterDestructed(_ alertView: LGAlertView)\n\noptional public func showAnimationsForAlertView(_ alertView: LGAlertView, duration: NSTimeInterval)\noptional public func dismissAnimationsForAlertView(_ alertView: LGAlertView, duration: NSTimeInterval)\n```\n\n#### Blocks\n\n##### Objective-C\n\n```objective-c\nvoid(^ _Nullable willShowHandler)(LGAlertView * _Nonnull alertView);\n\nvoid(^ _Nullable willShowHandler)(LGAlertView * _Nonnull alertView);\nvoid(^ _Nullable didShowHandler)(LGAlertView * _Nonnull alertView);\n\nvoid(^ _Nullable willDismissHandler)(LGAlertView * _Nonnull alertView);\nvoid(^ _Nullable didDismissHandler)(LGAlertView * _Nonnull alertView);\n\nvoid(^ _Nullable actionHandler)(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title);\nvoid(^ _Nullable cancelHandler)(LGAlertView * _Nonnull alertView);\nvoid(^ _Nullable destructiveHandler)(LGAlertView * _Nonnull alertView);\n\nvoid(^ _Nullable didDismissAfterActionHandler)(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title);\nvoid(^ _Nullable didDismissAfterCancelHandler)(LGAlertView * _Nonnull alertView);\nvoid(^ _Nullable didDismissAfterDestructiveHandler)(LGAlertView * _Nonnull alertView);\n\nvoid(^ _Nullable showAnimationsBlock)(LGAlertView * _Nonnull alertView, NSTimeInterval duration);\nvoid(^ _Nullable dismissAnimationsBlock)(LGAlertView * _Nonnull alertView, NSTimeInterval duration);\n```\n\n##### Swift\n\n```swift\nopen var willShowHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\nopen var didShowHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\n\nopen var willDismissHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\nopen var didDismissHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\n\nopen var actionHandler: ((alertView: LGAlertView, index: NSUInteger, title: NSString) -\u003e Swift.Void)?\nopen var cancelHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\nopen var destructiveHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\n\nopen var didDismissAfterActionHandler: ((alertView: LGAlertView, index: NSUInteger, title: NSString) -\u003e Swift.Void)?\nopen var didDismissAfterCancelHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\nopen var didDismissAfterDestructiveHandler: ((alertView: LGAlertView) -\u003e Swift.Void)?\n\nopen var showAnimationsBlock: ((alertView: LGAlertView, duration: NSTimeInterval) -\u003e Swift.Void)?\nopen var dismissAnimationsBlock: ((alertView: LGAlertView, duration: NSTimeInterval) -\u003e Swift.Void)?\n```\n\n#### Notifications\n\n```\nLGAlertViewWillShowNotification\nLGAlertViewDidShowNotification\n\nLGAlertViewWillDismissNotification\nLGAlertViewDidDismissNotification\n\nLGAlertViewActionNotification\nLGAlertViewCancelNotification\nLGAlertViewDestructiveNotification\n\nLGAlertViewDidDismissAfterActionNotification;\nLGAlertViewDidDismissAfterCancelNotification;\nLGAlertViewDidDismissAfterDestructiveNotification;\n\nLGAlertViewShowAnimationsNotification;\nLGAlertViewDismissAnimationsNotification;\n```\n\n### More\n\nFor more details try Xcode [Demo project](https://github.com/Friend-LGA/LGAlertView/blob/master/Demo) and see [LGAlertView.h](https://github.com/Friend-LGA/LGAlertView/blob/master/LGAlertView/LGAlertView.h)\n\n## Frameworks\n\nIf you like LGAlertView, check out my other useful libraries:\n* [LGSideMenuController](https://github.com/Friend-LGA/LGSideMenuController)\n  iOS view controller, shows left and right views by pressing button or gesture.\n* [LGPlusButtonsView](https://github.com/Friend-LGA/LGPlusButtonsView)\n  Customizable iOS implementation of Floating Action Button (Google Plus Button, fab).\n\n## License\n\nLGAlertView is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/Friend-LGA/LGAlertView/master/LICENSE) for details.\n","funding_links":[],"categories":["Objective-C  Stars 1000以内排名整理"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFriend-LGA%2FLGAlertView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFriend-LGA%2FLGAlertView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFriend-LGA%2FLGAlertView/lists"}