All Projects → Shin1122 → YZChannelTag

Shin1122 / YZChannelTag

Licence: other
仿写《今日头条》的tag选择页面

Programming Languages

objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to YZChannelTag

MGGridView
MGGridView is a grid view created by a combination of collection views.
Stars: ✭ 25 (-52.83%)
Mutual labels:  collectionview
KNURE-TimeTable
🎓 iOS приложение для просмотра расписания ХНУРЭ
Stars: ✭ 21 (-60.38%)
Mutual labels:  collectionview
JHCollectionViewFlowLayout
CollectionView horizontal layout,横向排版
Stars: ✭ 30 (-43.4%)
Mutual labels:  collectionview
LQIMInputView
一个聊天输入框的工具栏,类似微信聊天工具栏,可自定义,集成方便
Stars: ✭ 28 (-47.17%)
Mutual labels:  collectionview
Multiple-collectionView-in-Multiple-tableView-cells
UICollectionView is embed in UITableViewCell. The collection views are horizontal scrollable. The UITableView can have a section title for each UICollectionView and the number of UICollectionView is equal to the number of sections.
Stars: ✭ 23 (-56.6%)
Mutual labels:  collectionview
Pinterest-Application
Build an application like Pinterest in Swift 4
Stars: ✭ 31 (-41.51%)
Mutual labels:  collectionview
Reactivelists
React-like API for UITableView & UICollectionView
Stars: ✭ 250 (+371.7%)
Mutual labels:  collectionview
FocusOnXamarin
NET Conf: Focus on Xamarin samples
Stars: ✭ 55 (+3.77%)
Mutual labels:  collectionview
SNCollectionViewLayout
Collection View Layouts is a set of custom flow layouts for iOS which imitate general data grid approaches for mobile apps.
Stars: ✭ 100 (+88.68%)
Mutual labels:  collectionview
CollectionViewDiffableGameDB
Game DB iOS App using iOS 13 NSDiffableDataSourceSnapshot to filter, sort, and search with animations
Stars: ✭ 17 (-67.92%)
Mutual labels:  collectionview
SectionReactor
A ReactorKit extension for managing table view and collection view sections with RxDataSources
Stars: ✭ 45 (-15.09%)
Mutual labels:  collectionview
ShortcutsCollectionView
Create custom collectionView like Apple’s Shortcuts app in Code.
Stars: ✭ 24 (-54.72%)
Mutual labels:  collectionview
FavFighters
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 32 (-39.62%)
Mutual labels:  collectionview
SwiftWaterfallFlow
swift写的瀑布流布局
Stars: ✭ 37 (-30.19%)
Mutual labels:  collectionview
KNBannerView
无限循环图片轮播器:本地图片,网络图片,混合图片(本地+网络) , 适配SDWebImage5.0 . 动态修改背景色,屏幕旋转适配
Stars: ✭ 82 (+54.72%)
Mutual labels:  collectionview
MMAdvertScrollView
一个简单、轻量级的swift版公告轮播框架
Stars: ✭ 42 (-20.75%)
Mutual labels:  collectionview
Pickme
iOS Picker for ninjas
Stars: ✭ 29 (-45.28%)
Mutual labels:  collectionview
DDComponent
Make a collection controller to several component, like IGList
Stars: ✭ 36 (-32.08%)
Mutual labels:  collectionview
ios-swift-uicollectionviewcell-from-xib
Create CollectionView Xib cell for UICollectionView using Swift 3
Stars: ✭ 12 (-77.36%)
Mutual labels:  collectionview
THCalendar
Calendar like iOS
Stars: ✭ 21 (-60.38%)
Mutual labels:  collectionview

YZChannelTag

仿写《今日头条》的tag选择页面

item可以移动的collectionview实际应用

图片名称

在《今日头条》中,该页面是用来选择自己感兴趣的频道标签从而改变segment的。标签功能应用的需求现在也比较多,主要使用collectionview中item可以移动的方法和思路来写这样的页面。

Version & issues

1.2 增加长按进入编辑状态 #1
1.0 仿写今日头条当前版本功能

用法

ChannelTags *controller = 
      [[ChannelTags alloc]initWithMyTags:_myTags andRecommandTags:_recommandTags];
      
[self presentViewController:controller animated:YES completion:^{}];

可以直接加载出来该Controller,可自定义修改模态。

初始化

/**
初始化器

@param myTags 已选tag
@param recommandTags 推荐tag
@return id
*/
-(instancetype)initWithMyTags:(NSArray *)myTags andRecommandTags:(NSArray *)recommandTags;

初始化器传入两个字符类型元素的数组,做为两组不同的数据源,可以是NSMutableArray类型。在设置完成后数组元素会发生变化,再次进入页面后会加载新的数据源。

应用点

  • 在collectionview上添加的长按手势
//添加长按的手势
UILongPressGestureRecognizer *longPress = 
        [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)];
        
[_mainView addGestureRecognizer:longPress];
  • 手势状态的变化和操作
- (void)longPress:(UIGestureRecognizer *)longPress {

  //获取点击在collectionView的坐标
  CGPoint point=[longPress locationInView:_mainView];
  
  //从长按开始
  NSIndexPath *indexPath=[_mainView indexPathForItemAtPoint:point];
  
  if (longPress.state == UIGestureRecognizerStateBegan) {
    [_mainView beginInteractiveMovementForItemAtIndexPath:indexPath];
    
  //长按手势状态改变
  } else if(longPress.state==UIGestureRecognizerStateChanged) {
    [_mainView updateInteractiveMovementTargetPosition:point];
    
  //长按手势结束
  } else if (longPress.state==UIGestureRecognizerStateEnded) {
    [_mainView endInteractiveMovement];
    
  //其他情况
  } else {
    [_mainView cancelInteractiveMovement];
  }
}
  • 实现回调方法
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath;

-(void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].