Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *MyIdentifier = @"MyIdentifier";
- #if 0
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
- #endif
- cell = (MainCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
- if (cell == nil) {
- #if 0
- cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
- #endif
- [[NSBundle mainBundle] loadNibNamed:@"MainCell" owner:self options:nil];
- }
- // Set up the cell
- int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
- [cell.topLabel setText:[[stories objectAtIndex: storyIndex] objectForKey: @"title"]];
- [cell.bottomLabel setText:[[stories objectAtIndex:storyIndex] objectForKey:@"summary"]];
- NSMutableString *imgstr = [[stories objectAtIndex:storyIndex] objectForKey:@"image"];
- // clean up the link
- [imgstr replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, [imgstr length])];
- [imgstr replaceOccurrencesOfString:@"\n" withString:@"" options:0 range:NSMakeRange(0, [imgstr length])];
- [imgstr replaceOccurrencesOfString:@"\t" withString:@"" options:0 range:NSMakeRange(0, [imgstr length])];
- NSURL *imgurl = [NSURL URLWithString:imgstr];
- NSError *err;
- NSData *imgdata = [NSData dataWithContentsOfURL:imgurl options:NSMappedRead error:&err];
- cell.logoImage.image = [UIImage imageWithData:imgdata];
- [cell.logoImage sizeThatFits:CGSizeMake(80,80)];
- cell.topLabel.font=[UIFont fontWithName:@"Georgia" size:14];
- cell.logoImage.layer.masksToBounds = YES;
- cell.logoImage.layer.cornerRadius = 5; //4.5
- [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
- return cell;
- }
Add Comment
Please, Sign In to add comment