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

  • Home
  • SEARCH
  • 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 4118526
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:58:19+00:00 2026-05-20T22:58:19+00:00

I have several buttons that set some variables for another class (via extern). Thing

  • 0

I have several buttons that set some variables for another class (via extern). Thing is this variables change the maximumValue of a slider and the image of a UIImage.

I am doing this through the viewDidLoad method, problem is the view did load works only the first time I load that controller.

Here’s the code of how I’m loading the controller on Home.m:

- (void)openPagesFrom:(int)pageStart to:(int)pageEnd name:(NSString *)title{

    […]

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
    [UIView setAnimationDuration:0.7];

    if(self.pagesController == nil){
        Pages *pagesControllerCopy = [[Pages alloc] initWithNibName:@"Pages" bundle:nil];
        self.pagesController = pagesControllerCopy;
        [pagesControllerCopy release];
    }
    [self.view insertSubview:pagesController.view atIndex:1];

    [UIView commitAnimations];  
}

I remove the view like this on Pages.m:

- (IBAction)goHome:(id)sender{
    // animate transition
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view.superview cache:YES];
    [UIView setAnimationDuration:0.7];

    [self viewWillAppear:YES];
    [super viewWillAppear:YES];

    // ****************************
    [self.view removeFromSuperview];
    // ****************************

    [self viewDidDisappear:YES];
    [super viewDidAppear:YES];

    [UIView commitAnimations];
}

On that same file, the viewDidLoad method looks like this:

 - (void)viewDidLoad {
    [super viewDidLoad];

    [myScrollView setContentSize:CGSizeMake(1024, 1420)];

    NSString *initPage = [NSString stringWithFormat:@"P%d.jpg",currentPage];
    imagePlaceholder.image = [UIImage imageNamed:initPage];

    // set new values for Slider 
    pageSlider.minimumValue = currentPage;
    pageSlider.maximumValue = totalBookPages;
}

Any idea of how I could I do it so it will always get my values every time one of the buttons is changed? I’m open to different views on how to make this more efficient. One could be properly unloading the whole ViewController, which I’m clearly not doing right. Maybe there’s a simpler solution.

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-20T22:58:19+00:00Added an answer on May 20, 2026 at 10:58 pm

    Try to use the -(void)viewWillAppear:(BOOL)animated method instead!

    That method /should/ work for you!

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

Sidebar

Related Questions

I've some CSS problem in Firefox 3. I have several image buttons on my
I have several wpf pages with update/delete/add buttons. I want to display to the
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on
We have several jobs that run concurrently that have to use the same config
I have several old 3.5in floppy disks that I would like to backup. My
I have several applications that are part of a suite of tools that various
I have several ASP:TextBox controls on a form (about 20). When the form loads,
I have several tables whose only unique data is a uniqueidentifier (a Guid) column.
We have several wizard style form applications on our website where we capture information
I have several user controls, let's say A , B , C and D

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.