开发者社区> 问答> 正文

请问怎么禁用Alertview弹出

我的应用里面有一个Alertview,没有网络连接的时候会弹出来。但是我希望有网络连接的时候它可以自动禁用。代码如下:

-(void)reachabilityChanged:(NSNotification*)note

    {
        Reachability * reach = [note object];

        if([reach isReachable])
        {
            notificationLabel.text = @"Notification Says Reachable";
            NSLog(@"Internet is Up");



        }
        else
        {
            notificationLabel.text = @"Notification Says Unreachable";
            NSLog(@"Internet is Down");
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please connect to Internet"
                                                            message:nil
                                                           delegate:self
                                                  cancelButtonTitle:nil
                                                  otherButtonTitles:nil];
            UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
            progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
            [alert addSubview:progress];
            [progress startAnimating];
            [alert show];
        }
    }

展开
收起
爵霸 2016-05-27 11:06:53 1960 0
0 条回答
写回答
取消 提交回答
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载