我正在尝试使用FlowCover-> http://www.chaosinmotion.com/flowcover.m,但是它不起作用。
这是我的接口类:
#import <UIKit/UIKit.h>
#import "FlowCoverView.h"
@interface TesterCoverFlowViewController : UIViewController <FlowCoverViewDelegate> {
}
- (IBAction)done:(id)sender;
@end
这是我的实现类:
#import "TesterCoverFlowViewController.h"
@implementation TesterCoverFlowViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)dealloc
{
[super dealloc];
}
- (IBAction)done:(id)sender
{
[[self parentViewController] dismissModalViewControllerAnimated:YES];
}
/************************************************************************/
/* */
/* FlowCover Callbacks */
/* */
/************************************************************************/
- (int)flowCoverNumberImages:(FlowCoverView *)view
{
return 64;
}
- (UIImage *)flowCover:(FlowCoverView *)view cover:(int)image
{
switch (image % 6) {
case 0:
default:
return [UIImage imageNamed:@"a.png"];
case 1:
return [UIImage imageNamed:@"b.png"];
case 2:
return [UIImage imageNamed:@"c.png"];
case 3:
return [UIImage imageNamed:@"x.png"];
case 4:
return [UIImage imageNamed:@"y.png"];
case 5:
return [UIImage imageNamed:@"z.png"];
}
}
- (void)flowCover:(FlowCoverView *)view didSelect:(int)image
{
NSLog(@"Selected Index %d",image);
}
@end
大部分代码均来自该站点。
我需要对界面做任何事情吗?因为什么也没出现!没有错误,我只是看不到任何Coverflow(或flowcover)。
谢谢
最佳答案
如果您没有看到任何错误,则可能是缺少委托或未显示视图。
您是否在显示UIViewController
和类似presentModalViewController
的东西?
您是否将TesterCoverFlowViewController
类分配为FlowCoverView
的委托?