旋转木马第三方

一.OpenFlow

#import "AFOpenFlowView.h"
@interface OpenFlow : UIViewController<AFOpenFlowViewDelegate>

@end
1.创建一个AFOpenFlowView

AFOpenFlowView *flowView = [[AFOpenFlowView alloc]initWithFrame:CGRectMake(0, 20, 320, 480)];
    flowView.viewDelegate = self;
    flowView.backgroundColor = [UIColor clearColor];
    //次数应与for循环对象数量一致 仅用于显示书籍 列表...
    [flowView setNumberOfImages:10];
    for (int i=0; i<10; i++) {
        //添加的为UIImage
		UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]];
		[flowView setImage:image forIndex:i];
	}
    [self.view addSubview:flowView];
    [flowView release];
2.代理方法

//旋转到某一张图片
- (void)openFlowView:(AFOpenFlowView *)openFlowView selectionDidChange:(int)index
{
    NSLog(@"打开了第%d张图",index);
}
二.iCarousel

//头文件:
#import "iCarousel.h"
@interface iCarousel : UIViewController<iCarouselDataSource,iCarouselDelegate>
{
    iCarousel *_iCrousel;
    int flag;
}
@end
1.文件创建一个iCarousel

_iCrousel = [[iCarousel alloc]initWithFrame:CGRectMake(0, 20, 320, 400)];
    _iCrousel.type=iCarouselTypeCoverFlow;
	_iCrousel.delegate=self;
	_iCrousel.dataSource=self;
    [self.view addSubview:_iCrousel];
    [_iCrousel release];
2.数据源和代理方法

#pragma mark -
#pragma mark iCarouselDataSource
//有多少项
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
    return 10;
}
//最大有多少个可以显示
- (NSUInteger)numberOfVisibleItemsInCarousel:(iCarousel *)carousel{
	return 8;
}
//每一个的内容
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
    UIImageView *imgv=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 210, 300)];
	imgv.image=[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg", index]];
	return [imgv autorelease];
}
#pragma mark -
#pragma mark iCarouselDelegate
//视图宽度
-(CGFloat)carouselItemWidth:(iCarousel *)carousel{
	return 300;
}
//点击视图事件
- (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index
{
	NSLog(@"---->%d", index);
}

旋转木马第三方下载

你可能感兴趣的:(ios,动画,iPhone开发)