-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
143 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// TableViewController.h | ||
// UIImageView-PlayGIF | ||
// | ||
// Created by Yang Fei on 14-4-7. | ||
// Copyright (c) 2014年 yangfei.me. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface TableViewController : UITableViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// TableViewController.m | ||
// UIImageView-PlayGIF | ||
// | ||
// Created by Yang Fei on 14-4-7. | ||
// Copyright (c) 2014年 yangfei.me. All rights reserved. | ||
// | ||
|
||
#import "TableViewController.h" | ||
#import "UIImageView+PlayGIF.h" | ||
|
||
@interface TableViewController () | ||
|
||
@end | ||
|
||
@implementation TableViewController | ||
|
||
- (id)initWithStyle:(UITableViewStyle)style | ||
{ | ||
self = [super initWithStyle:style]; | ||
if (self) { | ||
// Custom initialization | ||
self.title = @"UIImageView-PlayGIF"; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; | ||
} | ||
|
||
- (void)didReceiveMemoryWarning | ||
{ | ||
[super didReceiveMemoryWarning]; | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
#pragma mark - Table view data source | ||
|
||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | ||
{ | ||
// Return the number of sections. | ||
return 1; | ||
} | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | ||
{ | ||
// Return the number of rows in the section. | ||
return 100; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
static NSString *CellIdentifier = @"Cell"; | ||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | ||
if (!cell) { | ||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; | ||
cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
|
||
UIImageView *gifView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 114, 81)]; | ||
gifView.backgroundColor = [UIColor darkGrayColor]; | ||
gifView.tag = 100; | ||
[cell.contentView addSubview:gifView]; | ||
} | ||
cell.detailTextLabel.text = [NSString stringWithFormat:@"index = %li",(long)indexPath.row]; | ||
|
||
UIImageView *gifView = (UIImageView *)[cell.contentView viewWithTag:100]; | ||
gifView.gifPath = [[NSBundle mainBundle] pathForResource:@"car.gif" ofType:nil]; | ||
[gifView startGIF]; | ||
|
||
return cell; | ||
} | ||
|
||
#pragma mark - Table view delegate | ||
|
||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
return 81+20; | ||
} | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
[tableView deselectRowAtIndexPath:indexPath animated:YES]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.