简体   繁体   中英

How to customize UIAlert View..?

I have customized the UIViews by adding images to make it look like radio button or check boxes, but for my spec I want to make the UIAlertView look like this...

在此输入图像描述

Can anyone suggest how to do this? Thanks!

You can design custom view and can give animation to it as alert view using this code

    -(void)initialDelayEnded 
{

    alert_upload.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
    alert_upload.alpha = 1.0;
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1/1.5];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)];
    alert_upload.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    [UIView commitAnimations];
}

- (void)bounce1AnimationStopped {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.5/2];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)];
    alert_upload.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
    [UIView commitAnimations];
}

- (void)bounce2AnimationStopped {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.5/2];
    alert_upload.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];


}

alert_upload is UIView.

There's many previous questions about this topic , one of them links this component that lets you create custom alerts and action sheets. Might be a good way to start.

您可以创建自己的自定义警报视图,除非用户交互,否则Apple不会拒绝它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM