私はQuickLookのフレームワークからのプロトコルがあります。実装iOSのprocotol - 読み取り専用プロパティ
/*!
* @abstract The QLPreviewItem protocol declares the methods that a QLPreviewController instance uses to access the contents of a given item.
*/
@protocol QLPreviewItem <NSObject>
@required
/*!
* @abstract The URL of the item to preview.
* @discussion The URL must be a file URL.
*/
@property(readonly) NSURL * previewItemURL;
@optional
/*!
* @abstract The item's title this will be used as apparent item title.
* @discussion The title replaces the default item display name. This property is optional.
*/
@property(readonly) NSString * previewItemTitle;
@end
/*!
* @abstract This category makes NSURL instances as suitable items for the Preview Controller.
*/
@interface NSURL (QLPreviewConvenienceAdditions) <QLPreviewItem>
@end
を私は私のカスタムタイルを追加することができるように読み取り専用プロパティpreviewItemTitleのgetterとsetterを作成しようとしています:
の.h
#import <Foundation/Foundation.h>
#import <QuickLook/QuickLook.h>
@interface QLPreviewItemCustom : NSObject <QLPreviewItem> {
NSURL * previewItemURL;
NSString *previewItemTitle;
}
@property(readonly) NSURL * previewItemURL;
@property (readonly) NSString *previewItemTitle;
@end
.M
#import "QLPreviewItemCustom.h"
@implementation QLPreviewItemCustom
@synthesize previewItemTitle;
@synthesize previewItemURL;
@end
このように、私が理解するように、私はsynthesizeメソッドを使ってゲッターを作成します。どのようにして設定者を作成できますか?
なぜとして
_Name
と財産を経由して直接フィールドにアクセスすることができますあなたはreadonlyプロパティのためのセッターが必要ですか? – Antiglukこれは、Quick Titleフレームワークのドキュメントに記載されているので、カスタムタイトルを設定する必要があるためです。 – Benites