eg:
//AViewController.h
#import<UIKit/UIKit.h>@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<UIApplicationDelegate>{
AViewController *a;
}@property (nonatomic, retain) AViewController *a;-(void) Func;……//别的函数的声明@end//BAppDelegate.m
#import "BAppDelegate.h"
#import "……"@implementation BAppDelegate@synthesize a;-(void) Func{
CGPoiunt pt = a.point;//访问不到,这是为什么呢? 错误信息是在第一次使用point时,我没有声明
}……//别的函数的实现@end如上所述,为什么我会调用不到呢? 哪位DX帮忙小弟解决一下,谢谢先!
//AViewController.h
#import<UIKit/UIKit.h>@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<UIApplicationDelegate>{
AViewController *a;
}@property (nonatomic, retain) AViewController *a;-(void) Func;……//别的函数的声明@end//BAppDelegate.m
#import "BAppDelegate.h"
#import "……"@implementation BAppDelegate@synthesize a;-(void) Func{
CGPoiunt pt = a.point;//访问不到,这是为什么呢? 错误信息是在第一次使用point时,我没有声明
}……//别的函数的实现@end如上所述,为什么我会调用不到呢? 哪位DX帮忙小弟解决一下,谢谢先!
解决方案 »
- address doesn't contain a section that points to a section in a object file
- 分享:iOS/iPhone学习系列、代码教程----~~~持续更新中~~~
- objective-c中能够直接调用C语言写的函数吗?
- html+javascript+IOS
- ios8 reloaddata问题
- ios传参数的简单问题
- ios企业证书打包操作
- 我用NSLog 的那个样式? 各位亲帮个忙。
- ios10系统以上无法进行https请求
- iOS 系统计算器怎么调用?URL Scheme 是什么
- iphone开发 读取文本,中文乱码
- const char 与 NSString的问题 或者 是其他问题
还有@property(nonatomic, assign) CGPoint point;
能否换成@property CGPoint point;
是笔误,Sorry,我是直接打上去的。是point; 还有 我也换成@property CGPoint point;过,可惜还是不行。连设置成全局变量都不行。 extern CGPoint point;
AViewController *a;
a = [[AViewController alloc]init];
a = [[AViewController alloc]init];
没有其他实例化方法,之前测试的时候用的是-(void)getPint;