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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:04:50+00:00 2026-05-18T01:04:50+00:00

Assume in an app you have 2 UIButton ‘s, buttonA and buttonB. If you

  • 0

Assume in an app you have 2 UIButton‘s, buttonA and buttonB. If you want to call the FlipsideViewController from these 2 buttons, where the only the difference will be the background images. (i.e.: if buttonA is pressed, BackGroundA will appear in the FlipsideViewController‘s view, otherwise, it will be BackGroundB.)

Now the First BackGround (BackGroundA) is set by default. How do I handle the second background image (BackGroundB) if buttonB is pressed?

  • 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-18T01:04:50+00:00Added an answer on May 18, 2026 at 1:04 am

    Depending on how you are presenting FlipsideViewController, a couple of ways are:

    • Make “background” a property of FlipsideViewController and set it as needed in each button’s action method before showing the vc.
    • Add a custom init method in FlipsideViewController with a “background” parameter.

    “background” could be an int or enum property/parameter and then the code in FlipsideViewController will do whatever it needs to itself based on that value.

    Edit:
    To use the property approach:

    First, in FlipsideViewController, make sure you have an IBOutlet for the UIImageView called say backgroundImageView.

    Next, in FlipsideViewController.h, add a property to set the background (I’m using an int):

    @interface FlipSideViewController : UIViewController {
        int backgroundId;
    }
    @property (assign) int backgroundId;
    

    Next, in FlipsideViewController.m, add this:

    @synthesize backgroundId;
    
    -(void)viewWillAppear:(BOOL)animated
    {
        if (backgroundId == 2)
            self.backgroundImageView.image = [UIImage imageNamed:@"background2.png"];
        else
            self.backgroundImageView.image = [UIImage imageNamed:@"background1.png"];
    }
    

    Finally, in the main view controller, the button action method would look something like this:

    -(IBAction)buttonPressed:(UIButton *)sender
    {
        FlipSideViewController *fsvc = [[FlipSideViewController alloc] initWithNibName:nil bundle:nil];
        fsvc.backgroundId = sender.tag;  //assuming btn1.tag=1 and bnt2.tag=2
        [self presentModalViewController:fsvc animated:YES];
        [fsvc release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume I have an ASP.NET MVC app that's not doing anything too fancy (no
Or vice versa. Update: Hmm, let's assume I have a shopping cart app, the
Assume that we have N erlang nodes, running same application. I want to share
(assume php5) consider <?php $foo = 'some words'; //case 1 print these are $foo;
Assume a table structure of MyTable(KEY, datafield1, datafield2...) . Often I want to either
Assume I have a class foo, and wish to use a std::map to store
I'm using the MVVM pattern in my first WPF app and have a problem
Assume Hibernate for the ORM. I'm not sure how to ask this. I want
I have a Microsoft Access 2010 database(*). Now, using Visual Studio 2010, I want
Assume java 1.6 and leopard. Ideally, it would also be nice to get a

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.