English 中文(简体)
如何在每次用户登录到应用程序时都选择一个标签?
原标题:How to make a tab selected everytime the user logs into the application?

在我的应用程序中, I 正在使用一个制表栏控制器, 它包含 4 个制表符 。 在其中的一个制表符中, 将功能登录退出 。 如何设置?

最佳回答

这样做:

TabBarController* tabBar =  thisIsYourTabBarInstance; //
[tabBar setSelectedIndex:4];

获取 TabBar 控制器,以在您的标签子子目录 UIViewCentral 使用

TabBarController* tabBar = [self tabBarController];

像这样的 App 代表方式

AppDelegate.h 文件

- (void)userIsLoggedOut;

和 Appdelegagate.m 文件

- (void)userIsLoggedOut    
{
    TabBarController* tabBar =  thisIsYourTabBarInstance; //
    [tabBar setSelectedIndex:4];
}

现在写入此内容的任意位置 :

AppDelegate *d= (AppDelegate*)[UIApplication sharedApplication].delegate;
[d userIsLoggedOut];
问题回答

在日志上设置 NSSerDefault, 以决定在 AppDelegate 的制表符控制器中先显示哪个视图 。

您可以在您的 TabBar 控制器的 Load 方法视图中设置活动标签

[自制制制 [自制制制 设置选定的 Index:0] ;





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签