Skip to content

Instantly share code, notes, and snippets.

@soffes
Created October 6, 2013 23:58
Show Gist options
  • Save soffes/6860677 to your computer and use it in GitHub Desktop.
Save soffes/6860677 to your computer and use it in GitHub Desktop.
//
// SHRZebraView.h
// Shares
//
// Created by Sam Soffes on 9/19/13.
// Copyright (c) 2013 Nothing Magical. All rights reserved.
//
@interface SHRZebraView : UIView
@end
//
// SHRZebraView.m
// Shares
//
// Created by Sam Soffes on 9/19/13.
// Copyright (c) 2013 Nothing Magical. All rights reserved.
//
#import "SHRZebraView.h"
#import "SHStockTableViewCell.h"
#import "UIColor+Shares.h"
@implementation SHRZebraView
- (instancetype)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor shr_lightRowColor];
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
[[UIColor shr_darkRowColor] setFill];
CGSize size = self.bounds.size;
CGFloat rowHeight = [SHStockTableViewCell cellHeight];
for (CGFloat i = rowHeight; i < size.height; i += rowHeight * 2.0f) {
CGContextFillRect(context, CGRectMake(0.0f, i, size.width, rowHeight));
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment