Skip to content

Instantly share code, notes, and snippets.

@Jon889
Created April 23, 2014 13:46
Show Gist options
  • Save Jon889/11215754 to your computer and use it in GitHub Desktop.
Save Jon889/11215754 to your computer and use it in GitHub Desktop.
Start of a Preferences cell that is both a link and switch (http://www.reddit.com/r/jailbreak/comments/23pdba/really_like_the_way_how_speedyhomey_set_his/)
#import "Preferences/PSSwitchTableCell.h"
@interface JBPLinkSwitchCell : PSSwitchTableCell
@end
#import "JBPLinkSwitchCell.h"
@interface UITableViewCell (private)
-(CGRect)accessoryRectForBounds:(CGRect)arg1 accessoryView:(id)arg2 isCustom:(BOOL)arg3;
@end
@implementation JBPLinkSwitchCell
- (id)initWithStyle:(int)style reuseIdentifier:(NSString *)reuseIdentifier specifier:(id)specifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier specifier:specifier]) {
[self setSelectionStyle:UITableViewCellSelectionStyleDefault];
[self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
[self setAccessoryView:nil];
UIView *control = [[self control] retain];
[self setControl:nil];
[self setControl:control];
[control release];
}
return self;
}
-(void)layoutSubviews {
[super layoutSubviews];
UIView *c = [self control];
[c setFrame:[(UITableViewCell *)self accessoryRectForBounds:[[c superview] bounds] accessoryView:c isCustom:YES]];
}
@end
// vim:ft=objc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment