我们在实际的开发中,经常会加载数据,用户需要等待加载的过程,往往在这一段时间要告送用户正在加载数据,经常用loading的效果来实现.
实现效果如下:
实现的具体代码:
类的声明:
#import <UIKit/UIKit.h>
@interface SysLogViewController : UIViewController {
IBOutlet UIActivityIndicatorView *spreed;
IBOutlet UIButton *button1;
IBOutlet UIButton *button2;}
@property (nonatomic,retain) UIActivityIndicatorView *spreed;
@property (nonatomic,retain) UIButton *button1;
@property (nonatomic,retain) UIButton *button2;-(IBAction) startSpinner;
-(IBAction) stopSpinner;@end
具体实现:
#import "SysLogViewController.h"
@implementation SysLogViewController
@synthesize spreed;
@synthesize button1;
@synthesize button2;- (IBAction) startSpinner {
[spreed startAnimating];
}- (IBAction) stopSpinner {
[spreed stopAnimating];
}
在利用interface builder添加相应的控件即可。