在登录屏幕之后,将用户名/密码发送到web服务并获得true(应该启动应用程序的其余部分)或false(不正确的用户名/密码或未授权)的响应。该应用程序提供您已通过身份验证的警报视图,但它不会加载视图的其余部分吗?
有人可以帮助我吗?
if ([soapResults isEqualToString: @"true"])
{
UIAlertView *welcome = [[UIAlertView alloc] initWithTitle:@"Welcome!" message:@"Welcome, You are now authenticated to a Coyote Logistics application." delegate:self cancelButtonTitle:@"OK",nil otherButtonTitles:nil];
[welcome show];
[welcome release];
[soapResults release];
soapResults = nil;
[loginIndicator stopAnimating];
loginIndicator.hidden = TRUE;
loggedinLabel.text = usernameField.text;
loggedinLabel.textColor = [UIColor blackColor];
NSLog(@"Valid Login");
FeedsViewController *fvController = [[FeedsViewController alloc] initWithTitle:@"LoadBoard" withNavigationTitle:@"Available Loads" withPropertyFile:@"feeds.plist"];
AboutViewController *avController = [[AboutViewController alloc] init];
SettingsViewController *svController = [[SettingsViewController alloc] init];
UINavigationController *fvNavController = [[UINavigationController alloc] initWithRootViewController:fvController];
UINavigationController *avNavController = [[UINavigationController alloc] initWithRootViewController:avController];
UINavigationController *svNavController = [[UINavigationController alloc] initWithRootViewController:svController];
UITabBarController *tbController = [[UITabBarController alloc] init];
fvNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];
avNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];
svNavController.navigationBar.tintColor = [UIColor colorWithRed:0.14 green:0.18 blue:0.25 alpha:1.00];
[[fvController tabBarItem] setImage:[UIImage imageNamed:@"rss.png"]];
tbController.viewControllers = [NSArray arrayWithObjects:fvNavController, avNavController, svNavController, nil];
// Configure and show the window
[window addSubview:tbController.view];
[window makeKeyAndVisible];
[LoginViewController release];
}
答案 0 :(得分:0)
首先,如果您在app委托方法applicationDidFinishLaunching中执行此操作,我建议您不要这样做。
为什么呢?因为如果你在该委托方法中花费太长时间,iPhone OS将关闭你并退出应用程序。
您是否考虑过准备好导航控制器进入标签控制器,并使用模式进行登录?
当您获得成功后,您可以解除模态并继续,填写导航控制器中的数据。
但是,如果你在applicationDidFinishLaunching委托方法中,只需创建视图控制器并以模态方式构建它,以便控件可以返回到UIApplication对象。