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 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

HI I have a app where I want to load a UIViewController from a
Assume that I have Silverlight app doing a call to a WCF service: void
Assume I have a Cocoa-based Mac or iOS app. I'd like to run a
I want build a sketch pad app on iPhone, I assume that this type
Assume I have an enumerable object enum and now I want to get the
Assume we have two apps. Is it possible for app A to have a
I currently have 2 apps in the market, let's call them app A and
Lets assume you have a app that opens a socket port for communication purposes.
Assume you have two XCode4 projects App Library Since the Library is active developing,
Assume you have built (coded) your MVC Sencha Touch App with a bunch of

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.