Giter VIP home page Giter VIP logo

Comments (4)

kaich avatar kaich commented on August 30, 2024

when i add a time delay, it works fine.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[alertView dismiss];
});

I am not find the real reason . but hope you fix the bug!

from cxalertview.

ChrisXu avatar ChrisXu commented on August 30, 2024

Thanks, I will fix it ASAP.

from cxalertview.

jlubeck avatar jlubeck commented on August 30, 2024

Were you able to fix the bug?? I'm having a lot of problems with this... The dispatch_after method seemed to work, but now I'm getting double alertviews to show for a second before the first one disappears...

from cxalertview.

renanstig avatar renanstig commented on August 30, 2024

@jlubeck I found a workaround for this bug.

I instantiated my alert view inside a dispatch_after method. See below:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

    NSString *showmessage = [[NSString alloc] init];
    showmessage = [_defaults objectForKey:@"activatedFenceMessage"];
    if (![showmessage isEqualToString:@"1"]) {

        UIView *customAlertView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 260, 199)];

        UIImageView *ivFunc = [[UIImageView alloc] initWithFrame:CGRectMake(57, 8, 146, 88)];
        [ivFunc setImage:[UIImage imageNamed:@"apresentacao_cerca_criada"]];
        [ivFunc setContentMode:UIViewContentModeScaleAspectFit];
        [customAlertView addSubview:ivFunc];
        UILabel *mensagem = [[UILabel alloc] initWithFrame:CGRectMake(8, 108, 250, 53)];
        [mensagem setFont:[UIFont systemFontOfSize:11]];
        [mensagem setLineBreakMode:NSLineBreakByWordWrapping];
        [mensagem setNumberOfLines:6];
        [mensagem setTextAlignment:NSTextAlignmentCenter];



        mensagem.text = activatedFence;
        [customAlertView addSubview:mensagem];



        CXAlertView *alertViewMe = [[CXAlertView alloc] initWithTitle:fenceTitle contentView:customAlertView  cancelButtonTitle:nil];

        // This is a demo for multiple line of title.
        [alertViewMe addButtonWithTitle:multiLineMessageAcceptedText
                                   type:CXAlertViewButtonTypeDefault
                                handler:^(CXAlertView *alertView2, CXAlertButtonItem *button) {
                                    [_defaults setObject:@"0" forKey:@"activatedFenceMessage"];


                                    [alertView2 dismiss];



                                }];

        [alertViewMe addButtonWithTitle:multiLineMessageCancelText
                                   type:CXAlertViewButtonTypeCancel
                                handler:^(CXAlertView *alertView2, CXAlertButtonItem *button) {
                                    [_defaults setObject:@"1" forKey:@"activatedFenceMessage"];

                                    [alertView2 dismiss];



                                }];

        [alertViewMe show];
    }
});

from cxalertview.

Related Issues (20)

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.