草庐IT

collection-initializer

全部标签

ios - 在 Swift 中使用 Objective-C 类时为 "Cannot Find Initializer"

第一次创建Swift应用程序时一切顺利,直到我在尝试将Objective-C类用于SwiftViewController时遇到问题。Objective-C类初始化(RKDropdownAlert.h)+(void)title:(NSString*)titlemessage:(NSString*)messagebackgroundColor:(UIColor*)backgroundColortextColor:(UIColor*)textColortime:(NSInteger)seconds;我的尝试:varalert:RKDropdownAlert=RKDropdownAlert(t

解决:Collecting package metadata (current_repodata.json)/ Solving environment

安装Pytorch时报错:Collectingpackagemetadata(current_repodata.json):-WARNINGconda.models.version:get_matcher(556):Using.*withrelationaloperatorissuperfluousanddeprecatedandwillberemovedinafutureversionofconda.Yourspecwas1.7.1.*,butcondaisignoringthe.*andtreatingitas1.7.1doneSolvingenvironment:unsuccessful

ios - Swift - Collection View dequeueReusableCellWithReuseIdentifier EXC 错误访问错误

我正在开发一个有UICollectionView的应用程序。我创建了一个包含UIImageView和UILabel的自定义CollectionViewCell。以下代码导致cellForItemAtIndexPath方法中的UICollectionView.dequeueReusableCellWithReuseIdentifier出现EXC_BAD_ACCESS(code=1,address=0x0)错误。这是我的代码:importUIKitclassCategoryCell:UICollectionViewCell{@IBOutletvarcategoryImageView:UII

iOS左对齐自动换行collection样式

前言想必大家工作中或多或少会遇到下图样式的UI需求吧像这种cell长度不固定,以此向右对齐排列的样式UI可以说是很常见的实现方式一般的实现可能主要是分一下两种:1、一种是用button依次排列实现,动态计算text宽度,记录之前一个button的位置,和当前button的宽度,看是否最终会超出屏幕的右边,一旦超出右边,就换行到下一行缺点当数据量多的时候,生成很多的button,不能对button进行重用每次生成一个button的时候都要计算位置,相对较麻烦优点适合数据少的情况2、采用collectionview,依次从左到右进行布局排列cell优点数据量大的时候,能重用cell,减少cell数

【Java 基础篇】Java Collection详解

文章目录导言一、Collection简介二、List接口三、Set接口四、Map接口总结导言Java的Collection框架是一组用于存储和操作对象的接口和类。它提供了一种方便的方式来管理和操作数据集合。本文将详细介绍Java中的Collection框架,包括List、Set、Map等常见接口和实现类,并提供一些示例代码。一、Collection简介Collection是Java集合框架的根接口,它定义了一些基本的操作和行为,如添加、删除、遍历等。它有两个主要的子接口:List和Set。List是一个有序的集合,可以包含重复元素。它提供了按索引访问、插入、删除等操作。常见的实现类有Array

ios - 无法在 Collection View 中选择项目

我尝试将此代码用于collectionViewHowtomakeasimplecollectionviewwithSwift但对于swift3我在viewController中添加了这些更改importUIKitclassViewController:UIViewController,UICollectionViewDataSource,UICollectionViewDelegate{letreuseIdentifier="cell"//alsoenterthisstringasthecellidentifierinthestoryboardvaritems=["1","2","3"

Collecting package metadata (current_repodata.json): failed

一、问题描述安装anaconda之后,想创建环境,用了下面这段代码:condacreate-npytorchpython=3.9conda创建环境报错了,报了如下这一堆:Collectingpackagemetadata(current_repodata.json):failedUnavailableInvalidChannel:Thechannelisnotaccessibleorisinvalid.channelname:simplechannelurl:https://pypi.tuna.tsinghua.edu.cn/simpleerrorcode:404Youwillneedtoad

ios - TableView 单元格中的 Collection View 慢速滚动性能

我在stackoverflow和我搜索的许多网站上检查、尝试了许多解决方案。我的问题:我在表格View单元格中有一个CollectionView。我的数据必须在TableView(viewdidload)中加载1次。当我将数据传递到表格单元格内的CollectionView时,它没有出现,因为我需要再次重新加载CollectionView。所以我这样做:数据->TableView的cellforrow内部->传递到CollectionView->cell.collectionView.reloadData()这会导致滚动性能问题:当我滚动时,collectionView.reloadD

ios - Swift 准备 Segue : How to know If a button or a table row initiated Segue

这是我的代码。我正在尝试执行segue。我有一个条形按钮项目以及一个表,其中的行执行相同的segue。我想知道何时单击按钮以及何时单击特定行。以下代码适用于按钮但不适用于表格的行overridefunctableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){activePlaceRow=indexPath.rowperformSegue(withIdentifier:"toMap",sender:nil)}overridefuncprepare(forsegue:UIStoryboardSegue,send

swift - NSOpenPanel继承与 "designated initializer"

我是swift的新手,来自C++,没有Obj-C的背景,我找不到一个小问题的优雅解决方案...我使用NSOpenPanel来检索一些文件url。我的代码看起来像这样:letimport_panel=NSOpenPanel()import_panel.allowsMultipleSelection=true;import_panel.canChooseDirectories=false;import_panel.canCreateDirectories=false;import_panel.canChooseFiles=true;letimport_panel_delegate=Impo