Friday, 15 June 2012

iphone - How to make the title of UIBarButtonItem Logout after the first time button is clicked -


I've login button at the top of the bar with a header login when the user clicks the app on the English I want I'll logout the show instead of the same button after login but this title is not changing.

isCLikedLogins is NSString for the first time it does not assume the login is clicked on this Yes.

Here's the code that I'm using

  if ([appDelegate.isClickedLogin isEqualToString: @ "yes"]). {SignIn_BarButton = [[UIBarButtonItem alloc] initWithTitle: @ "logout" style: UIBarButtonItemStyleBordered goal: self action: @selector (login user)]; } Else {signIn_BarButton = [[UIBarButtonItem alloc] initWithTitle: @ "connected" style: UIBarButtonItemStyleBordered goal: self action: @selector (loginUser)]; Self.navigationItem.rightBarButtonItem = signIn_BarButton; }  itemprop = "text"> 

You can do something like this:

  Check BOOL Login;   

.m

  - (zero) visible app: (BOOL) animated {loginCheck = YES; Self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle: @ "English" style: UIBarButtonStyleBordered goal: self action: @selector (loginPressed)}   

your login < / Code> Method:

  - Login (login) Check {self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle: @ "Logout" style: UIBarButtonStyleBordered Target: Self-action : @selector (loginPressed)} else {self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle: @ "connected" style: UIBarButtonStyleBordered goal: self action: @selector (loginPressed)} loginCheck = loginCheck}  < ! / Pre>  

No comments:

Post a Comment