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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:39:51+00:00 2026-05-21T06:39:51+00:00

I created two UIImageView *image1 and *image2, after I created a NSMutableArray *arrayImage, now

  • 0

I created two UIImageView *image1 and *image2, after I created a NSMutableArray *arrayImage, now I want fill this array

arrayImage = [[NSMutableArray alloc] initWithObjects: image1, image2, nil];

but I created UIImageView and NSMutableArray in a ClassA but I want fill the NSMutableArray in the viewdidload in .m of ClassB, then Xcode tell me that image1 and image2 are undeclared. I just used property and synthesize. What can I do?

  • 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-21T06:39:51+00:00Added an answer on May 21, 2026 at 6:39 am

    You can try something like this, you have to keep a reference to classB inside classA so that when you want to add a view to array in classB you can access classB’s properties through classA’s clasB property. Try something like this.

    //ClassA .h file 
    #import @"ClassB.h"
    @interface ClassA : UIViewController { 
        UIImageView     *view1, view2*;
        ClassB          *classB; 
    }
    @end
    
    //Inside ClassA .m file 
    -(void)viewDidLoad{
        //construct view1 and view2 here or make the IBOutlets and link them in IB 
        classB = [[ClassB alloc] init];
        [classB.imageArray addObject:view1];
        [classB.imageArray addObject:view2];
    }
    
    //ClassB .h file 
    @interface ClassB : UIViewController {
        NSMutableArray *imageArray; 
    }
    @property(nonatomic, retain) NSMutableArray *imageArray; 
    @end
    
    
    //Inside ClassB .m file
    @synthesize imageArray; 
    
    -(id)init{
        if (self = [super init]){
            imageArray = [[NSMutableArray alloc] init];
        }
        return self; 
    }
    
    -(void)dealloc{
        [imageArray release];
        [super dealloc];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i ve created two dimensional array inside a function, i want to return that
I have created two UIImageView s in my code: UIImageView *background = [[UIImageView alloc]initWithFrame:CGRectMake(150,
I've created two EmacsW32 frames, one for each of my monitors. I want to
I created two ViewControllers (Xcode 4 => Storyboard). After that I created two UIViewSubclasses,
I created two tables: Publisher PK, PublisherId, int, not null, indentity +1 PublisherName, varchar(50),
I created two files in the App_GlobalResources folder: SiteResources.en-US.resx SiteResources.sp-SP.resx Both contain a value
I created two very simple Heroku apps to test out the service, but it's
I've created two functions to load expanded views of a month in the archive
I've created two classes, with one of them having an implicit cast between them:
I have created two forms in my Windows Application. One Form acts as 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.