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)

  • 相关阅读:
    今年的第几天?
    特殊乘法
    abc
    求最大最小数
    二叉树遍历
    球的半径和体积
    成绩排序
    OC学习篇之---类的定义
    OC学习篇之---第一个程序HelloWorld
    OC学习篇之---类的初始化方法和点语法的使用
  • 原文地址:https://www.cnblogs.com/maxfong/p/2687031.html
Copyright © 2011-2022 走看看