我想在登录页面后打开如果用户已经登录但是如果用户没有登录,那么只打开登录页面,我使用的是NSUser默认设置,只有当用户单击标签栏并且用户双击标签栏然后打开登录页面,因为我将登录页面连接到标签栏。所以我怎样才能在登录页面后每次打开#34;如果用户已登录,则用户单击标签栏按钮上的单击或多次点击。
答案 0 :(得分:0)
根据你........ ...在Yor登录视图控制器中保存登录状态的Bool类型变量....
-(void)viewWillAppear:(BOOL)animated
{
BOOL isLogin=[[NSUserDefaults standardUserDefaults]boolForKey:@"LoginUser"];
if (isLogin==YES)
{
[logoutBtn removeTarget:self action:@selector(loginAndRegister) forControlEvents:UIControlEventTouchUpInside];
[logoutBtn addTarget:self action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];
}
else
{
[logoutBtn removeTarget:self action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];
[logoutBtn addTarget:self action:@selector(loginAndRegister) forControlEvents:UIControlEventTouchUpInside];
}
[self willAnimateRotationToInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation duration:1.0];
}