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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:59:44+00:00 2026-05-28T01:59:44+00:00

I am trying change an UIImageView from other viewControllers, but I don’t know why

  • 0

I am trying change an UIImageView from other viewControllers, but I don’t know why image does not change !! here is my code :

#import "ViewController.h"

@class ViewController;
@interface CoverGallery : UIViewController {

    ViewController *mainViewController;
}
@property (nonatomic,retain) ViewController *mainViewController;
- (IBAction)img1;

.m

- (IBAction)img1 {

    mainViewController.coverArt.image = [UIImage imageNamed:@"coverDefault.png"];
    [self dismissModalViewControllerAnimated:YES];

}

There is an UIImageView called coverArt in MainViewController , thanks

Here is my button action which switch between views :

ViewController (My First view)
.h

@interface ViewController : UIViewController {
ViewController *mainViewController;

}

@property (nonatomic, retain) ViewController *mainViewController;


.m :

@synthesize mainViewController;


- (void) CoverGallery {

    CoverGallery *gallery = [[CoverGallery alloc] initWithNibName:@"CoverGallery" bundle:nil];
    gallery.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:gallery animated:YES];

//here is the problem, compiler gives me the mainViewController is not the property of CoverGallery
gallery. mainViewController = self;
    ;

}
  • 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-28T01:59:45+00:00Added an answer on May 28, 2026 at 1:59 am

    How are you initializing the property mainViewController? You need set it as the MainViewController by setting its property when you present the modal view.
    I imagine your doing this in the MasterViewController:

      CoverGallery *gallery = [[CoverGallery alloc]initWithNibName:@"CoverGallery" bundle:nil];
        gallery.masterViewContrller = self; //Set it here
        [self presentModalViewController:gallery animated:YES];
    

    I fixed a typo..
    and this:

    ViewController *mainViewController;
    

    should be:

    MainViewController *mainViewController;
    

    but you need to Import it in the same header file.

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

Sidebar

Related Questions

I'm trying to change the menu here from mouse over to a on click
I am trying to crop image by my custom cropper. Not from the UIImagePickerController's.
Why does this code not work? preview[currentPreview].frame = CGRectMake(0, 320, 480, 320); preview[currentPreview].image =
Noob Alert, I am trying to change an image in a UIImageView. popCard is
Am trying to change the button frame according to the orientation change but button
I'm trying to change the color of a DataGridTextColumn. Here's what I'm doing: <DataGridTextColumn
Trying to change a button pic, wait a second, then change back. Not having
This' my code in which I'm trying to change the size of my imageView.
I'm trying to resize an image using stretchableImageWithLeftCapWidth: it works on the simulator, but
Trying to change the marker from an overlay item I noticed the setMarker() makes

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.