ActivityIndicator(菊花)的用法

1,在视图文件中拖拽一个 Activity Indicator View并且声明

#import <UIKit/UIKit.h>

@interface XViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *myLabel;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *myActivityIndicatorView;
@end

 

2,运用 startAnimating 和stopAnimating方法控制菊花是否转动

//
//  XViewController.m
//  ssss
//
//

#import "XViewController.h"

@interface XViewController ()

@end

@implementation XViewController
@synthesize myLabel;
@synthesize myActivityIndicatorView;

-(void)myMethodName
{
    //加载此方法以后Label名为 welcome
    myLabel.text = @"welcome";
    //停止动画
    [myActivityIndicatorView stopAnimating];
    //将菊花隐藏掉
    myActivityIndicatorView.hidden = YES;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    [myActivityIndicatorView startAnimating];//加载的时候动画开始运行
    //2秒后运行名为myMethodName的方法
    [self performSelector:@selector(myMethodName) withObject:nil afterDelay:2.0f];
  //selector(方法名)

} - (void)viewDidUnload { [self setMyLabel:nil]; [self setMyActivityIndicatorView:nil]; [super viewDidUnload]; // Release any retained subviews of the main view. } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } @end

转载于:https://www.cnblogs.com/lostinthenslog/archive/2012/09/21/2696592.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值