UIActivityIndi​​catorView或类似的

dus*_*ker 9 iphone uiactivityindicatorview

alt text http://28.media.tumblr.com/tumblr_ky3ezghsar1qzzxzzo1_400.jpg

谁能告诉我如何实现这样的加载消息?它是UIActivityIndi​​catorView的一些变体吗?谢谢皮特

bst*_*ood 22

在您的自定义子类UIView的initWithFrame中类似于以下内容:

    _hudView = [[UIView alloc] initWithFrame:CGRectMake(75, 155, 170, 170)];
    _hudView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    _hudView.clipsToBounds = YES;
    _hudView.layer.cornerRadius = 10.0;

    _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    _activityIndicatorView.frame = CGRectMake(65, 40, _activityIndicatorView.bounds.size.width, _activityIndicatorView.bounds.size.height);
    [_hudView addSubview:_activityIndicatorView];
    [_activityIndicatorView startAnimating];

    _captionLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 115, 130, 22)];
    _captionLabel.backgroundColor = [UIColor clearColor];
    _captionLabel.textColor = [UIColor whiteColor];
    _captionLabel.adjustsFontSizeToFitWidth = YES;
    _captionLabel.textAlignment = NSTextAlignmentCenter;
    _captionLabel.text = @"Loading...";
    [_hudView addSubview:_captionLabel];

    [self addSubview:_hudView];
Run Code Online (Sandbox Code Playgroud)


Sev*_*yev 1

旋转的轮子绝对是一个 UIActivityIndi​​catorView。“正在加载...”文本是一个 UILabel,矩形可以是图像,也可以是带有圆角的 UIView(通过 CALayer)。对邮件的其余部分还有疑问吗?时间