Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface Footer : UITableViewHeaderFooterView
- @property (nonatomic, strong) UIButton *moreData;
- @end
- @implementation Footer
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- self.moreData = [[UIButton alloc] initWithFrame:frame];
- [self configureFooter];
- }
- return self;
- }
- - (void)configureFooter {
- self.moreData.translatesAutoresizingMaskIntoConstraints = NO;
- // setup title: bold big underlined text
- // var title = [[NSMutableAttributedString alloc] initWithString: @"NORIU DAUGIAU GB" ];
- //
- // [title beginEditing];
- // [title addAttribute:NSUnderlineStyleAttributeName
- // value:[NSNumber numberWithInt:1]
- // range:(NSRange){0,[title length]}];
- // [title addAttribute:NSFontAttributeName value:kBigFont range:(NSRange){0, [title length]}];
- // [title endEditing];
- //
- // self.moreData.titleLabel.attributedText = title;
- [self.contentView addSubview:self.moreData];
- // the whole footer is a button with text "more gigabytes"
- [NSLayoutConstraint activateConstraints:@[
- [self.moreData.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor],
- [self.moreData.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor],
- [self.moreData.topAnchor constraintEqualToAnchor:self.contentView.topAnchor],
- [self.moreData.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor],
- ]];
- self.moreData.backgroundColor = [UIColor yellowColor];
- self.moreData.titleLabel.text = @"TEXT";
- self.moreData.titleLabel.textColor = kPrimaryBlack;
- }
- @end
- /// inside vc
- @implementation VC
- - (void)viewDidLoad {
- [super viewDidLoad];
- footer = [[Footer alloc]
- initWithFrame:CGRectMake(0, 0, self.tableView.bounds.size.width, 75.f)];
- [footer.moreData addTarget:self action:@selector(removeFooter) forControlEvents:UIControlEventTouchUpInside];
- self.tableView.tableFooterView = footer;
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement