首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在UIAlertView中添加UIActivityindicatorView

在UIAlertView中添加UIActivityindicatorView
EN

Stack Overflow用户
提问于 2009-06-02 18:53:20
回答 2查看 12.1K关注 0票数 15

我想创建一个显示"...in UIAlertView“的进度。它还将在其上显示UIActivityindicatorView。你能告诉我怎么做吗?

谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2009-06-02 20:28:39

这很简单。只需创建一个UIActivityIndicatorView并将其作为子视图添加到UIAlertView。

代码语言:javascript
复制
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
    UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
    progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
    [alert addSubview:progress];
    [progress startAnimating];

    [alert show];
票数 41
EN

Stack Overflow用户

发布于 2013-07-16 14:16:35

代码语言:javascript
复制
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView   *spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGRectMake(xcords, ycords, width, height);
[alert addSubview:spinner];
[spinner startanimating];
[alert show];

此微调器在关闭AlertView时被隐藏。

代码语言:javascript
复制
[alert dismissWithClickedButtonIndex:0 animated:YES];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/941264

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档