NewsBlur/clients/ios/Classes/MenuTableViewCell.m
David Sinclair bb4c258b71 iOS: #1201 (show hidden stories)
- Implemented the feature, showing or hiding hidden stories, only offering it if there are some.
- I used the “all” icon in the menu as a placeholder; please provide one you’d prefer.
- Since the crusty old menu mechanism doesn’t handle dynamic items well, I took this opportunity to migrate the feed detail menu to the block-based MenuViewController mechanism, resulting in significant code reduction.
- Enhanced MenuViewController to support the theme controls etc, so other menus can be more easily migrated next time they need to be updated.
2019-06-21 20:09:09 -07:00

69 lines
2.5 KiB
Objective-C

//
// MenuTableViewCell.m
// NewsBlur
//
// Created by Samuel Clay on 10/16/12.
// Copyright (c) 2012 NewsBlur. All rights reserved.
//
#import "MenuTableViewCell.h"
@implementation MenuTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.destructive = NO;
self.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
[self setSeparatorInset:UIEdgeInsetsMake(0, 38, 0, 0)];
UIView *background = [[UIView alloc] init];
[background setBackgroundColor:UIColorFromRGB(0xFFFFFF)];
[self setBackgroundView:background];
UIView *selectedBackground = [[UIView alloc] init];
[selectedBackground setBackgroundColor:UIColorFromRGB(0xECEEEA)];
[self setSelectedBackgroundView:selectedBackground];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat indent = self.indentationLevel * self.indentationWidth;
self.imageView.bounds = CGRectMake(indent, 0, self.frame.size.height, self.frame.size.height);
self.imageView.frame = CGRectMake(indent, 0, self.frame.size.height, self.frame.size.height);
self.imageView.contentMode = UIViewContentModeCenter;
self.textLabel.frame = CGRectMake(indent + self.imageView.frame.size.width, 0,
self.frame.size.width - self.imageView.frame.size.width - indent,
self.frame.size.height);
if (self.destructive) {
self.textLabel.textColor = UIColorFromFixedRGB(0xff0000);
self.textLabel.highlightedTextColor = UIColorFromFixedRGB(0xff0000);
} else {
self.textLabel.textColor = UIColorFromRGB(0x303030);
self.textLabel.highlightedTextColor = UIColorFromRGB(0x303030);
}
self.textLabel.backgroundColor = [UIColor clearColor];
self.textLabel.shadowColor = UIColorFromRGB(0xF0F0F0);
self.textLabel.shadowOffset = CGSizeMake(0, 1);
self.backgroundColor = UIColorFromRGB(0xFFFFFF);
self.backgroundView.backgroundColor = UIColorFromRGB(0xFFFFFF);
self.selectedBackgroundView.backgroundColor = UIColorFromRGB(0xECEEEA);
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
}
@end