Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6688613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:25:23+00:00 2026-05-26T05:25:23+00:00

I have a login/signup page that is changed using a segmented control. The login

  • 0

I have a login/signup page that is changed using a segmented control. The login page is generic and the self.title = @”login” and the bar item = login to send login request. However when the user selected the signup segmented control I want to refresh the navigation bar to display the self.title = @”Sign Up” and the bar button = sign up to send a register request. I have used this code in the segmented control is:

if (segmentedControl.selectedSegmentIndex == 0) 
    {
        UIBarButtonItem * sortButton = [[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleBordered target:self action:@selector(LoginButton)];

        self.navigationItem.rightBarButtonItem = sortButton;
        [sortButton release];

        self.title = @"Login";
    }
    else if (segmentedControl.selectedSegmentIndex == 1)
    {
        UIBarButtonItem * sortButton = [[UIBarButtonItem alloc] initWithTitle:@"Submit" style:UIBarButtonItemStyleBordered target:self action:@selector(Submit)];

        self.navigationItem.rightBarButtonItem = sortButton;
        [sortButton release];

        self.title = @"Submit";

    }

I also have the segmented control set up and working :

- (IBAction)segmentSwitch:(id)sender 
{
    UISegmentedControl *segmentedControl = (UISegmentedControl *) sender;
    NSInteger selectedSegment = segmentedControl.selectedSegmentIndex;

    if (selectedSegment == 0) 
    {
        //toggle the correct view to be visible
        [firstView setHidden:NO];
        [secondView setHidden:YES];
    }
    else
    {
        //toggle the correct view to be visible
        [firstView setHidden:YES];
        [secondView setHidden:NO];
    }
}

Andy help would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:25:24+00:00Added an answer on May 26, 2026 at 5:25 am

    Assuming the first block of code is located in the viewDidLoad method, you’ll need to change your UIViewController so that the title and button are altered when the UISegmentedControl‘s value changes. In other words, try moving the first block of code to the segmentSwitch: method.

    The reason why your code isn’t working is because viewDidLoad only gets called once, and so the first block of code is only executed once, while you want it executed every time the user selects a new segment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally we have login page with username, password filed and signin button. Using the
I have to login into a https web page and download a file using
I have a site that uses FB Login/Signup button. This button is handled by
Hi I want to create a WCF service that have login method, which is
Basically, I currently have login/ in urls.py redirect to the django.contrib.auth.views.login and that seems
I have a Login button that I want to be disabled until 3 text
I have a login page where I authenticate the user. When the authentication pass,
I have a login screen that I force to be ssl, so like this:
I am using Authlogic to do some simple signup and login stuff. In my
i have menu structure like below, <ul> <li class=menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-1406

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.