m (Added to Preferences category) |
m (Formatting.) |
||
Line 1: | Line 1: | ||
[[PSRootController]] is an abstract class that represents the root controller in a Preferences-like application. | [[PSRootController]] is an abstract class that represents the root controller in a Preferences-like application. | ||
= Subclassing = | |||
A subclass of PSRootController should override <tt>-setupRootListForSize:</tt>. According to how [[Preferences.app]] is implemented, the method should look like this: | A subclass of PSRootController should override <tt>-setupRootListForSize:</tt>. According to how [[Preferences.app]] is implemented, the method should look like this: | ||
Line 24: | Line 25: | ||
</source> | </source> | ||
= Using = | |||
To add the root controller view to your app, use this code: | To add the root controller view to your app, use this code: | ||
<source lang="objc"> | <source lang="objc"> | ||
-(void)applicationDidFinishLaunching:(UIApplication *)application { | -(void)applicationDidFinishLaunching:(UIApplication *)application { | ||
Line 37: | Line 40: | ||
</source> | </source> | ||
== | = External links = | ||
* Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/Preferences/PSRootController.h | * Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/Preferences/PSRootController.h | ||
{{occlass|library=Preferences.framework|navbox=1}} | {{occlass|library=Preferences.framework|navbox=1}} | ||
[[Category:Preferences]] | [[Category:Preferences]] |
Revision as of 19:44, 2 January 2016
PSRootController is an abstract class that represents the root controller in a Preferences-like application.
Subclassing
A subclass of PSRootController should override -setupRootListForSize:. According to how Preferences.app is implemented, the method should look like this:
@interface MyRootController : PSRootController
@end
@implementation MyRootController
-(void)setupRootListForSize:(CGSize)size {
PSSpecifier* spec = [[PSSpecifier alloc] init];
PSListController* root = [[myFirstListController alloc] initForContentSize:size];
[spec setTarget:root];
root.rootController = self;
[root viewWillBecomeVisible:spec];
[spec release];
root.parentController = self;
[self pushController:root];
[root release];
}
@end
Using
To add the root controller view to your app, use this code:
-(void)applicationDidFinishLaunching:(UIApplication *)application {
...
window.frame = [UIScreen mainScreen].applicationFrame;
...
MyRootController* rootCtrler = [[MyRootController alloc] initWithTitle:@"Some Title" identifier:@"com.yourcompany.appName"];
[window addSubview:[rootCtrler contentView]];
...
}
External links
- Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/Preferences/PSRootController.h
|