Ios UIAlertView在调用loginButton操作后显示太短
我想在LoginProcess运行时或调用loginButton操作后显示UIAlertView。这是我的密码:Ios UIAlertView在调用loginButton操作后显示太短,ios,login,request,action,uialertview,Ios,Login,Request,Action,Uialertview,我想在LoginProcess运行时或调用loginButton操作后显示UIAlertView。这是我的密码: - (void) btnLogin:(id) sender { UIAlertView *alertLogin = [[UIAlertView alloc] initWithTitle:nil message:@"\nLogin in progress, please wait!" delegate:self cancelButtonTitle:nil otherButto
- (void) btnLogin:(id) sender {
UIAlertView *alertLogin = [[UIAlertView alloc] initWithTitle:nil message:@"\nLogin in progress, please wait!" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
[alertLogin show];
NSURL *url = [NSURL URLWithString:@"http://www.example.com/login/"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:username forKey:@"username"];
[request setPostValue:password forKey:@"pw"];
[request startSynchronous];
[request cancelAuthentication];
[...]
}
需要帮助。
非常感谢你的建议。在你班的.h中
UIAlertView *alert;
In.m btnLogin方法
alert = [[[UIAlertView alloc] initWithTitle:@"Login in progress\nPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[警报显示]
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
// Adjust the indicator so it is up a few pixels from the bottom of the alert
indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
[indicator release];
在didReceiveData方法的连接中,您将编写,或者如果您正在解析,那么didEndDocument方法的解析器,您可以这样做
[alert dismissWithClickedButtonIndex:0 animated:YES];
您的问题在
[请求启动同步]代码>
同步http请求和UI不能很好地结合在一起。尝试使用异步连接Hello Veer,这不起作用。登录进程/加载时屏幕被阻止。你向我推荐了MBD,但也有同样的问题。