【问题标题】:property 'scrollView' requires method '-scrollView' to be defined - use @synthesize, @dynamic or provide a method implementation?属性 'scrollView' 需要定义方法 '-scrollView' - 使用 @synthesize、@dynamic 还是提供方法实现?
【发布时间】:2011-04-25 02:56:02
【问题描述】:

这是什么意思??

属性 '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

【问题讨论】:

    标签: ios cocoa-touch uiscrollview scrollview


    【解决方案1】:

    你在合成属性吗?

    像这样..

    //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
    

    编辑:根据提问者编辑的问题编写代码 sn-ps..

    在你的 .m 文件中..

    @implementation ViewScrollAppDelegate
    
    @synthesize scrollView,window,viewController,textView;
    
    //Now your implementation..
    ...
    ..
    @end
    

    【讨论】:

    • 您可以单击“已编辑 XX 分钟”以直观地识别编辑差异。新文本标记为绿色,删除的文本标记为红色。您忘记了 @synthesize 中的分号。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多