I need some info about how to pass data between classes.. To be specific, I want to store in a class in an array some info, (using model store class), and then use it in another class..
相关问题
- CALayer - backgroundColor flipped?
- What uses more memory in c++? An 2 ints or 2 funct
- 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?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
I've posted some alternatives to the delegate pattern in Q&A What are alternatives to “delegates” for passing data between controllers?.
If you don't know how to do that, it's seems that you're at the very beginning of learning Objective-c and OO programming. So you better have some time to read about it
A good place to start is here
You can do like:
For example: you want to pass
Array
fromFirstViewController
toSecondViewController
.Create
Array
inSecondViewController
first and define it as property as in SecondViewController.h:In SecondViewController.m:
Then, for example, you want to pass
Array
when a button inFirstViewController
is touched. In its action (create IBAction, link it with the button'stouchesUpInside
), you can set it to get the instance of your second view controller, for example:create an object of second class(MySecondView *objMySecondView=[MySecondView alloc]init];) in your first class. then pass value to array2 from array of first class. like