user745235
user745235

Reputation:

Change view based on tabbarcontroller item click

I have a HomeView with 1 button, that shows the login form.

When the user logs in, I create the tabbarcontroller with 3 buttons: Home Products Exit

The thing is, if the user, already logged in, clicks on the home button, it will show HomeView and I need to hide the Login button and show a Exit button.

What I can't find is the method to check the item clicked and the view loaded so I am able to work with the buttons.

I have both, Login and Exit buttons, created on Interface builder and linked with your actions and they are also referenced on the code.

Thanks in advance for any help.

Upvotes: 1

Views: 148

Answers (1)

Retterdesdialogs
Retterdesdialogs

Reputation: 3210

you need somthing like that:

BOOL isLoggedIn;

if (isLoggedIn)
{
   // do something, i.e. show Exit button
} else
{
  // do somthing else, i.e show Login button
}

You have to store the BOOL in something like a database or plist or singleton and set it to YES if the user pressed the Login button or NO if the user pressed the Exit button.

Hope this helps

Upvotes: 1

Related Questions