A couple of thoughts:
First, I think using storyboards makes subclassing UITableViewCell
even easier. No code required to load the NIB. You design the subclassed cell right in place.
Second, I'd consider using Quartz 2D to configure your cell's inner border programmatically. Quartz 2D has features like dashed lines, shadows, etc.
Basically, you can programmatically tweak your user interface. So, add the QuartzCore.framework
to your project, and make a subclass for the cell's inner border, perhaps something like:
#import <QuartzCore/QuartzCore.h>
@interface CellInnerBorderView ()
@property (nonatomic, strong) CAShapeLayer *shapeLayer;
@end
@implementation CellInnerBorderView
// this adds shadow and border to the cell
- (void)configureBackgroundView
{
self.layer.shadowColor = [UIColor blackColor].CGColor;
self.layer.shadowRadius = 2.0;
self.layer.shadowOpacity = 0.8;
self.layer.shadowOffset = CGSizeMake(0.0, 2.0);
self.layer.borderColor = [UIColor blackColor].CGColor;
self.layer.borderWidth = 1.0;
}
// this adds a dashed line, half way down, inset by 5 points left and right
- (void)addDashedSeparator
{
UIBezierPath *path = [UIBezierPath bezierPath];
CGPoint startPoint = CGPointMake(5.0, self.frame.size.height / 2.0);
CGPoint endPoint = CGPointMake(self.frame.size.width - 10.0, self.frame.size.height / 2.0);
[path moveToPoint:startPoint];
[path addLineToPoint:endPoint];
if (self.shapeLayer)
[self.shapeLayer removeFromSuperlayer];
self.shapeLayer = [CAShapeLayer layer];
self.shapeLayer.path = path.CGPath;
self.shapeLayer.strokeColor = [UIColor blackColor].CGColor;
self.shapeLayer.lineDashPattern = @[@1, @1];
self.shapeLayer.fillColor = [UIColor blackColor].CGColor;
self.shapeLayer.lineWidth = 1.0;
self.shapeLayer.strokeStart = 0.0;
self.shapeLayer.strokeEnd = 1.0;
[self.layer addSublayer:self.shapeLayer];
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self configureBackgroundView];
[self addDashedSeparator];
}
@end
Then you can add a view in Interface Builder that represents the UITableViewCell
inner border, specify it's class to be CellInnerBorderView
(or whatever you choose to call it), and you get this behavior.