zoukankan      html  css  js  c++  java
  • iOS:等待控件

    定义:

    @interface ViewController ()
    {
        UIActivityIndicatorView *testActivityIndicator;
    }

    实例化,开始旋转:

    -(void) showWaitStatus
    {
        NSLog(@"wait...");
        testActivityIndicator =
                [[UIActivityIndicatorView alloc]
                initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        
        CGRect rect = self.view.frame;
        testActivityIndicator.center = CGPointMake(rect.size.width / 2, rect.size.height / 2);
        [self.view addSubview:testActivityIndicator];
        testActivityIndicator.color = [UIColor redColor]; // iOS5 引入指定颜色
        [testActivityIndicator startAnimating];           // 开始旋转
        [testActivityIndicator setHidesWhenStopped:YES];  // 当旋转结束时隐藏
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
        [self showWaitStatus];
    }

    停止旋转:

    -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        [testActivityIndicator stopAnimating];
    }
  • 相关阅读:
    14. HTML 列表(无序, 有序, 定义)
    13. HTML table
    12. HTML图像
    11. HTML链接
    10. HTML CSS
    learning java AWT Pannel
    learning AWT Jrame
    learning java 正则表达式
    learning java java.time相关类
    learning java Calendar类
  • 原文地址:https://www.cnblogs.com/code-style/p/4011978.html
Copyright © 2011-2022 走看看