@cellview
"What's the difference between just a regular tornado and the kind of tornados that can carry you away to that land with all the munchkins?"

seen from Colombia

seen from United Kingdom
seen from China
seen from Germany
seen from Türkiye
seen from Singapore

seen from Malaysia
seen from Canada

seen from United Kingdom
seen from United States

seen from Canada

seen from T1

seen from China
seen from Russia
seen from China

seen from Türkiye
seen from Malaysia
seen from United States
seen from Malaysia
seen from China
@cellview
"What's the difference between just a regular tornado and the kind of tornados that can carry you away to that land with all the munchkins?"
UITableView Custom Cell
Hi,Everyone;
customtableview.h
@interface icerik : UIViewController <UITableViewDelegate,UITableViewDataSource> {
IBOutlet UITableView *tblSimpleTable;
}
@end
customtableview.m
- (NSArray *)imageData {
NSString *path = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"plist"];
NSData *plistData = [NSData dataWithContentsOfFile:path];
NSString *error; NSPropertyListFormat format;
NSArray *imageData = [NSPropertyListSerialization propertyListFromData:plistData
mutabilityOption:NSPropertyListImmutable format:&format
errorDescription:&error];
if (!imageData) {
NSLog(@"Failed to read image names. Error: %@", error);
[error release];
}
return imageData;
}
- (void)viewDidLoad {
tblSimpleTable.delegate = self;
[tblSimpleTable release];
[super viewDidLoad];
arryData = [[NSMutableArray alloc] init];
for (NSDictionary *imageDict in [self imageData]) {
NSString *image_name = [imageDict valueForKey:@"image_name"];
[arryData addObject:image_name];
}
arryData1 = [[NSMutableArray alloc] init];
for (NSDictionary *imageDict in [self imageData]) {
NSString *link_name = [imageDict valueForKey:@"link_name"];
[arryData1 addObject:link_name];
}
arryData2 = [[NSMutableArray alloc] init];
for (NSDictionary *imageDict in [self imageData]) {
NSString *name = [imageDict valueForKey:@"name"];;
[arryData2 addObject:name];
}
}
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arryData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
static NSInteger StateTag = 1;
static NSInteger CapitalTag = 2;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
CGRect frame;
frame.origin.x = 110;
frame.origin.y = 5;
frame.size.height = 15;
frame.size.width = 200;
UILabel *capitalLabel = [[UILabel alloc] initWithFrame:frame];
capitalLabel.tag = CapitalTag;
capitalLabel.textColor = [UIColor blueColor];
[cell.contentView addSubview:capitalLabel];
[capitalLabel release];
frame.origin.y += 18;
UILabel *stateLabel = [[UILabel alloc] initWithFrame:frame];
stateLabel.tag = StateTag;
[cell.contentView addSubview:stateLabel];
[stateLabel release];
}
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
NSString *folder = @"~/Documents/";
NSLog(@"%@ : ", folder);
folder = [folder stringByExpandingTildeInPath];
NSString *imageName = [NSString stringWithFormat:@"%@/spages%@.jpg",folder,[arryData2 objectAtIndex:indexPath.row]];
UIImage *thumbImage = [UIImage imageWithContentsOfFile:imageName];
UILabel * stateLabel = (UILabel *) [cell.contentView viewWithTag:StateTag];
UILabel * capitalLabel = (UILabel *) [cell.contentView viewWithTag:CapitalTag];
stateLabel.text = [arryData objectAtIndex:indexPath.row];
capitalLabel.text = [arryData1 objectAtIndex:indexPath.row];
cell.imageView.frame = CGRectMake(0, 0, 100, 100);
cell.imageView.bounds = CGRectMake(0, 0, 100, 100);
cell.imageView.image = thumbImage;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedCountry = [arryData2 objectAtIndex:indexPath.row];
NSString * const getir = selectedCountry;
NSLog(@"%@",getir);
if (_delegate != nil) {
NSString *color = [arryData2 objectAtIndex:indexPath.row];
[_delegate colorSelected:color];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 125.0;
}