草庐IT

rel-attribute

全部标签

ios - NSLayoutConstraint 没有成员 'Attribute'

我正在尝试转换下面的swift代码NSLayoutConstraint.Attribute.height我正在使用SkeletonView,它在执行时抛出错误。我找不到那个新的替换语法类型“NSLayoutConstraint”没有成员“Attribute” 最佳答案 这完全取决于您使用的Swift版本。NSLayoutConstraint.Attribute.height//Swift4.2NSLayoutAttribute.height//Swift3.0+NSLayoutAttributeHeight//Swift2?

ios - 由于未捕获的异常 'NSInvalidArgumentException' 而终止应用程序,原因 : Unknown layout attribute'

我正在尝试以编程方式向UIView中的按钮添加约束:letconstraint=NSLayoutConstraint(item:arrowButton,attribute:NSLayoutAttribute.LeadingMargin,relatedBy:NSLayoutRelation.Equal,toItem:self,attribute:NSLayoutAttribute.NotAnAttribute,multiplier:1,constant:10)arrowButton.addConstraint(constraint)我希望按钮的前边距距离View的左边距为10。此代码在V

swift - 核心数据 : How do I store a custom object as a transformable attribute?

目前我有一个名为Place的类定义如下:classPlace{letname:Stringletaddress:Stringletcoordinate:CLLocationCoordinate2Dlettype:StringvarphotoReference:String?varphoto:UIImage?/*functionsetc*/}在我的数据模型中,我有一个名为FoundPlaces的实体。它有一个属性place,类型为“transformable”。我快要发疯了,试图找到存储此对象的Swift解决方案。开头的数据模型是不是错了?任何指导表示赞赏。谢谢!

ios - 警告 : Unexpected version number in 'available' attribute for non-specific platform '*'

我有这段代码:@available(*,deprecated:3.0,message:"Useactivate().")publicfuncinstall(){self.activate()}自从我升级到swift5和xcode10.2之后,我收到以下警告:Unexpectedversionnumberin'available'attributefornon-specificplatform'*'并修复:Replace':3.0'with''这个警告是什么?它说什么? 最佳答案 documentation指出星号不能与Swift版本

ios - 对核心数据 : "Select * WHERE "attribute"== "Some string" "执行此操作

我确实设法做到了这一点,方法是制作一个带有循环的函数,该循环将属性检查为字符串。但我正在寻找一种更好的方法来做到这一点。在sql中我这样做:Select*WHERE"attribute"=="string"是否有快速完成此操作的方法?我的函数如下所示:functableData(){letobjects=retrieveValues("JobTime")//RetrieveaNSMutableArrayif!objects.isEmpty{forvarindex=0;index 最佳答案 为了在CoreData中执行获取请求,您必须

swift : Regex for remove all inline HTML attributes

我想清除HTML字符串文本中的所有属性。我找到了很多答案,但问题是如果我们没有正确的CSS样式,正则表达式的语法将无法工作。我的处境很困难,因为从API获取的HTML文本与其样式不符。可能是这样的:AngkorWatisatemplecomplexinCambodiaandthelargestreligiousmonumentintheworld,onasitemeasuring162.6hectares(1,626,000m2;402acres).ItwasoriginallyconstructedasaHindutemplededicatedtothegodVishnuforthe

ios - 错误 : UICollectionView received layout attributes for a cell with an index path that does not exist in Swift

我“https://www.raywenderlich.com/392-uicollectionview-custom-layout-tutorial-pinterest”创建自定义UICollectionView。(调整单元格高度)如果我向上滚动,cell会继续添加,从上往下滚动刷新。当您运行您的应用程序并最初生长Cells时没有问题。但是,刷新或重新排序单元格数量时总是出错。错误:***Assertionfailurein-[UICollectionViewDatavalidateLayoutInRect:],/BuildRoot/Library/Caches/com.apple.

swift - 是否有与 GCC `__attribute__((constructor))` 等效的 Swift?

我在用纯Swift创建东西时遇到了问题。我正在尝试实现类似于NSValueTransformer的类注册表。在Objective-C中,我将通过在子类的load类方法中调用setValueTransformer:forName:来确保NSValueTransformer子类已注册。这种方法在Swift中不起作用,因为运行时不会在Swift类上调用load。我的下一个想法是找到__attribute__((constructor))的Swift版本,但我的搜索一无所获。Swift是否提供类似于__attribute__((constructor))的东西,或者是实现此目的的唯一方法是编写

swift 3 : Getting attributes at substring in NSAttributedString

我的一个Controller有一个NSAttributeString,里面有一个链接:@IBOutletvartextView:UITextView!//BelowisextractedfromviewDidLoad()letlinkStr="Clickhereforgoodtimes."letattributedText=try!NSAttributedString(data:linkStr.data(using:String.Encoding.unicode,allowLossyConversion:true)!,options:[NSDocumentTypeDocumentAtt

Xcode 7.1 : Property with retain or strong attribute must be of object type

我在一个swift文件中有这个变量:varadbk:ABAddressBook!一直很好,直到Xcode7.1。现在它提示“具有保留或强属性的属性必须是对象类型。”错误在-Swift.h文件中。知道发生了什么变化会导致这种情况以及如何解决它吗? 最佳答案 如果Swift类声明了一些AdressBook属性并且此类是混合Swift/ObjC项目的一部分,则会发生此错误。Xcode然后生成Swift桥接header,其中此属性变为(nonatomic,strong),它仅适用于对象,不适用于结构。当我需要将ABRecordRef从Obj