OpenFlowとは??
CoverFlow を簡単に実現するライブラリです。詳しい利用方法は下記参考サイトや本家を参照して頂ければ非常に簡単に導入できます!!
thefaj/OpenFlow - GitHub 【iPhone】coverflowを簡単に実装できるライブラリ | iPhoneアプリで稼げるのか
非常に便利なのですが、一点問題が。iPod のCoverFlow時にアルバムアートワークをタッチするとそのアルバムの曲が一覧表示される様なUIを実現する際のタッチイベントが在りません。。
AFOpenFlowにタッチイベントを追加
そこでライブラリを少し改造してイベントを追加してみました。
追加するイベント名 [openFlowView:selection]
AFOpenFlowView.m Line:304〜
if (targetCover && (targetCover.number != selectedCoverView.number)){
[self setSelectedCover:targetCover.number] ;
}else {
if ([self.viewDelegate respondsToSelector:@selector(openFlowView:selection:)])
[self.viewDelegate openFlowView:self selection:selectedCoverView.number] ;
}
AFOpenFlowView.h Line:73〜
@protocol AFOpenFlowViewDelegate <NSObject>;
@optional
- (void)openFlowView:(AFOpenFlowView *)openFlowView selectionDidChange:(int)index;
- (void)openFlowView:(AFOpenFlowView *)openFlowView selection:(int)index;
@end
イベント利用方法
プロトコルAFOpenFlowViewDelegateを実装したクラスにて[openFlowView selection]を実装し、そのオブジェクトをopenFlowViewのviewDelegateに設定してあげる。
以上、これだけで各viewのタッチイベントを処理する事ができます。
コード追記 at 2011/02/23
- (void)openFlowView:(AFOpenFlowView *)openFlowView selection:(int)index {
NextViewController* nextViewController = [[NextViewController alloc] init];
[self.navigationController pushViewController:nextViewController animated:YES];
[nextViewController release];
}