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)

  • 相关阅读:
    npm包开发与发布
    mapbox展示动态图标
    axios并行请求
    Vue引入ES5的js库
    git常用操作
    单词倒排
    FT232RL芯片USB转TTL应用
    应用GL823芯片自制的读卡器
    队列图示
    队列
  • 原文地址:https://www.cnblogs.com/maxfong/p/2687031.html
Copyright © 2011-2022 走看看