//
//  MyAutocompletionCellFactory.m
//  testautocomplete
//
//  Created by Ray on 14-4-29.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//

#import "MyAutocompletionCellFactory.h"
#import "MySuggestion.h"
//#import "TRAutocompleteItemsSource.h"



@implementation MyAutocompletionCell

- (void)updateWith:(MySuggestion*)item
{
    self.textLabel.text = item.completionText;
}

@end


@implementation MyAutocompletionCellFactory
{
    UIColor *_foregroundColor;
    CGFloat _fontSize;
}

- (id)initWithCellTextColor:(UIColor *)textColor fontSize:(CGFloat)fontSize
{
    self = [super init];
    if (self)
    {
        _foregroundColor = textColor;
        _fontSize = fontSize;
    }
    
    return self;
}

- (MyAutocompletionCell *)createReusableCellWithIdentifier:(NSString *)identifier
{
    MyAutocompletionCell *cell = [[MyAutocompletionCell alloc]
                                            initWithStyle:UITableViewCellStyleDefault
                                            reuseIdentifier:identifier];
    cell.textLabel.font = [UIFont systemFontOfSize:_fontSize];
    cell.textLabel.textColor = _foregroundColor;
    
    cell.backgroundColor = [UIColor clearColor];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}
@end
