我正在制作一个 iPhone 应用程序,我需要用户输入他们的电子邮件 ID 和密码,然后他们可以在我的网站上访问他们的帐户。
一旦他们输入身份验证详细信息,他们必须等待几秒钟才能出现下一页。
我需要向用户显示“处理中”或“请稍候”之类的符号。
我应该如何实施?
请帮帮我。
我正在制作一个 iPhone 应用程序,我需要用户输入他们的电子邮件 ID 和密码,然后他们可以在我的网站上访问他们的帐户。
一旦他们输入身份验证详细信息,他们必须等待几秒钟才能出现下一页。
我需要向用户显示“处理中”或“请稍候”之类的符号。
我应该如何实施?
请帮帮我。
您正在搜索的是活动指示器。
这是活动指示器的教程。
http://www.edumobile.org/iphone/iphone-programming-tutorials/use-activityindicator-in-iphone/
希望对你有帮助
我通常会创建一个根据需要实例化的 UIView。以下是一些代码供您在自己的应用程序中尝试:
- (id)initWithLabel:(NSString*)labelName {
self = [super init];
if (self) {
UIImageView *loadingBackgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 150, 120, 40)];
[loadingBackgroundView setBackgroundColor:[UIColor blackColor]];
[loadingBackgroundView setAlpha:0.9];
[loadingBackgroundView.layer setCornerRadius:8.0];
[loadingBackgroundView.layer setBorderColor:[[UIColor clearColor] CGColor]];
[self addSubview:loadingBackgroundView];
[loadingBackgroundView release];
UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake (125, 160, 100, 20)];
[loadingLabel setBackgroundColor:[UIColor clearColor]];
[loadingLabel setTextAlignment:UITextAlignmentCenter];
[loadingLabel setTextColor:[UIColor whiteColor]];
[loadingLabel setText:labelName];
[self addSubview:loadingLabel];
[loadingLabel release];
UIActivityIndicatorView *loadingActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110,160,20,20)];
[loadingActivityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
[loadingActivityIndicatorView startAnimating];
[self addSubview:loadingActivityIndicatorView];
[loadingActivityIndicatorView release];
}
return self;
}
这将为您提供类似于以下内容的内容:
这是很多人都处理过的事情,所以如果你想利用别人的工作并避免重新发明轮子,你可以使用Tapku Library之类的东西。它是开源的,在 GitHub 上。
具体来说,查看TKProgressAlertView
和TKLoadingView
类。
正如 ParthBhatt 所说,这是您想要的活动指标。
我非常喜欢 David Sinclair 的 DSActivityView 类:非常易于实现,易于显示和更改消息,如果需要,可以通过覆盖它来禁用 UI,包括标签栏和导航栏。