现在的位置: 首页 > 综合 > 正文

静态图-动态化的工具 JSAnimatedImagesView 。类似“新浪视野”

2013年12月08日 ⁄ 综合 ⁄ 共 1573字 ⁄ 字号 评论关闭

https://github.com/JaviSoto/JSAnimatedImagesView

Description:

Easy to use UIView subclass to quickly add a cool animated carrusel of pictures to your app.

Sample:

Video

http://jsoto.es/xmKcLb

Usage

  • Clone the repository:
$ git clone git@github.com:JaviSoto/JSAnimatedImagesView.git
  • Check out the sample project.
  • Drag the two files JSAnimatedImagesView.(h/m) onto
    your project.
  • Include the header file JSAnimatedImagesView.h into
    the controller where you want to use it.
  • Create a JSAnimatedImagesView instance
    either via code, or in interface builder (by creating a UIView and changing its class toJSAnimatedImagesView).
  • Set the data source property on the view (probably on the viewDidLoad method):
self.animatedImagesView.dataSource = self;
  • Implement the data source methods:
@interface MyViewController () <JSAnimatedImagesViewDataSource> // Conform to the protocol

@end
@implementation MyViewController

- (NSUInteger)animatedImagesNumberOfImages:(JSAnimatedImagesView *)animatedImagesView
{
    return self.myImageNames.count;
}

- (UIImage *)animatedImagesView:(JSAnimatedImagesView *)animatedImagesView imageAtIndex:(NSUInteger)index
{
    return [UIImage imageNamed:[self.myImageNames objectAtIndex:index]];
}

@end

Configuration

@property (nonatomic, assign) NSTimeInterval timePerImage;

Specifies the time each image is viewed until the next image is faded in.

@property (nonatomic, assign) NSTimeInterval transitionDuration;

Specifies the duration of the transition (fade-out/fade-in) animation.

Compatibility

  • JSAnimatedImagesView is
    compatible with iOS5.0+
  • JSAnimatedImagesView requires
    ARC.

Attributions
(Creative Commons Images)

抱歉!评论已关闭.