Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

iphone - Adding login screen in front of Cocoa Touch Tab Bar Application for IOS

Still getting my head around things here. I'm not even close, but anyways.... I have a TabBar application created from Xcode. It works I have three tab views, that I know how to manipulate, etc.

I'd like to put a 'login' nib file in front of this whole thing, requiring a user to answer a (hardcoded for now) username and password. If you get that right, then, render the tab portion, allowing them to click around.

I have another application that I've written that does the username and password part, I'm having trouble taking the logic from there, and putting it in front of the TabApplication piece.

Anyone have any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In your AppDelegate, at the end of the application didFinishLaunchingWithOptions method you'll see this:

[window addSubview:tabcontroller.view];
[window makeKeyAndVisible];
return YES;

Simply initialize your login view controller and add it after the tabcontroller, like this:

initialScreenViewController = [[InitialScreenViewController alloc] init];
[window addSubview:tabcontroller.view];
[window addSubview:initialScreenViewController.view];
[window makeKeyAndVisible];
return YES;

In you login viewcontroller, after authenticating the user you can hide it like this:

[self.parentViewController.view setHidden:YES];

which allows you to show it again if you have a logout feature.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...