PSListController: Difference between revisions

From iPhone Development Wiki
(A little more documentation.)
(I found a missing semicolon somewhere and this seemed like the best place for it.)
Line 13: Line 13:
         _specifiers = [[self loadSpecifiersFromPlistName:@"Name" target:self] retain];
         _specifiers = [[self loadSpecifiersFromPlistName:@"Name" target:self] retain];
     }
     }
     return _specifiers
     return _specifiers;
}
}
@end
@end
</source>
</source>

Revision as of 05:41, 11 October 2009


PSListController is a class that represents a list of preferences in a table. It supports loading specifiers from a property list (specified at runtime).

Subclassing

This is a simple PSListController subclass that does not offer localization. The only message strictly required is -specifiers.

@interface MyListController : PSListController
@end
@implementation MyListController
- (id)specifiers {
    if(_specifiers == nil) {
        // Loads specifiers from Name.plist from the bundle we're a part of.
        _specifiers = [[self loadSpecifiersFromPlistName:@"Name" target:self] retain];
    }
    return _specifiers;
}
@end