OpenFlow的简单示例

核心代码请参考附件。

 

OpenFlowCoverViewController.h

 

#import <UIKit/UIKit.h>
#import "AFOpenFlowView.h"

@interface OpenFlowCoverViewController : UIViewController 
	<AFOpenFlowViewDataSource, AFOpenFlowViewDelegate> {
}

@end
  

OpenFlowCoverViewController.m

 

#import "OpenFlowCoverViewController.h"

@implementation OpenFlowCoverViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	
	for (int i = 0; i < 30; i++) {
		NSString *imageName = [[NSString alloc] initWithFormat:@"%d.jpg", i];
		[(AFOpenFlowView *)self.view setImage:[UIImage imageNamed:imageName] forIndex:i];
		[imageName release];
	}
	[(AFOpenFlowView *)self.view setNumberOfImages:30];
}

- (void)dealloc {
    [super dealloc];
}

#pragma mark DataSoure
- (UIImage *)defaultImage {
	return [UIImage imageNamed:@"default.png"];
}

- (void)openFlowView:(AFOpenFlowView *)openFlowView requestImageForIndex:(int)index {
	
}

#pragma mark delegate
- (void)openFlowView:(AFOpenFlowView *)openFlowView selectionDidChange:(int)index {
	NSLog(@"Cover Flow selection did change to %d", index);
}

@end

你可能感兴趣的:(ios,iPhone,openflow)