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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:40:13+00:00 2026-06-02T06:40:13+00:00

view1.h #import view2.h @interface ViewController : UIViewController { int count; } @property (nonatomic, assign)

  • 0

view1.h

#import “view2.h"

@interface ViewController : UIViewController 
{
int count;       
}
@property (nonatomic, assign) int count;

in view1.m

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

if([segue.identifier isEqualToString:@"rating"])
{
    NSLog(@"identifier: help %@  \n",segue.identifier);

    view2 *vc = [segue destinationViewController];                                                 
    vc.imageNumber = &(count);

}
}

in view2.h

#import “view1.h"

@interface view2 : UIViewController


@property (nonatomic) int *imageNumber;

in view2.m

- (void)viewDidLoad
{
[super viewDidLoad];

NSLog(@"imagenumber %@\n",imageNumber);    

}

What is wrong here? Ideally I want to be able to send the info both ways… but I’m just trying to figure out what’s wrong with the one way transfer. Thanks.

  • 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-02T06:40:16+00:00Added an answer on June 2, 2026 at 6:40 am
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    
    if([segue.identifier isEqualToString:@"rating"])
    {
        NSLog(@"identifier: help %@  \n",segue.identifier);
    
        view2 *vc = [segue destinationViewController];  
        //viewDidLoad has already happened.                                               
        vc.imageNumber = &(count);
    
    }
    }
    

    You check the int you set in viewDidLoad. viewDidLoad has already happened by the time you are in prepareForSegue. Try changing to use viewWillAppear or viewDidAppear and see what happens then. I think it should all work.

    EDIT
    Sorry i didn’t look at your NSLog closely enough. %@ in a format string, like what you use in NSLog is a stand in for an NSString, assumes the argument is an NSObject and tries to call [imageNumber description] which is obviously nonsensical in this case. In fact you need to use the standard integer marker in the format string and then dereference the pointer. The correct NSLog statement would look like this:

    NSLog(@"imagenumber %d",*imageNumber);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: Header: #import <UIKit/UIKit.h> @interface ViewController : UIViewController { UIImageView *imageView;
I have an IB that contant an UIWebView #import <UIKit/UIKit.h> @interface PostFunHorosViewController : UIViewController<UIWebViewDelegate>{
There are three UIView *view1,view2 , view3; Now, view1 have to be shown at
I have 3 views view1, view2 and view 3. i have a problem of
If I have a custom class called Tires: #import <Foundation/Foundation.h> @interface Tires : NSObject
i have two views with view1 calling view2. i need to pass data from
I have a very simple dialog defined as: import android.app.AlertDialog; import android.content.Context; import android.view.LayoutInflater;
LogIn class where my database is used: package edu.flying.panda.taskmanager; import android.util.Log; import android.view.View; import
I have setup a database view. When users import the data from the view
I have the following models: http://slexy.org/view/s20T8yOiKZ from mxutils.cms_services import generate_secid from django.db import models

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.