iphone 缓冲视图 UIActivityIndicatorView

The UIActivityIndicatorView class creates and manages an indicator showing the indeterminate progress of a task. Visually, this indicator is a “gear” that is animated to spin.

You control when the progress indicator animates with the startAnimating and stopAnimating methods. If the hidesWhenStopped property is set to YES, the indicator is automatically hidden when animation stops.

简单的应用~ .h

//
//  UIActivityIndicatorViewViewController.h
//  UIActivityIndicatorView
//
//  Created by Adam Libonatti-Roche on 26/10/2009.
//  Copyright Xogos 2009. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIActivityIndicatorViewViewController : UIViewController {
	IBOutlet UIButton *startSpin;
	IBOutlet UIButton *stopSpin;
	
	UIActivityIndicatorView *spinner;
}

- (IBAction) startSpinner;
- (IBAction) stopSpinner;

@end
~  .m


//
//  UIActivityIndicatorViewViewController.m
//  UIActivityIndicatorView
//
//  Created by Adam Libonatti-Roche on 26/10/2009.
//  Copyright Xogos 2009. All rights reserved.
//

#import "UIActivityIndicatorViewViewController.h"

#define kScreenWidth 320
#define kScreenHeight 480

@implementation UIActivityIndicatorViewViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
	[spinner setCenter:CGPointMake(kScreenWidth/2.0, kScreenHeight/2.0)]; // I do this because I'm in landscape mode
	// spinner is not visible until started
	[self.view addSubview:spinner];
	[spinner release];
    [super viewDidLoad];
}

- (IBAction) startSpinner {
	[spinner startAnimating];
}

- (IBAction) stopSpinner {
	[spinner stopAnimating];
}




- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
	[stopSpin release];
	[startSpin release];
	[spinner release];
    [super dealloc];
}

@end



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值