Skip to content

Instantly share code, notes, and snippets.

@monjer
Last active December 15, 2015 05:59
Show Gist options
  • Select an option

  • Save monjer/5212668 to your computer and use it in GitHub Desktop.

Select an option

Save monjer/5212668 to your computer and use it in GitHub Desktop.
加UIAlertView的网络提示分类
//
// UIAlertView+Loading.h
//
// Created by manjun.han on 13-3-21.
// Copyright (c) 2013年 mj. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIAlertView (Loading)
+ (UIAlertView*)showWaitIndicator:(NSString *)title ;
+ (UIAlertView*)showAlert:(NSString *)title message:(NSString *)message ;
@end
//
// UIAlertView+Loading.m
//
// Created by manjun.han on 13-3-21.
// Copyright (c) 2013年 mj. All rights reserved.
//
#import "UIAlertView+Loading.h"
@implementation UIAlertView (Loading)
// 显示加载进度提示
+ (UIAlertView*)showWaitIndicator:(NSString *)title
{
UIAlertView *progressAlert;
progressAlert = [[UIAlertView alloc] initWithTitle:title
message:@"Please wait..."
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil];
[progressAlert show];
UIActivityIndicatorView *activityView;
activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
CGFloat x = progressAlert.bounds.size.width/2.0 ;
CGFloat y = progressAlert.bounds.size.height - 45 ;
activityView.center = CGPointMake(x, y) ;
[progressAlert addSubview:activityView];
[activityView startAnimating];
return progressAlert;
}
// 显示提示信息快捷方法
+ (UIAlertView*)showAlert:(NSString *)title message:(NSString *)message
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: title
message: message
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
return alert ;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment