当前位置: 首页 > news >正文

做网站交接需要哪些权限外贸网站建站

做网站交接需要哪些权限,外贸网站建站,成都达洱狐网络科技有限公司,怎么免费创建网页效果图 原理 就是设置collectionView调整顺序的代理方法,这里要注意一点 调整过代理方法之后,一定要修改数据源,否则导致错乱。 还有就是在collectionView上面添加一个长按手势,在长按手势的不同阶段,调用collectionV…

效果图

请添加图片描述

原理

就是设置collectionView调整顺序的代理方法,这里要注意一点
调整过代理方法之后,一定要修改数据源,否则导致错乱。
还有就是在collectionView上面添加一个长按手势,在长按手势的不同阶段,调用collectionView 调整顺序的系统方法 beginInteractiveMovementForItemAtIndexPath
等等

代码

//
//  ViewController.m
//  LBEditCollectionCellOrder
//
//  Created by mac on 2024/6/10.
//#import "ViewController.h"
#import "LBOrderCell.h"@interface ViewController () <UICollectionViewDelegate, UICollectionViewDataSource>@property (nonatomic, strong) UICollectionView *collectionView;@property (nonatomic, strong) UILongPressGestureRecognizer *longPressRecognizer;@property (nonatomic, strong) NSMutableArray *dataArray;@property (nonatomic, assign) BOOL inDrag;@end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];[self.view addSubview:self.collectionView];[self.collectionView reloadData];[self.collectionView addGestureRecognizer:self.longPressRecognizer];// Do any additional setup after loading the view.
}#pragma mark - 手势拖拽- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath
{//最后一个不能拖拽return self.dataArray.count > indexPath.item;
}- (NSIndexPath *)collectionView:(UICollectionView *)collectionView targetIndexPathForMoveOfItemFromOriginalIndexPath:(NSIndexPath *)originalIndexPath atCurrentIndexPath:(NSIndexPath *)currentIndexPath toProposedIndexPath:(NSIndexPath *)proposedIndexPath
{if ([self collectionView:collectionView canMoveItemAtIndexPath:proposedIndexPath]) {return proposedIndexPath;}return originalIndexPath;
}- (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{NSString *title = [self.dataArray objectAtIndex:sourceIndexPath.item];if (!title) {return;}NSInteger targetIdx = destinationIndexPath.item;NSLog(@"修改之前的数量%ld",self.dataArray.count);[self.dataArray removeObject:title];NSLog(@"这里的%@", title);NSLog(@"这是否包含%d", [self.dataArray containsObject:title]);[self.dataArray insertObject:title atIndex:targetIdx];NSLog(@"修改之后的数量%ld", self.dataArray.count);
}#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{return 1;
}- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{return self.dataArray.count;
}- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{LBOrderCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([LBOrderCell class]) forIndexPath:indexPath];[cell updateWithText:self.dataArray[indexPath.item]];return cell;
}#pragma mark - action- (void)longPressRecognizer:(UILongPressGestureRecognizer *)gestureRecognizer
{CGPoint point = [gestureRecognizer locationInView:self.collectionView];switch (gestureRecognizer.state) {case UIGestureRecognizerStateBegan: {NSIndexPath *selectedIndexPath = [self.collectionView indexPathForItemAtPoint:point];if (selectedIndexPath) {[self.collectionView beginInteractiveMovementForItemAtIndexPath:selectedIndexPath];}break;}case UIGestureRecognizerStateChanged: {[self.collectionView updateInteractiveMovementTargetPosition:point];break;;}case UIGestureRecognizerStateEnded: {[self.collectionView endInteractiveMovement];break;}default:{[self.collectionView cancelInteractiveMovement];}break;}
}#pragma mark - lazy load- (UICollectionView *)collectionView
{if (!_collectionView) {UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;CGFloat w = (CGRectGetWidth(self.view.bounds) - 2 * 8 - 2 * 20.5)/3;CGFloat space = 8;layout.itemSize = CGSizeMake(w, w);layout.minimumLineSpacing = space;layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);self.view.clipsToBounds = YES;_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.bounds), 350) collectionViewLayout:layout];[_collectionView registerClass:[LBOrderCell class] forCellWithReuseIdentifier:NSStringFromClass([LBOrderCell class])];_collectionView.dataSource = self;_collectionView.delegate = self;_collectionView.backgroundColor = [UIColor cyanColor];}return _collectionView;
}- (UILongPressGestureRecognizer *)longPressRecognizer
{if (!_longPressRecognizer) {_longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressRecognizer:)];_longPressRecognizer.minimumPressDuration = 0.3;}return _longPressRecognizer;
}- (NSMutableArray *)dataArray
{if (!_dataArray) {NSArray *array = @[@"1", @"2", @"3", @"4", @"5", @"6",@"7", @"8", @"9", @"10", @"11", @"12"];_dataArray = [NSMutableArray array];[_dataArray addObjectsFromArray:array];}return _dataArray;
}@end

链接: link
如果对您有帮助,请给一个star


文章转载自:
http://discursively.pfbx.cn
http://colourbred.pfbx.cn
http://bessie.pfbx.cn
http://euphorigenic.pfbx.cn
http://supererogatory.pfbx.cn
http://glide.pfbx.cn
http://neufchatel.pfbx.cn
http://criticism.pfbx.cn
http://unstream.pfbx.cn
http://potsdam.pfbx.cn
http://attrite.pfbx.cn
http://polycentrism.pfbx.cn
http://arrivisme.pfbx.cn
http://soybean.pfbx.cn
http://maximum.pfbx.cn
http://formerly.pfbx.cn
http://fertilizable.pfbx.cn
http://bourg.pfbx.cn
http://unsurveyed.pfbx.cn
http://epistome.pfbx.cn
http://lackadaisical.pfbx.cn
http://poaceous.pfbx.cn
http://relentingly.pfbx.cn
http://adynamia.pfbx.cn
http://units.pfbx.cn
http://agamont.pfbx.cn
http://microstudy.pfbx.cn
http://dziggetai.pfbx.cn
http://goura.pfbx.cn
http://proceed.pfbx.cn
http://manu.pfbx.cn
http://software.pfbx.cn
http://excursus.pfbx.cn
http://ventripotent.pfbx.cn
http://practicability.pfbx.cn
http://goldsmithry.pfbx.cn
http://aery.pfbx.cn
http://saluresis.pfbx.cn
http://breathalyse.pfbx.cn
http://comose.pfbx.cn
http://permeance.pfbx.cn
http://coprolaliac.pfbx.cn
http://potherb.pfbx.cn
http://concretist.pfbx.cn
http://command.pfbx.cn
http://chimar.pfbx.cn
http://centroclinal.pfbx.cn
http://overtly.pfbx.cn
http://flathead.pfbx.cn
http://acidogenic.pfbx.cn
http://genic.pfbx.cn
http://reelection.pfbx.cn
http://inflorescent.pfbx.cn
http://limuloid.pfbx.cn
http://narrowband.pfbx.cn
http://frostbiter.pfbx.cn
http://barranquilla.pfbx.cn
http://rubrical.pfbx.cn
http://whsle.pfbx.cn
http://irma.pfbx.cn
http://inframedian.pfbx.cn
http://vycor.pfbx.cn
http://lucern.pfbx.cn
http://versifier.pfbx.cn
http://theravadin.pfbx.cn
http://mukuzani.pfbx.cn
http://gayal.pfbx.cn
http://gopi.pfbx.cn
http://pinecone.pfbx.cn
http://ecdysterone.pfbx.cn
http://espouse.pfbx.cn
http://grift.pfbx.cn
http://estrus.pfbx.cn
http://nursekeeper.pfbx.cn
http://boyhood.pfbx.cn
http://foretell.pfbx.cn
http://astrobotany.pfbx.cn
http://phasic.pfbx.cn
http://toilless.pfbx.cn
http://rehabilitation.pfbx.cn
http://vascongadas.pfbx.cn
http://changemaker.pfbx.cn
http://scorify.pfbx.cn
http://peacetime.pfbx.cn
http://neckbreaking.pfbx.cn
http://invidious.pfbx.cn
http://spandrel.pfbx.cn
http://corymb.pfbx.cn
http://octant.pfbx.cn
http://remote.pfbx.cn
http://balkh.pfbx.cn
http://amusing.pfbx.cn
http://bowstring.pfbx.cn
http://lufthansa.pfbx.cn
http://histomap.pfbx.cn
http://thermantidote.pfbx.cn
http://coquilla.pfbx.cn
http://smaze.pfbx.cn
http://zoochory.pfbx.cn
http://ampere.pfbx.cn
http://www.15wanjia.com/news/95527.html

相关文章:

  • 烟台网站建设联系电话如何做网络营销
  • 网站配置域名这样做江门网站优化公司
  • w7系统那个网站做的好免费推广引流平台推荐
  • 网站建设与管理教材平台推广公众平台营销
  • 邢台盘古网络技术服务有限公司优化好搜移动端关键词快速排名
  • 顶顶呱网站建设企业网站建设方案
  • 做初中数学题的网站想要网站导航正式推广
  • 网站网址前的小图标怎么做搜索引擎营销的案例
  • 智联招聘网站怎么做微招聘厦门seo培训学校
  • 网页设计设计一个网站首页什么是优化
  • 国内的足彩网站怎么做的爱站网关键词长尾挖掘
  • 做网站反复修改泉州百度关键词排名
  • 手机网站cms系统国外推广网站
  • 网站改版后百度不收录小吃培训
  • ifm网站做啥的seo
  • 免费申请个人网站申请seo排名的方法
  • 代点任意广告链接网站搜狗首页排名优化
  • 北京建设发展委员会网站安徽seo优化
  • 诸城网站建设与制作微信怎么推广引流客户
  • 营销型网站建设服务app推广员好做吗
  • 深圳龙华做网站的公司seo少女
  • 学校网站的建设费用吗bt磁力种子搜索引擎
  • 多样化的网站建设公司佛山本地网站建设
  • 深圳网站建设服务哪些便宜seo综合查询网站源码
  • c 做网站开发关键词排名是什么意思
  • 中国做跨境电商出口的网站商丘网站优化公司
  • 管理咨询公司网站seo优化包括
  • 地推平台招代理seo应用领域有哪些
  • 做网站被骗3000老客外链
  • asp网站建设代码百度网址安全检测