Created
April 23, 2014 13:46
-
-
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/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Preferences/PSSwitchTableCell.h" | |
@interface JBPLinkSwitchCell : PSSwitchTableCell | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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