gpt4 book ai didi

iphone - 如何为具有 splitview Controller 的应用程序提供登录屏幕?

转载 作者:行者123 更新时间:2023-11-29 13:12:13 25 4
gpt4 key购买 nike

当我将 UISplitviewController 指定为应用程序的 Rootview 时,当时工作正常,但现在我想将登录屏幕添加到我的应用程序。有人可以帮助我吗?提前谢谢。

最佳答案

您可以将您的 LoginViewcontroller 添加为 Delegate 中的 Root View Controller ,并在 LoginScreen loginbutton 操作检查用户名或密码,如果它为真,那么您必须创建您的 Delegate 对象并将 rootviewconteroller 设置为您的 splitviewcontroller。就像我的波纹管代码:-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{


self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.viewController = [[LogInViewController alloc] initWithNibName:@"LogInViewController" bundle:nil];


self.window.rootViewController = self.viewController;

[self.window makeKeyAndVisible];
return YES;

}

和你的 loginButton Action :

-(IBAction)loginclick:(id)sender
{
objAppdelegate = (yourProjectnameDelegate *) [[UIApplication sharedApplication]delegate];
NSMutableArray *array = [NSMutableArray array];

HomeSpilitView = [[[UISplitViewController alloc] init]autorelease];

HomeMster = [[HomeSpilitViewController alloc] initWithNibName:@"HomeSpilitViewController" bundle:nil];

masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeMster] autorelease];
HomeMster.title=@"Title home";
masterNavigationController.navigationBar.tintColor =[UIColor colorWithRed:255/255.0 green:108/255.0 blue:61/255.0 alpha:0.1];
[array addObject:masterNavigationController];


HomeDetailsViewController *HomeDetailsViewControllers = [[HomeDetailsViewController alloc] initWithNibName:@"HomeDetailsViewController" bundle:nil];

detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:HomeDetailsViewControllers] autorelease];

detailNavigationController.navigationBar.tintColor =[UIColor colorWithRed:255/255.0 green:108/255.0 blue:61/255.0 alpha:0.1];
HomeDetailsViewControllers.title=@"details title";
HomeMster.objHomeDetailsViewcontroller=HomeDetailsViewControllers;
HomeSpilitView.delegate = HomeDetailsViewControllers;

[array addObject:detailNavigationController];

[HomeSpilitView setViewControllers:array];

[objAppdelegate.window setRootViewController:HomeSpilitView];


}

更新最后我使用波纹管代码完成了它:-

 UIInterfaceOrientation interfaceOrientation = HomeSpilitView.interfaceOrientation;
NSString *subtypeDirection;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
subtypeDirection = kCATransitionFromTop;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
subtypeDirection = kCATransitionFromBottom;
}
else {
subtypeDirection = kCATransitionFromRight;
}
[objAppdelegate.window setRootViewController:HomeSpilitView];
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:subtypeDirection];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

[[objAppdelegate.window layer] addAnimation:animation forKey:@"SwitchToView1"];

关于iphone - 如何为具有 splitview Controller 的应用程序提供登录屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16962467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com