diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2017-03-10 21:46:41 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2017-03-10 21:46:41 -0800 |
commit | 2db33ea12fcfa87654ecf0ba54db21786f1fe821 (patch) | |
tree | e9a4d0a0aa132ad14e9d7cd4e57bddfe97852a1c | |
parent | b06c11a9a99fab3c65a793cc2deb020a3e762311 (diff) |
Transfer shared content code to CyteTableViewCell.
-rw-r--r-- | CyteKit/TableViewCell.mm | 13 | ||||
-rw-r--r-- | MobileCydia.mm | 26 |
2 files changed, 14 insertions, 25 deletions
diff --git a/CyteKit/TableViewCell.mm b/CyteKit/TableViewCell.mm index 827440b..1b9152e 100644 --- a/CyteKit/TableViewCell.mm +++ b/CyteKit/TableViewCell.mm @@ -56,6 +56,19 @@ bool highlighted_; } +- (instancetype) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { + if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) { + UIView *content([self contentView]); + CGRect bounds([content bounds]); + + self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; + [self.content setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)]; + [content addSubview:self.content]; + + [self.content setDelegate:(id<CyteTableViewCellDelegate>)self]; + } return self; +} + - (void) _updateHighlightColorsForView:(UIView *)view highlighted:(BOOL)highlighted { if (view == (UIView *) content_) highlighted_ = highlighted; diff --git a/MobileCydia.mm b/MobileCydia.mm index 302f7d0..4be6750 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -5337,14 +5337,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (PackageCell *) init { CGRect frame(CGRectMake(0, 0, 320, 74)); if ((self = [super initWithFrame:frame reuseIdentifier:@"Package"]) != nil) { - UIView *content([self contentView]); - CGRect bounds([content bounds]); - - self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; - [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; - [content addSubview:self.content]; - - [self.content setDelegate:self]; [self.content setOpaque:YES]; } return self; } @@ -5560,15 +5552,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { switch_ = [[[UISwitch alloc] initWithFrame:CGRectMake(218, 9, 60, 25)] autorelease]; [switch_ addTarget:self action:@selector(onSwitch:) forEvents:UIControlEventValueChanged]; - UIView *content([self contentView]); - CGRect bounds([content bounds]); - - self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; - [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; - [content addSubview:self.content]; [self.content setBackgroundColor:[UIColor whiteColor]]; - - [self.content setDelegate:self]; } return self; } @@ -7524,20 +7508,12 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi - (SourceCell *) initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) { - UIView *content([self contentView]); - CGRect bounds([content bounds]); - - self.content = [[[CyteTableViewCellContentView alloc] initWithFrame:bounds] autorelease]; - [self.content setAutoresizingMask:UIViewAutoresizingFlexibleBoth]; [self.content setBackgroundColor:[UIColor whiteColor]]; - [content addSubview:self.content]; - - [self.content setDelegate:self]; [self.content setOpaque:YES]; indicator_ = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGraySmall] autorelease]; [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin];// | UIViewAutoresizingFlexibleBottomMargin]; - [content addSubview:indicator_]; + [[self contentView] addSubview:indicator_]; [[self.content layer] setContentsGravity:kCAGravityTopLeft]; } return self; |