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 6975557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:23:01+00:00 2026-05-27T17:23:01+00:00

I have a code in the viewDidLoad and others method, and i want to

  • 0

I have a code in the viewDidLoad and others method, and i want to reload them if i click on a button, i already try the setNeedDisplay but it doesn’t work, i don’t know if i using it in the right sens?

This my code in the viewDidLoad:

     - (void)viewDidLoad
  {
      // Create the UISegmentedControler "Next Review" and "Previouse Review"
      UISegmentedControl *paginateReviewSegment  = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Précedent",@"Suivant", nil]];
      paginateReviewSegment.segmentedControlStyle = UISegmentedControlStyleBar;
      [paginateReviewSegment addTarget:self action:@selector(paginateReviews:) forControlEvents:UIControlEventValueChanged];

       UIBarButtonItem *paginateBarButton = [[UIBarButtonItem alloc] initWithCustomView:paginateReviewSegment];
       self.navigationItem.rightBarButtonItem =  paginateBarButton;

      [super viewDidLoad];

     // Get the review selected
      entryReview = [[entriesReview getEntries] objectAtIndex:self.reviewSelected];

    // Resize the UIScrollView
     [self.scrollView setScrollEnabled:YES];
     [self.scrollView setContentSize:self.contentView.frame.size];

    // Add UIView "Content" to UIScrollView
    [self.scrollView addSubview:self.contentView];

   // Set the user name
   userNameLabel.text = entryReview.userName;

   .....
   }

This is the action that i want to use for reloading the UIView:

  - (void)paginateReviews:(UISegmentedControl*)sender
  {
      if (sender.selectedSegmentIndex == 0 && self.reviewSelected != 0)
      {
          self.reviewSelected -= 1; 
          entryReview = [[entriesReview getEntries] objectAtIndex:self.reviewSelected];
          [self.view setNeedsDisplay];

      } else if(sender.selectedSegmentIndex == 0 && self.reviewSelected != ([entriesReview entriesCount] - 1)) 
      {
          self.reviewSelected += 1; 
          entryReview = [[entriesReview getEntries] objectAtIndex:self.reviewSelected];
      }

  }
  • 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-27T17:23:01+00:00Added an answer on May 27, 2026 at 5:23 pm

    [self.view setNeedsDisplay]; doesn’t invoke the [self viewDidLoad];.

    And, we don’t call viewDidLoad manually. I suggest that move the code which you want to invoke into another method and invoke that method in both viewDidLoad and the method binding with your button.

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

Sidebar

Related Questions

I have code that dynamically load 10 different textfields in viewdidload method now if
I have code to create another row (div with inputs) on a button click.
I have a button findTarget_Btn on which I want to call a method moreDetails.
in my iOS app's viewDidLoad method, i have the following line of code: loadDict
I have a UITableView with the following code: - (void)viewDidLoad { [super viewDidLoad]; parser
I have asked this before, but the more I look at other code examples
I have QuickLook (QLPreviewController) almost working how I want it, but because of the
I have some code that I want to run in a utility application whenever
I have code that references a web service, and I'd like the address of
I have code similar to this filtering entries in an Array of Objects: var

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.