仿天天快报频道管理
2018-11-07 本文已影响1人
上北以北
说明
使用collectionview实现,用到的主要方法就一个:
- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath;
其他的就是结构和布局问题了,由于原理比较简单,就不再复述了,下面直接给出使用方法
使用方法
GitHub:https://github.com/Xiexingda/XDChannel
//导入头文件
#import "XDChannel.h"
//创建数据源
- (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";
}
//点击事件
- (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);
}];
}