Giter Site home page Giter Site logo

friend-lga / lgalertview Goto Github PK

View Code? Open in Web Editor NEW
1.1K 31.0 210.0 1.75 MB

Customizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one. You can customize every detail. Make AlertView of your dream! :)

License: MIT License

Objective-C 99.22% Ruby 0.27% C 0.51%
ios objective-c swift cocoapods carthage alertviewcontroller alert-view-controller alertview alert-view actionsheet

lgalertview's Introduction

LGAlertView

Customizable implementation of UIAlertViewController, UIAlertView and UIActionSheet. All in one. You can customize every detail. Make AlertView of your dream! :)

Platform CocoaPods Carthage License

Preview

Default Alert View

Default Action Sheet

Blurred Alert View

Blurred Action Sheet

Custom Alert View

Custom Action Sheet

Screenshots above are just few examples that you can achieve, you are free to create any other style

Installation

LGAlertView version iOS version
<= 2.0.13 >= 6.0
>= 2.1.0 >= 8.0

With source code

Download repository, then add LGAlertView directory to your project.

Then import header files where you need to use the library

Objective-C
#import "LGAlertView.h"
Swift

For swift you need to create bridging header

// BridgingHeader.h
#import "LGAlertView.h"

With CocoaPods

CocoaPods 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.

Podfile

platform :ios, '8.0'
use_frameworks!
pod 'LGAlertView'

Then import framework where you need to use the library

Objective-C
#import <LGAlertView/LGAlertView.h>
// OR
@import LGAlertView;
Swift
import LGAlertView

With Carthage

Carthage 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.

Cartfile

github "Friend-LGA/LGAlertView"

Then import framework where you need to use the library

Objective-C
#import <LGAlertView/LGAlertView.h>
// OR
@import LGAlertView;
Swift
import LGAlertView

Usage

Initialization

You have several methods for initialization:

Objective-C
- (nonnull instancetype)initWithTitle:(nullable NSString *)title
                              message:(nullable NSString *)message
                                style:(LGAlertViewStyle)style
                         buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
                    cancelButtonTitle:(nullable NSString *)cancelButtonTitle
               destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;

- (nonnull instancetype)initWithViewAndTitle:(nullable NSString *)title
                                     message:(nullable NSString *)message
                                       style:(LGAlertViewStyle)style
                                        view:(nullable UIView *)view
                                buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
                           cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                      destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;

- (nonnull instancetype)initWithActivityIndicatorAndTitle:(nullable NSString *)title
                                                  message:(nullable NSString *)message
                                                    style:(LGAlertViewStyle)style
                                             buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
                                        cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                                   destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;

- (nonnull instancetype)initWithProgressViewAndTitle:(nullable NSString *)title
                                             message:(nullable NSString *)message
                                               style:(LGAlertViewStyle)style
                                   progressLabelText:(nullable NSString *)progressLabelText
                                        buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
                                   cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                              destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;

- (nonnull instancetype)initWithTextFieldsAndTitle:(nullable NSString *)title
                                           message:(nullable NSString *)message
                                numberOfTextFields:(NSUInteger)numberOfTextFields
                            textFieldsSetupHandler:(LGAlertViewTextFieldsSetupHandler)textFieldsSetupHandler
                                      buttonTitles:(nullable NSArray<NSString *> *)buttonTitles
                                 cancelButtonTitle:(nullable NSString *)cancelButtonTitle
                            destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle;
Swift
public init(title: String?,
          message: String?,
            style: LGAlertViewStyle,
     buttonTitles: [String]?,
cancelButtonTitle: String?,
destructiveButtonTitle: String?)

public init(viewAndTitle title: String?,
                       message: String?,
                         style: LGAlertViewStyle,
                          view: UIView?,
                  buttonTitles: [String]?,
             cancelButtonTitle: String?,
        destructiveButtonTitle: String?)

public init(activityIndicatorAndTitle title: String?,
                                    message: String?,
                                      style: LGAlertViewStyle,
                               buttonTitles: [String]?,
                          cancelButtonTitle: String?,
                     destructiveButtonTitle: String?)

public init(progressViewAndTitle title: String?,
                               message: String?,
                                 style: LGAlertViewStyle,
                     progressLabelText: String?,
                          buttonTitles: [String]?,
                     cancelButtonTitle: String?,
                destructiveButtonTitle: String?)

public init(textFieldsAndTitle title: String?,
                             message: String?,
                  numberOfTextFields: UInt,
              textFieldsSetupHandler: LGAlertView.LGAlertViewTextFieldsSetupHandler?,
                        buttonTitles: [String]?,
                   cancelButtonTitle: String?,
              destructiveButtonTitle: String?)

More init methods you can find in LGAlertView.h

Setup

You can change properties only before you show alert view, after this to change something is impossible.

Appearance

Instead of change properties for every new alert view, you can use appearance to set them all only once and new alert views will use it by default:

Objective-C
[LGAlertView appearance].tintColor = UIColor.greenColor;
[LGAlertView appearance].cancelOnTouch = NO;
[LGAlertView appearance].dismissOnAction = NO;
[LGAlertView appearance]...
[LGAlertView appearance]...
Swift
LGAlertView.appearance().tintColor = .green
LGAlertView.appearance().cancelOnTouch = false
LGAlertView.appearance().dismissOnAction = false
LGAlertView.appearance()...
LGAlertView.appearance()...

Buttons

If you want to set properties for each button individually, you can use method:

Objective-C
- (void)setButtonPropertiesAtIndex:(NSUInteger)index handler:(void(^ _Nonnull)(LGAlertViewButtonProperties * _Nonnull properties))handler;

[alertView setButtonPropertiesAtIndex:0 handler:^(LGAlertViewButtonProperties * _Nonnull properties) {
    properties.titleColor = UIColor.yellowColor;
    properties.image = [UIImage imageNamed:@"SuperImage"];
    // properties...
    // properties...
}];
Swift
open func setButtonPropertiesAt(_ index: UInt, handler: @escaping (LGAlertViewButtonProperties) -> Swift.Void)

alertView.setButtonPropertiesAt(0) { (properties: LGAlertViewButtonProperties) in
    properties.titleColor = .yellow
    properties.image = UIImage(named: "SuperImage")
    // properties...
    // properties...
}

Enable / Disable

You can enable and disable buttons:

Objective-C
alertView.cancelButtonEnabled = YES;
alertView.destructiveButtonEnabled = YES;
[alertView setButtonEnabled:YES atIndex:0];
Swift
alertView.cancelButtonEnabled = true
alertView.destructiveButtonEnabled = true
alertView.setButtonEnabled(true, index: 0)

Retain Cycle

When 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:

Objective-C
__weak typeof(self) wself = self;

alertView.cancelHandler = ^(LGAlertView *alertView) {
    __strong typeof(wself) sself = wself;

    [sself someMethod];
};
Swift
alertView.cancelHandler = { [unowned self](alertView: LGAlertView) in
    self.someMethod()
}

Blur

You can use UIBlurEffect with next properties:

UIBlurEffect *coverBlurEffect;

For example:

Objective-C
alertView.coverBlurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
Swift
alertView.coverBlurEffect = UIBlurEffect(style: .regular)

If you want to change color of blurred view, use:

UIColor *coverColor;

For example:

Objective-C
alertView.coverColor = [UIColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.1];
Swift
alertView.coverColor = UIColor(red: 0.0, green: 0.5, blue: 1.0, alpha: 0.1)

If you want to change intensity of blurred view, use:

CGFloat coverAlpha;

For example:

alertView.coverAlpha = 0.9;

Handle actions

To handle actions you can use blocks, delegate or notifications:

Delegate

Objective-C
<LGAlertViewDelegate>

@optional

- (void)alertViewWillShow:(nonnull LGAlertView *)alertView;
- (void)alertViewDidShow:(nonnull LGAlertView *)alertView;

- (void)alertViewWillDismiss:(nonnull LGAlertView *)alertView;
- (void)alertViewDidDismiss:(nonnull LGAlertView *)alertView;

- (void)alertView:(nonnull LGAlertView *)alertView clickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;
- (void)alertViewCancelled:(nonnull LGAlertView *)alertView;
- (void)alertViewDestructed:(nonnull LGAlertView *)alertView;

- (void)alertView:(nonnull LGAlertView *)alertView didDismissAfterClickedButtonAtIndex:(NSUInteger)index title:(nullable NSString *)title;
- (void)alertViewDidDismissAfterCancelled:(nonnull LGAlertView *)alertView;
- (void)alertViewDidDismissAfterDestructed:(nonnull LGAlertView *)alertView;

- (void)showAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;
- (void)dismissAnimationsForAlertView:(nonnull LGAlertView *)alertView duration:(NSTimeInterval)duration;
Swift
<LGAlertViewDelegate>

optional public func alertViewWillShow(_ alertView: LGAlertView)
optional public func alertViewDidShow(_ alertView: LGAlertView)

optional public func alertViewWillDismiss(_ alertView: LGAlertView)
optional public func alertViewDidDismiss(_ alertView: LGAlertView)

optional public func alertView(_ alertView: LGAlertView, clickedButtonAtIndex index: UInt, title: String?)
optional public func alertViewCancelled(_ alertView: LGAlertView)
optional public func alertViewDestructed(_ alertView: LGAlertView)

optional public func alertView(_ alertView: LGAlertView, didDismissAfterClickedButtonAtIndex index: UInt, title: String?)
optional public func alertViewDidDismissAfterCancelled(_ alertView: LGAlertView)
optional public func alertViewDidDismissAfterDestructed(_ alertView: LGAlertView)

optional public func showAnimationsForAlertView(_ alertView: LGAlertView, duration: NSTimeInterval)
optional public func dismissAnimationsForAlertView(_ alertView: LGAlertView, duration: NSTimeInterval)

Blocks

Objective-C
void(^ _Nullable willShowHandler)(LGAlertView * _Nonnull alertView);

void(^ _Nullable willShowHandler)(LGAlertView * _Nonnull alertView);
void(^ _Nullable didShowHandler)(LGAlertView * _Nonnull alertView);

void(^ _Nullable willDismissHandler)(LGAlertView * _Nonnull alertView);
void(^ _Nullable didDismissHandler)(LGAlertView * _Nonnull alertView);

void(^ _Nullable actionHandler)(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title);
void(^ _Nullable cancelHandler)(LGAlertView * _Nonnull alertView);
void(^ _Nullable destructiveHandler)(LGAlertView * _Nonnull alertView);

void(^ _Nullable didDismissAfterActionHandler)(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title);
void(^ _Nullable didDismissAfterCancelHandler)(LGAlertView * _Nonnull alertView);
void(^ _Nullable didDismissAfterDestructiveHandler)(LGAlertView * _Nonnull alertView);

void(^ _Nullable showAnimationsBlock)(LGAlertView * _Nonnull alertView, NSTimeInterval duration);
void(^ _Nullable dismissAnimationsBlock)(LGAlertView * _Nonnull alertView, NSTimeInterval duration);
Swift
open var willShowHandler: ((alertView: LGAlertView) -> Swift.Void)?
open var didShowHandler: ((alertView: LGAlertView) -> Swift.Void)?

open var willDismissHandler: ((alertView: LGAlertView) -> Swift.Void)?
open var didDismissHandler: ((alertView: LGAlertView) -> Swift.Void)?

open var actionHandler: ((alertView: LGAlertView, index: NSUInteger, title: NSString) -> Swift.Void)?
open var cancelHandler: ((alertView: LGAlertView) -> Swift.Void)?
open var destructiveHandler: ((alertView: LGAlertView) -> Swift.Void)?

open var didDismissAfterActionHandler: ((alertView: LGAlertView, index: NSUInteger, title: NSString) -> Swift.Void)?
open var didDismissAfterCancelHandler: ((alertView: LGAlertView) -> Swift.Void)?
open var didDismissAfterDestructiveHandler: ((alertView: LGAlertView) -> Swift.Void)?

open var showAnimationsBlock: ((alertView: LGAlertView, duration: NSTimeInterval) -> Swift.Void)?
open var dismissAnimationsBlock: ((alertView: LGAlertView, duration: NSTimeInterval) -> Swift.Void)?

Notifications

LGAlertViewWillShowNotification
LGAlertViewDidShowNotification

LGAlertViewWillDismissNotification
LGAlertViewDidDismissNotification

LGAlertViewActionNotification
LGAlertViewCancelNotification
LGAlertViewDestructiveNotification

LGAlertViewDidDismissAfterActionNotification;
LGAlertViewDidDismissAfterCancelNotification;
LGAlertViewDidDismissAfterDestructiveNotification;

LGAlertViewShowAnimationsNotification;
LGAlertViewDismissAnimationsNotification;

More

For more details try Xcode Demo project and see LGAlertView.h

Frameworks

If you like LGAlertView, check out my other useful libraries:

  • LGSideMenuController iOS view controller, shows left and right views by pressing button or gesture.
  • LGPlusButtonsView Customizable iOS implementation of Floating Action Button (Google Plus Button, fab).

License

LGAlertView is released under the MIT license. See LICENSE for details.

lgalertview's People

Contributors

friend-lga avatar gkamelo avatar heroims avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lgalertview's Issues

Collaborators WANTED

Guys, sorry, but now I totally don't have enough time to support my repositories. If somebody want to participate I will glad to add him.

And one more thing. If you really want to collaborate, prove your interesting in this library. Star it, fork it, make some issues, pull request. Show me that you understand how it works inside. Or if you do not create any pull request, but really want to improve this library, show me some your ios code and let me see your level.

Prevent alert dismiss.

Is it possible to prevent dialog from dismissing when user touches a button? I want to dismiss dialog manually. Assume I want to add a retry button for dialog so alert view stay open until the job end

iOS 11 Support

Hello.
Has anyone tried LGAlertView on iOS 11 Beta 3? Alert buttons appear deformed in my project. May be someone has investigated height issues already?

LGAlertView appstore safe

Thanks for sharing your great work.

As you have used some apple's private api call

[NSStringFromClass([window class]) isEqualToString:@"UITextEffectsWindow"])

actionHandler problem

why?
actionHandler
from

^(LGAlertView *alertView, NSString *title, NSUInteger index)

to
^(LGAlertView *alertView, NSUInteger index, NSString *title) ;

So unreasonable!!!

Custom view implementation vertical margins

So far I was able to eliminate the margins and radiuses using the following:

alertView.offsetVertical = 0;
alertView.cancelButtonOffsetY = 0;
alertView.layerCornerRadius = 0;

But I couldn't find a way to eliminate the top and bottom margins that occurs as shown below:

SS

Is there a way to work this around?

Shows black screen after dismiss

I have updated to latest release and it breaks the UI.
I am stuck at black screen when I press cancel on alertview

Here is my Code

LGAlertView* alertView = [[LGAlertView alloc] initWithViewAndTitle:title message:subtitle style:LGAlertViewStyleAlert view:customView buttonTitles:@[kAlertButtonOk] cancelButtonTitle:kAlertButtonCancel destructiveButtonTitle:nil actionHandler:^(LGAlertView * _Nonnull alertView, NSUInteger index, NSString * _Nullable title) {
        if(okBlock){
            okBlock(YES,self.textViewText);
        }
    } cancelHandler:^(LGAlertView * _Nonnull alertView) {
        if (cancelBlock) {
            cancelBlock(YES);
        }
    } destructiveHandler:^(LGAlertView * _Nonnull alertView) {
        
    }];
    [alertView showAnimated:YES completionHandler:nil];

My app is stucked at black screen. Is there any workaround ? It was working fine in some older version.

use LGAlertView with UIAlertView

I don't know if anyone reports this. I just found if I use LGAlertView and UIAlertView together, it always freeze the screen. No touch event or other events are working.

Bug: Wrong size while editing UITextField

While editing UITextField with keyboard expanded, tap an UIButton (not calling UITextField's resignFirstResponder) to show an LGAlertView, which results in wrong size.
img_6579

如果buttonTitles过多的话,会出现拉不到底的情况。

如果buttonTitles过多的话,会出现拉不到底的情况。
代码如下:

NSMutableArray* array = [NSMutableArray new];
        for (int i=1000; i<=200000; i+=1000) {
            [array addObject:IntegerToString(i)];
        }
    LGAlertView* alert = [[LGAlertView alloc] initWithTitle:@"选择目标步数(下拉选择更多)"
                                                     message:nil
                                                       style:LGAlertViewStyleActionSheet
                                                buttonTitles:array
                                           cancelButtonTitle:@"取消"
                                      destructiveButtonTitle:nil
                                                    delegate:self];
    alert.heightMax = 250.f;
    [alert showAnimated:YES completionHandler:nil];

总数是200000,但是只能拉到157000的位置。

cancelButtonOffsetY and offsetVertical

#cancelButtonOffsetY does the same work as offsetVertical when the LGA'style is action sheet, they are both set the distance between bottom of the screen and the bottom of the LGA, Here is my code:

alertView.layerCornerRadius = 0.0;
alertView.buttonsFont = [UIFont systemFontOfSize:16];
alertView.cancelButtonFont = [UIFont systemFontOfSize:16];
alertView.buttonsHeight = 48;
alertView.cancelButtonTitleColor = [[UIColor blackColor] colorWithAlphaComponent:0.38];
alertView.buttonsTitleColor = [[UIColor blackColor] colorWithAlphaComponent:0.87];
alertView.cancelButtonOffsetY = 0;
alertView.offsetVertical = 9;

Is there some wrong I made ? 3Q for some help. What I thought is the cancelOffsetY is the distance between cancel button and the function button

Don't manipulate non-app windows

The lib always hides my non-app key window that I use for my custom controller in action sheet style that I use for photo picker.

UIWindow *keyWindow = LGAlertViewHelper.keyWindow;

[keyWindow endEditing:YES];

if (!hidden && keyWindow != LGAlertViewHelper.appWindow) {
    keyWindow.hidden = YES;
}

Dynamic buttons or height

Hello and thanks for sharing this great library.
Its not an issue per se, rather than a question.

I have a custom view with thumbnails which i have successfully added in your control.
What i want to achieve is show the control with only the cancel button until the user has made at least one selection.
I have all the necessary delegates coming from my custom uiview that inform of any selection/deselection of each thumb.
Is there a way to manually show hide buttons to achieve such scenario?
or any other way you can think of that would make better sense with my case?

thanks for your time

EXC_BAD_ACCESS alertView with textField's

iOS 9.0
To reproduce issue:

  1. Init alertView:
 LGAlertView *alertView = [[LGAlertView alloc] initWithTextFieldsStyleWithTitle:@"Some title"
                                                                           message:@"Please, enter some info"
                                                                numberOfTextFields:1
                                                            textFieldsSetupHandler:^(UITextField *textField, NSUInteger index)
                              {
                                      textField.placeholder = @"Some info";
                              }
                                                                      buttonTitles:@[@"Done"]
                                                                 cancelButtonTitle:@"Cancel"
                                                            destructiveButtonTitle:nil
                                                                     actionHandler:nil
                                                                     cancelHandler:nil
                                                                destructiveHandler:nil];

    alertView.cancelOnTouch = NO;
    [alertView showAnimated:YES completionHandler:nil];
  1. Build and run application, show alertView
  2. Tap on textField in alertView - alertView will dismiss
  3. Open one more time alertView and tap cancel - it will crash with exc_bad_access

Black Screen problem when using with Swift

Following warning appears on console while running
<UIVisualEffectView 0x7f8883c2bc70> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1.
Once I show LGAlertView it turns screen into black screen. Following code is used
```
@IBAction func onClickEditProfile(sender: Any) {
let lgaView: LGAlertView = LGAlertView.init(title: "", message: "What would you like to edit?", style: LGAlertViewStyle.actionSheet, buttonTitles: ["Edit Profile", "Edit Schedule"], cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, actionHandler: { (lgView: LGAlertView, index:UInt, title: String) in
if(index == 0){
self.navigationController?.pushViewController(EditProfileVC.editProfileVCLoad(), animated: true)
}else{
self.navigationController?.pushViewController(EditProfileVC.editProfileVCLoad(), animated: true)
}

        } as? LGAlertViewActionHandler, cancelHandler: { (lgView: LGAlertView) in
        lgView.dismissAnimated()
        

    }) { (lgView: LGAlertView) in
        lgView.dismiss()
    }
    lgaView.showAnimated()
}

LGAlertViewStyle and LGAlertViewWindowLevel enums

You can change declaration of LGAlertViewStyle and LGAlertViewWindowLevel for compatibility with Swift enums to modern Objective-C syntax:

typedef NS_ENUM(NSUInteger, LGAlertViewStyle) {
    LGAlertViewStyleAlert = 0,
    LGAlertViewStyleActionSheet  = 1
};

typedef NS_ENUM(NSUInteger, LGAlertViewWindowLevel) {
    LGAlertViewWindowLevelAboveStatusBar = 0,
    LGAlertViewWindowLevelBelowStatusBar = 1
};

This syntax was introduced with iOS 6.

Issue with autolayout

I want to add my own subview from xib which use autolayout constraints, but when _scrollView of your alertView setting frame, _innerView change frame too (autoresize). I temporarily decided the problem in your -layoutInvalidateWithSize: method by saving _innerView frame before setting superview frame, and then set it back.

CGRect innerFrame = _innerView.frame;
_scrollView.frame = scrollViewFrame;
_scrollView.transform = scrollViewTransform;
_scrollView.alpha = scrollViewAlpha;
_innerView.frame = innerFrame;

Auto dismiss alert

Hi,
I want my alert auto dismiss in x seconds, how can I setup it?
Thanks

click the last Button(lowest) in LGAlertViewStyleActionSheet's buttonTitles,didn't do anything?what's wrong~?please help

eg: LGAlertView *alert = [[LGAlertView alloc] initWithTitle:@"type" message:@"msg" style:LGAlertViewStyleActionSheet buttonTitles:@[@"aliPay",@"weixin"] cancelButtonTitle:@"cancle" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
NSLog(@"%lu",(unsigned long)index);
} cancelHandler:^(LGAlertView *alertView,BOOL onButton) { } destructiveHandler:^(LGAlertView *alertView) { }];

when i clicked the button named @"weixin" ,but it seems do nothing.then the alert dealloced.

dealloc has a problem

It may show alert many times.if add
-(void)viewWillDisappear:(BOOL)animated
{
_securityAlertView=nil;
}
dealloc will happen

iOS 11 Crash after attempt reopen LGAlertView

In first time on screen LGAlertView open successfully.
But when we try to create and show AlertView again the application crashes with the exception:

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [179.5 nan]

In iOS 10 everything works fine.

- (void)showPeriodSelector {
    self.periodSelectorAlertView = [[LGAlertView alloc] initWithViewAndTitle:NSLocalizedString(kQSPaymentDetailViewController_SelectPeriodTextKey, nil)
                                                                     message:nil
                                                                       style:LGAlertViewStyleActionSheet
                                                                        view:self.periodsTableView
                                                                buttonTitles:nil
                                                           cancelButtonTitle:NSLocalizedString(kQSBegetCommon_CancelTextKey, nil)
                                                      destructiveButtonTitle:nil
                                                                    delegate:nil];
    self.periodSelectorAlertView.tintColor = [QSCustomStyle mainColor];
    [self.periodSelectorAlertView showAnimated];
}

Issue with Share Extension

i added LGAlertView in pods of Share Extension , but it errors from uiapplication.shared . so i made Require Only App-Extension-Safe api to No. but even after that it shows runtime error (exc_badaccess).

Can't enable or disable buttons or change properties after alert showed

I have an alert view (with view) that I want to enable or disable it's button under some conditions but I can't do that.

alert.cancleButtonEnabled = YES / NO; 

[alert setCancelButtonEnabled: YES/NO];

[alert setButtonPropertiesAtIndex:0 handler:^(LGAlertViewButtonProperties *properties)
{
    properties.enablde = YES/NO;
}];

None of the above work while the alert is showing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.