Tuesday, December 31, 2013

Other class member variables in the calling class

eg:
/ / AViewController.h
# Import

@ Interface AViewController: UIViewController
{
CGPint point;
}

@ Property (nonatomic, assign) CGPoint point;

@ End

/ / AViewController.m
# Import "AViewController.h"

@ Implementation AViewController

@ Synthesize point;

......

@ End

/ / BAppDelegate.h
# Import "AViewController.h"
# Import "......"

@ Class AViewController

@ Interface BAppDelegate: NSObject {
AViewController * a;
}

@ Property (nonatomic, retain) AViewController * a;

- (Void) Func;

...... / / Declare
other functions
@ End

/ / BAppDelegate.m
# Import "BAppDelegate.h"
# Import "......"

@ Implementation BAppDelegate

@ Synthesize a;

- (Void) Func {
CGPoiunt pt = a.point ;/ / not visit, this is why? The error message is the first time you use the point, I did not declare
}

...... / / Other functions to achieve

@ End



As mentioned above, why can not I call it? Which DX help resolve brother, thank you first!
Reply:
Their top, always do not understand, these days have been plagued, there is the point I set @ public does not work, well, even though I used the function's return value is also not visit, did not even function way calling, very puzzled! ! ! Who can help me ~
Reply:
Can the rest of the code is also sent to? Or send to nicktc78@hotmail.com
Reply:
reference to the second floor nicktang reply:
whether the code is also sent to the other? Or send to nicktc78@hotmail.com

Also described is not clear enough? I just do not understand this you ~
Reply:
In the class body you use a CGPint, whether it is a typo?
There @ property (nonatomic, assign) CGPoint point;
Can replace the @ property CGPoint point;

Reply:
references, 4th Floor nicktang reply:
in class body you use a CGPint, whether it is a typo?
There @ property (nonatomic, assign) CGPoint point;
Can replace the @ property CGPoint point;


Is a typo, Sorry, I was a direct hit to their work. Is the point; And I also replaced the @ property CGPoint point; too, unfortunately or not. Even the set of global variables will not work. extern CGPoint point;
Reply:
I now think it is not initialized problems? I is an example of the initialization of such
AViewController * a;
a = [[AViewController alloc] init];

Reply:
CGPoiunt pt = [a point];
Reply:
Write your own method to instantiate the class which is kind of how?
Reply:
If you can, put the code sent to the mailbox, Nicktc78@hotmail.com, I can help you look.
Reply:
reference to the 9th floor nicktang reply:
If you can, put the code sent to the mailbox, Nicktc78@hotmail.com, I can help you look.

Thank you ~ I sent you tomorrow, I am using XP, and Apple Computer another student in the study!
Reply:
reference to the 8th floor cljlove reply:
write your own method to instantiate the class which is kind of how?

AViewController * a;
a = [[AViewController alloc] init];
No other examples of methods used before the test time is - (void) getPint;
Reply:
Gone back to your mail, please check

No comments:

Post a Comment