(Added to Preferences category) |
m (Formatting and IPFHeader replacement.) |
||
Line 1: | Line 1: | ||
[[PSDetailController]] is a view controller controlling a custom [[PSEditingPane|editing pane]]. | [[PSDetailController]] is a view controller controlling a custom [[PSEditingPane|editing pane]]. | ||
= Detail controller in Specifier plist = | |||
PSDetailController is in fact a misnomer, because the ''detail'' key in the [[preferences specifier plist]] can be any [[PSViewController]] (usually a subclass of [[PSListController]]). Actually, the only requirement of the ''detail'' key is the class must adopt the informal protocol | PSDetailController is in fact a misnomer, because the ''detail'' key in the [[preferences specifier plist]] can be any [[PSViewController]] (usually a subclass of [[PSListController]]). Actually, the only requirement of the ''detail'' key is the class must adopt the informal protocol | ||
<source lang="objc"> | <source lang="objc"> | ||
@protocol PSDetailController <PSViewController> | @protocol PSDetailController <PSViewController> | ||
Line 12: | Line 14: | ||
@end | @end | ||
</source> | </source> | ||
The ''detail'' controller class will be sent a <tt>+validateSpecifier:</tt> message if one exists right after the bundle is lazy-loaded: | The ''detail'' controller class will be sent a <tt>+validateSpecifier:</tt> message if one exists right after the bundle is lazy-loaded: | ||
<source lang="objc"> | <source lang="objc"> | ||
@implementation PSRootController | @implementation PSRootController | ||
Line 24: | Line 28: | ||
@end | @end | ||
</source> | </source> | ||
Whenever a view becomes visible, a detail controller class instance will be allocated with <tt>-initForContentSize:</tt>, and then call <tt>-viewWillBecomeVisible:</tt> to notify that the view becomes visibile. There is also some other calls to the controller but you'd better leave them untouched. | Whenever a view becomes visible, a detail controller class instance will be allocated with <tt>-initForContentSize:</tt>, and then call <tt>-viewWillBecomeVisible:</tt> to notify that the view becomes visibile. There is also some other calls to the controller but you'd better leave them untouched. | ||
<source lang="objc"> | <source lang="objc"> | ||
... | ... | ||
Line 36: | Line 42: | ||
</source> | </source> | ||
{{occlass|library=Preferences.framework|navbox=1}} | |||
{{ | |||
[[Category:Preferences]] | [[Category:Preferences]] |
Revision as of 19:39, 2 January 2016
PSDetailController is a view controller controlling a custom editing pane.
Detail controller in Specifier plist
PSDetailController is in fact a misnomer, because the detail key in the preferences specifier plist can be any PSViewController (usually a subclass of PSListController). Actually, the only requirement of the detail key is the class must adopt the informal protocol
@protocol PSDetailController <PSViewController>
-(id)initForContentSize:(CGSize)size;
-(void)viewWillBecomeVisible:(PSSpecifier*)spec;
-(void)handleURL:(NSURL*)url;
@optional
+(void)validateSpecifier:(PSSpecifier*)srcSpecifier;
@end
The detail controller class will be sent a +validateSpecifier: message if one exists right after the bundle is lazy-loaded:
@implementation PSRootController
...
-(void)lazyLoadBundle:(PSSpecifier*)srcSpecifier {
...
if ([srcSpecifier->detailControllerClass respondsToSelector:@selector(validateSpecifier:)])
[srcSpecifier->detailControllerClass validateSpecifier:srcSpecifier];
}
...
@end
Whenever a view becomes visible, a detail controller class instance will be allocated with -initForContentSize:, and then call -viewWillBecomeVisible: to notify that the view becomes visibile. There is also some other calls to the controller but you'd better leave them untouched.
...
id<PSDetailController> detailController = [[[spec->detailControllerClass alloc]
initForContentSize:someListController.view.bounds.size]
autorelease];
detailController.rootController = _parentController.rootController;
detailController.parentController = _parentController;
[detailController viewWillBecomeVisible:spec];
...
|