//
// MyTableViewCellDataCollection.h
// TableViewLibrary
//
// Created by Krishnan Sriram Rama on 4/24/15.
// Copyright (c) 2015 Krishnan Sriram Rama. All rights reserved.
//
#import
@interface MyTableViewCellDataCollection : NSObject
+ (instancetype)sharedManager;
@property (nonatomic, strong) NSDictionary *tableData;
@end
//
// MyTableViewCellDataCollection.m
// TableViewLibrary
//
// Created by Krishnan Sriram Rama on 4/24/15.
// Copyright (c) 2015 Krishnan Sriram Rama. All rights reserved.
//
#import "MyTableViewCellDataCollection.h"
#import "MyTableViewCellData.h"
@interface MyTableViewCellDataCollection ()
@end
@implementation MyTableViewCellDataCollection
+ (instancetype)sharedManager {
static MyTableViewCellDataCollection *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[self alloc] init];
});
return sharedMyManager;
}
- (id)init {
if (self = [super init]) {
_tableData = [self loadSampleData];
}
return self;
}
- (NSDictionary*)loadSampleData {
MyTableViewCellData *cell1 = [[MyTableViewCellData alloc] init];
[cell1 setCellData:@"Mumbai"];
[cell1 setSubCellData:@"Economic capital of India"];
MyTableViewCellData *cell2 = [[MyTableViewCellData alloc] init];
[cell2 setCellData:@"Delhi"];
[cell2 setSubCellData:@"Political capital of India"];
MyTableViewCellData *cell3 = [[MyTableViewCellData alloc] init];
[cell3 setCellData:@"Bangalore"];
[cell3 setSubCellData:@"IT capital of India"];
MyTableViewCellData *cell4 = [[MyTableViewCellData alloc] init];
[cell4 setCellData:@"Hyderabad"];
[cell4 setSubCellData:@"Innovation capital of India"];
MyTableViewCellData *cell5 = [[MyTableViewCellData alloc] init];
[cell5 setCellData:@"Chennai"];
[cell5 setSubCellData:@"Cultural capital of India"];
NSDictionary *sampleData = @{@"1":cell1, @"2":cell2, @"3":cell3, @"4":cell4, @"5":cell5};
return sampleData;
}
@end
No comments:
Post a Comment