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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:26:36+00:00 2026-06-10T00:26:36+00:00

First of all, I’m new to XCode and programming and my English is not

  • 0

First of all, I’m new to XCode and programming and my English is not perfect.
I have 2 view controllers, L1ViewController and ImageViewController. In the L1ViewController i have several buttons with an image as background. What I’m trying to do is when you click a button, the action passes a password and an image to the Image View controller. In the ImageViewController I have a UITextfield and a UIImageView. Passing the password string works fine. But passing the image seems harder than I thought. The UIImageView doesn’t display the image.

In my L1ViewController.h I’ve created a

    -(IBAction)img1; 

In my L1ViewController.m this is the code to pass the image and the passwordstring:

    -(IBAction)img1;
{
ImageViewController *img = [[ImageViewController alloc] initWithImage:[UIImage imageNamed:@"myimage.jpg"] AndAnswerString:@"mypassword"];   
[self presentModalViewController:img animated:NO];
}

In my ImageViewController I have this code to receive the string and the image:

-(id)initWithImage:(UIImage *)inImage AndAnswerString:(NSString *)inAnswerString
{
    if (self = [super init])
    {
        [inImage release];
        [self setImage:inImage];
        [self setAnswerString:inAnswerString];

    }
    return self;
} 
-(void)setImage:(UIImage *)inImage
{
[inImage release];
[logoField setImage:inImage]; 
}

-(void)setAnswerString:(NSString *)inAnswerString
{
answerString = inAnswerString;
}

In my ImageViewController.h I’ve

@interface ImageViewController : UIViewController { 
IBOutlet UITextField *answerField;
IBOutlet UIImageView *logoField;

NSString *answerString;
 }

@property (nonatomic, retain)NSString *logo;
-(id)initWithImage:(UIImage *)inImage AndAnswerString:(NSString *)inAnswerString;
-(void)setImage:(UIImage *)inImage;
-(void)setAnswerString:(NSString *)inAnswerString;

-(IBAction)enterAnswer;
-(IBAction)back;

Why is my answerstring working fine but shows my ImageViewController no image?
Again, I’m new to XCode, maybe it’s just a stupid fault.
Thanks in Advance!

  • 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-06-10T00:26:38+00:00Added an answer on June 10, 2026 at 12:26 am

    When your view controller is being initialized, the views have not been loaded yet. (That happens just before your viewDidLoad: method is called.) Saving the string works because you’re not trying to put it directly into answerField but, with the image, you’re trying to update logoField too early.

    If the text is working, you must have code somewhere that assigns answerString to answerField.

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

Sidebar

Related Questions

(First of all, sorry for my english, it's not my first language) I have
First of all this is all just concept, I have no actual programming done
First of all: I am not an experienced ClearCase user, but I have lots
first of all some details: I configured security as below in web.xml view plaincopy
First of all, I'm quite new to the Android and JAVA world (coming from
First of all, apologize because I have seen some posts about this, but I
First of all I want to mention two things, One: My code isn't perfect
First of all, let me say that I am not a professional coder -
I have 3 cards. at first all cards move to the right, then after
I have movies table with movieID,movieName and movieDate. I want to select first all

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.