Это, как я сделал это:
#import <Foundation/Foundation.h>
@interface MyTableCell : UITableViewCell
{
NSMutableArray *columns;
}
- (void)addColumn:(CGFloat)position;
@end
реализация:
#import "MyTableCell.h"
#define LINE_WIDTH 0.25
@implementation MyTableCell
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
- (void)addColumn:(CGFloat)position
{
[columns addObject:[NSNumber numberWithFloat:position]];
}
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
// Use the same color and width as the default cell separator for now
CGContextSetRGBStrokeColor(ctx, 0.5, 0.5, 0.5, 1.0);
CGContextSetLineWidth(ctx, LINE_WIDTH);
for (int i = 0; i < [columns count]; i++)
{
CGFloat f = [((NSNumber*) [columns objectAtIndex:i]) floatValue];
CGContextMoveToPoint(ctx, f, 0);
CGContextAddLineToPoint(ctx, f, self.bounds.size.height);
}
CGContextStrokePath(ctx);
[super drawRect:rect];
}
@end
и последняя часть, cellForRowAtIndexPath
MyTableCell *cell = (MyTableCell *)[rankingTableView dequeueReusableCellWithIdentifier:MyIdentifier];
cell = [[[MyTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
Вы должны создать свой собственный tableviewcell, если вам нужно, это больше, чем один столбец – Buron
@Buron, пожалуйста, предложите какой-либо учебник относительно моей проблемы? – kumar