Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Im a bit confused to what your trying to accomplish, do you want to use an NSString or the text UITextField in another class? If thats the case give the string that is carrying whatever you want to be displayed a <code>@property</code>, then set whatever you want the strings value to it, next import the <code>calc.h</code> (<code>#import "calc.h"</code>) in the second class, then in the interface create this <code>calc *getString;</code> create a <code>@property</code> for that, <code>@synthesize</code> it. Then to get the value of the string from calc do something like this <code>getString.SomeStringName</code>, now you are able to do whatever you want with it. </p> <p>I think this is what you want? if not feel free to comment. Good Day :)</p> <p>Edit: Im going to give you an example because this is a bit confusing the way i wrote it lol</p> <p>So here is your calc.h file, also remember im typing this online and not in xcode, so if i spell something wrong or make a simple mistake, thats why:</p> <pre><code>@interface calc : UIViewController { NSString *answer; } @property (nonatomic, retain) NSString *answer; @end </code></pre> <p>Your .h could have more</p> <p>Now lets hop into your .m</p> <pre><code>@implementation calc @synthesize answer; //do all the work to get the answer, once you have it do this [answer retain]; //load your new view controller </code></pre> <p>Lets hop into your other view controller that will be loaded</p> <p>this is .h file of it</p> <pre><code>#import "calc.h" @interface secondController : UIViewController { calc *getAnswer; } @property (nonatomic, retain) calc *getAnswer; @end </code></pre> <p>Then go to your .m </p> <pre><code>@implementation secondController @synthesize getAnswer; -(void)viewDidLoad{ WhateverYouWantTheStringToBeSetTo.text = getAnswer.Answer; } </code></pre> <p>This should then grab the string from the other controller and allow you to use it in this one..</p> <p>Hope this helps :) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload