属性“scrollView”需要方法“-scrollView”定义 - 使用@synthesize、@dynamic 还是提供方法实现?

发布于 2024-11-03 01:32:57 字数 720 浏览 1 评论 0原文

这是什么意思?

属性“scrollView”需要定义方法“-scrollView” - 使用@synthesize、@dynamic还是提供方法实现?

它告诉我与 @end 在同一行

#import <UIKit/UIKit.h>

@class ViewScrollViewController;

@interface ViewScrollAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    ViewScrollViewController *viewController;
    UIScrollView *scrollView;
    UITextView *textView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ViewScrollViewController *viewController;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) IBOutlet UITextView *textView;

@end

what does this mean??

property 'scrollView' requires method '-scrollView' to be defined - use @synthesize, @dynamic or provide a method implementation?

it tells me that on the same line as @end

#import <UIKit/UIKit.h>

@class ViewScrollViewController;

@interface ViewScrollAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    ViewScrollViewController *viewController;
    UIScrollView *scrollView;
    UITextView *textView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ViewScrollViewController *viewController;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) IBOutlet UITextView *textView;

@end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开雨落又逢春i 2024-11-10 01:32:57

你是在合成属性吗?

像这样..

//your .h file...
@interface myViewController:UIViewController{
    ScrollView *scrollView;
}
@property(nonatomic,retain)ScrollView *scrollView;
@end


//your .m file

@implementation myViewController
@synthesize scrollView;        //are you doing this?

...
...
...
@end

编辑:基于询问者编辑的问题的代码片段..

在您的.m文件中..

@implementation ViewScrollAppDelegate

@synthesize scrollView,window,viewController,textView;

//Now your implementation..
...
..
@end

Are you synthesizing the property?

Like this..

//your .h file...
@interface myViewController:UIViewController{
    ScrollView *scrollView;
}
@property(nonatomic,retain)ScrollView *scrollView;
@end


//your .m file

@implementation myViewController
@synthesize scrollView;        //are you doing this?

...
...
...
@end

Edit : code snippets based on askers edited question..

In your .m file..

@implementation ViewScrollAppDelegate

@synthesize scrollView,window,viewController,textView;

//Now your implementation..
...
..
@end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文