iPhone 活动指示器

发布于 2024-11-04 04:46:42 字数 81 浏览 0 评论 0原文

如何在登录页面加载UIActivityIndi​​catorView?就像 Facebook iPhone 应用程序一样。

How to load UIActivityIndicatorView in a login page? just like facebook iPhone App.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

拥有 2024-11-11 04:46:43

你的问题不清楚。但这是添加活动指示器的方法。

UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(225, 115, 30, 30)];
[activity setBackgroundColor:[UIColor clearColor]];
[activity setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[self.view addSubview:activity];
[activity release];

开始为活动设置动画

[activity startAnimating];

停止为活动设置动画

[activity stopAnimating];

your question is not clear. but this is the way to add activity indicator.

UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(225, 115, 30, 30)];
[activity setBackgroundColor:[UIColor clearColor]];
[activity setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
[self.view addSubview:activity];
[activity release];

to start animating the activity

[activity startAnimating];

to stop animating the activity

[activity stopAnimating];
我是男神闪亮亮 2024-11-11 04:46:43
activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    activityIndicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
    activityIndicator.center = self.view.center;
    [self.view addSubview: activityIndicator];

当您想要制作动画时,请使用 [activityIndi​​cator startAnimating];

activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    activityIndicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
    activityIndicator.center = self.view.center;
    [self.view addSubview: activityIndicator];

Use [activityIndicator startAnimating]; when you want to animate

傲性难收 2024-11-11 04:46:43

像这样初始化..

UIActivityIndicatorView *activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
activityView.center = CGPointMake(240,160);
activityView.hidden = true;
[self.view addSubview: activityView];

当你想要动画

   activityView.hidden = FALSE;
   [activityView startAnimating] ;

时想要停止

   [activityView stopAnimating];
   activityView.hidden = TRUE;

编辑:看到评论后

Facebook活动指示器没有什么特别的。他们只是清除那里的视图并显示活动指示器何时开始动画。

您只需创建一个视图,例如 ActivityView,它覆盖屏幕(或您想要设为白色的任何部分),为视图添加白色背景,并将活动指示器添加到视图中。首先隐藏此视图,然后当您想要显示活动指示器取消隐藏视图并启动活动指示器动画。在活动指示器中编写两个成员函数来启动和停止动画,以便您可以从任何地方控制动画。

initialize like this..

UIActivityIndicatorView *activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] autorelease];
activityView.center = CGPointMake(240,160);
activityView.hidden = true;
[self.view addSubview: activityView];

when you want to animate

   activityView.hidden = FALSE;
   [activityView startAnimating] ;

when you want to stop

   [activityView stopAnimating];
   activityView.hidden = TRUE;

EDIT : After seeing the comment

Nothing peculiar about Facebook activity indicator.They just clearing there view along with showing when activity indicator starts animation..

You just create a view, say ActivityView, which covers the screen(or whatever section you want to make white), put a white background to the view, and add the activity indicator to the view..First hide this view, and when you want to show activity indicator unhide the view and start activity indicator animation..Write two member functions in activity indicator to start and stop animation, so that you can control the animation from anywhere..

甜尕妞 2024-11-11 04:46:43
CGRect frame = CGRectMake(self.view.frame.size.width/2-15, self.view.frame.size.height/2-15, 37, 37);
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:frame];
    [indicator startAnimating];
    indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
    [indicator sizeToFit];
    indicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
                                    UIViewAutoresizingFlexibleRightMargin |
                                    UIViewAutoresizingFlexibleTopMargin |
                                    UIViewAutoresizingFlexibleBottomMargin);

    indicator.tag = 1;
    [self.view addSubview:indicator];
    [indicator release];
CGRect frame = CGRectMake(self.view.frame.size.width/2-15, self.view.frame.size.height/2-15, 37, 37);
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:frame];
    [indicator startAnimating];
    indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
    [indicator sizeToFit];
    indicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
                                    UIViewAutoresizingFlexibleRightMargin |
                                    UIViewAutoresizingFlexibleTopMargin |
                                    UIViewAutoresizingFlexibleBottomMargin);

    indicator.tag = 1;
    [self.view addSubview:indicator];
    [indicator release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文