效果
小樣兒!-2018-12-12-18.10.gif
說明
使用collectionview實(shí)現(xiàn),用到的主要方法就一個(gè):
- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath;
其他的就是結(jié)構(gòu)和布局問題了,由于原理比較簡單,就不再復(fù)述了,下面直接給出使用方法
使用方法
GitHub:https://github.com/Xiexingda/XDChannel
//導(dǎo)入頭文件
#import "XDChannel.h"
//創(chuàng)建數(shù)據(jù)源
- (void)viewDidLoad{
_inUseTitles = @[@"item_0",@"item_1",@"item_2",@"item_3",@"item_4",@"item_5"];
_unUseTitles = @[@"item_6",@"item_7",@"item_8",@"item_9",@"item_10",@"item_11",@"item_12"];
_currentItem = @"item_0";
}
//點(diǎn)擊事件
- (void)btnTap {
__weak typeof(self) weakSelf = self;
[XDChannel showChannelWithInUseTitles:_inUseTitles
unUseTitles:_unUseTitles
currentItem:_currentItem
isFirstFixed:YES
finish:^(NSArray *inUseTitles,
NSArray *unUseTitles,
NSString *currentItem,
NSInteger currentItemIndex,
BOOL isInUseTitlesChanged) {
weakSelf.inUseTitles = inUseTitles;
weakSelf.unUseTitles = unUseTitles;
weakSelf.currentItem = currentItem;
NSLog(@"%@-%ld-%d",currentItem, (long)currentItemIndex, isInUseTitlesChanged);
}];
}
GitHub
喜歡的小伙伴記得點(diǎn)個(gè)Star,如果發(fā)現(xiàn)bug也請發(fā)個(gè)issue
GitHub:https://github.com/Xiexingda/XDChannel