Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString * CellIdentifier = @"Cell";UIImageView * myImageView;
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- UIImageView *imageView = [[[UIImageView alloc] initWithFrame:CGRectMake(0,0,66,49)] autorelease];
- if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
- }
- [cell.textLabel setTextColor:[UIColor whiteColor]];
- [cell.textLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14]];
- if (newsArray) {
- if(indexPath.row % 2 == 0) {
- [cell.contentView setBackgroundColor:[UIColor colorWithRed:0.145 green:0.145 blue:0.145 alpha:0.0]];
- } else {
- [cell.contentView setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.0]];
- }
- UIImage *image = [UIImage imageNamed:@"test.jpg"];
- UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
- CGRect frame;
- frame.origin = CGPointZero;
- frame.size = [image size];
- [imageView setFrame:frame];
- [cell.contentView addSubview:myImageView];
- [imageView release];
- [cell.textLabel setTextAlignment:UITextAlignmentLeft];
- [cell.textLabel setText:[[newsArray objectAtIndex:indexPath.row] objectForKey:@"title"]];
- [cell.detailTextLabel setText:[[newsArray objectAtIndex:indexPath.row] objectForKey:@"description"]];
- [cell setSelectionStyle:UITableViewCellSelectionStyleBlue];
- } else {
- [cell.textLabel setTextAlignment:UITextAlignmentCenter];
- [cell.textLabel setText:@"Loading..."];
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- }
- return cell;
- }
Add Comment
Please, Sign In to add comment