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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:54:37+00:00 2026-05-22T19:54:37+00:00

i have two controller in view1.h i have NSString *bg; @interface Lottery5ViewController : UIViewController

  • 0

i have two controller

in view1.h i have

NSString *bg;
@interface Lottery5ViewController : UIViewController {...}

in view2.m i have

-(IBAction) switchView2{
self.bg = @"blueButton.png";
}

but it cannot compile and said
request for member ‘bg’ in something not a structure or union

i just want to modify the value of a variable in view1 from view2

  • 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-22T19:54:37+00:00Added an answer on May 22, 2026 at 7:54 pm

    Your problem is that in view2‘s switchView2 method you are calling self and trying to change an ivar (or property, not sure which it is from the code shown) of a different class. If you want to send something from one instance to another you have to establish some sort of connection between them first. There are a few ways you can get them talking. The better ways to be able to pass something like this is to set up a delegate protocol or use notifications, then view2 could call the delegate method that makes the change in view1 or post a notification that view1 would be registered for so that it could make the change. The less desirable way to accomplish this would be to give view2 an ivar (or property) that is view1. You would then be able to use something like view1.bg = @"blueButton.png";.

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

Sidebar

Related Questions

I have two controllers which share most of their code (but must be, nonetheless,
I have two View Controllers: TableViewController (which is used as a modal view controller)
I have two UIPickerViews set up on one view under the same view controller.
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I have two applications written in Java that communicate with each other using XML
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two elements: <input a> <input b onclick=...> When b is clicked, I
I have two identical tables and need to copy rows from table to another.
I have two classes, and want to include a static instance of one class

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.