zoukankan      html  css  js  c++  java
  • iphone开发学习,UIAlertView的简单改写,popAlertView

    改写的AlertView,有弹出效果,点击任意位置关闭View。

    效果图:popAlertView-maxfong

    - (IBAction)didPressedClick:(id)sender{
        alert = [[UIAlertView alloc] init];
        alert.delegate = self;
        [alert addSubview:aView];
        bView.layer.cornerRadius = 10;
        bView.layer.masksToBounds = YES;
        [bView.layer setShadowOffset:CGSizeMake(2, 1)];
        [bView.layer setShadowRadius:5];
        [bView.layer setShadowOpacity:1];
        [alert show];
        [alert release];
    }
    - (IBAction)didPressedClosed:(id)sender{
        [alert dismissWithClickedButtonIndex:0 animated:YES];
    }
    - (void)willPresentAlertView:(UIAlertView *)alertView{
        alertView.frame = CGRectMake(0, 0, 320, 480);
        for (UIView* view in alertView.subviews ) {
            if ([view isKindOfClass:[UIImageView class]]) {
                UIImageView *img = (UIImageView*)view;
                img.backgroundColor = [UIColor clearColor];
                img.image = nil;
            }
        }
    }

    创建了一个透明图片作为Button的背景图片,不然点击灰色无效(还不知道为啥,知道的请指点下)。

    Download Code(popAlertView)

  • 相关阅读:
    java异常处理 it
    java文件操作 it
    ArrayLike it
    javaProreties it
    javaset,Collections,map it
    003 Longest Substring Without Repeating Characters it
    react Video event it
    查看git地址
    Itext 生成PDF
    jar包配置文件到单独文件夹
  • 原文地址:https://www.cnblogs.com/maxfong/p/2687031.html
Copyright © 2011-2022 走看看