首页 > cocoa-在.h文件里有同名的IBOutlet和一个property?

cocoa-在.h文件里有同名的IBOutlet和一个property?

在学习源码的时候碰到了问题

#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "TimerPopoverViewController.h"

@class TimerLogic;
@class TimerInfo;

@interface TimerPopoverDelegate : NSObject <NSPopoverDelegate> {
@private
    IBOutlet NSPopover *popover;  //#1
    IBOutlet NSWindow *detachWindow;
    IBOutlet TimerPopoverViewController *viewController;
}

@property NSPopover *popover;  //#2

- (void)showPopover:(id)sender timerInfo:(TimerInfo *)timerInfo;

@end

为什么声明了两个popover?
感觉没有理解透彻property,谁能解释一下吗?


类成员还是私有 类外不能访问的
property是属性~
属性是为一个方法自动创建一个getter和一个setter 这样类外就能通过属性提供的两个方法访问你的成员变量

【热门文章】
【热门文章】