I am working on an app in which I want to pass an object of a class from one UIViewController to another, How I can do that?
相关问题
- Do the Java Integer and Double objects have unnece
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Poor Use Case of Object.assign() - Simple Example
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
Say you have a
firstViewController
and asecondViewController
. Say, you want to pass on aNSString *testString;
from the first to the second view.In that case, you should declare this NSString using
@property
in the secondViewController.h-file, and@synthesize
it in the secondViewController.m-file.In the firstViewController, when you create an instance of the secondViewController (through
secondViewController *secondView = [[secondViewController alloc] initWith...];
, use the line:secondView.stringYouCreatedUsingSynthesize = testString;
when you initialize your new View Controller define a variable as follows:
Don't forget you have to define an object of type (MyClass) in NextViewController.
Sample
NextViewController.h
NextViewController.m