草庐IT

frame_layout

全部标签

iOS swift : How to recreate a Photos App UICollectionView Layout

我想知道如何创建iOS照片应用布局。我怎样才能让它看起来像放大到一个集合,同时导航栏显示一个后退按钮?它是被推送到UINavigationController上的新ViewController吗?如果是这样,他们究竟是如何在扩展时设法匹配瓷砖的。是否有第三方库可以让我轻松地重新创建这样的布局?希望您能帮助我理解其工作原理。 最佳答案 要回答您的第一个问题,“它是一个被推送到UINavigationController上的新ViewController吗?”。是的,它是一个新的ViewController。Apple在这里使用的是UI

swift - 我正在使用 firebase 在 swift 中测试登录身份验证并收到错误 get output frames failed, state 8196

我正在使用firebase在swift中测试登录身份验证并收到错误,输出帧失败,状态8196。这是日志我明白了2018-11-1911:14:42.259565+0530Loginpage[9509:563668]-[I-ACS036002]Analyticsscreenreportingisenabled.Call+[FIRAnalyticssetScreenName:setScreenClass:]tosetthescreennameoroverridethedefaultscreenclassname.Todisablescreenreporting,settheflagFire

ios - 为什么在 SpriteKit 中 frame.size 1024x768 在纵向模式下?

当我使用Swift从头开始​​创建SpriteKit游戏时,在我的GameScene的didMoveToView方法中,我写道:print(frame.size.width)print(frame.size.height)我回来了。1024.0768.0我的应用程序当前正在运行的是纵向模式。我认为框架是可以包含节点的最小矩形。如果我在屏幕上添加一个形状来确认我正在阅读的内容,我会添加以下代码:anchorPoint=CGPoint(x:0.5,y:0.5)letleftShape=SKShapeNode(rectOfSize:CGSize(width:frame.size.width/

ios - 如何通过 CollectionView 中的 Flow Layout 将单元格对齐到顶部

在这段代码中,我试图更改UICollectionView的第一个单元格和其他具有相同大小的单元格的大小,但是在第一行中只有一个单元格出现,而我想要两个出现:funccollectionView(_collectionView:UICollectionView,layoutcollectionViewLayout:ifindexPath.row==0{returnCGSize(width:collectionView.frame.width/1.5-2,height:collectionView.frame.width/1.5-2)}else{returnCGSize(width:col

C++和Swift : How are structs handled in C++ stack frames? struct继承的复杂性为什么Swift不支持struct继承?

在最近的一次开发者聚会上,简要讨论了Swift中的struct继承(或者更准确地说,Swift中缺少struct继承)的主题。我假设Swift不支持struct继承的原因是因为:struct是值类型值类型在堆栈帧之间复制继承意味着struct的大小可以变化(例如,如果Lorry继承自Vehicle和Lorry添加.weightCapacity然后Lorry将比Vehicle需要更多的空间)具有在编译时未知大小的值类型参数会使调用者的栈帧构造和被调用者访问数据变得复杂我假设正是由于这些复杂性,这可能会为涉及struct的每个函数调用添加额外的操作,从而降低性能,Swift不允许struc

swift - 'init 不可用 : use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type

由于我将我的代码转换为Swift3,所以发生了错误。'initisunavailable:use'withMemoryRebound(to:capacity:_)'totemporarilyviewmemoryasanotherlayout-compatibletype.这是我的代码:funcparseHRMData(data:NSData!){varflags:UInt8varcount:Int=1varzw=[UInt8](count:2,repeatedValue:0)flags=bytes[0]/*----------------FLAGS----------------*//

ios - Swift 3.0 中的 UICollectionViewController 错误 : must be initialized with a non-nil layout parameter

我是iOS开发新手。我一直在学习Swift,今天,我尝试使用UICollectionViewController。我的代码如下:classViewController:UICollectionViewController,UICollectionViewDelegateFlowLayout{varcolView:UICollectionView!overridefuncviewDidLoad(){super.viewDidLoad()//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.letlayout:UIColle

ios - Swift 3 和 lldb : Print frame of UIView, 给定十六进制地址

调试iOS目标、Swift3、Xcode8.2、lldb-360.1.68我想打印一个UIView的frame,我在之前的断点处获取了它的地址。这是我最好的镜头,但结果令人失望:(lldb)expr-lobjc-O--NSStringFromRect((CGRect)([(UIView*)0x7a241b30frame]))error:useofundeclaredidentifier'CGRect'谢谢! 最佳答案 如果你在快速调试器中,你可以使用unsafeBitCast将指针转换为类型。pounsafeBitCast(0x7a

swift - Swift中,如何使用Layout Anchor设置多个子view的宽度相同(无常量)?

例如,我有一个包含3个subview的父View。我正在以编程方式使用LayoutAnchor并尝试实现以下布局|--subview1--|--subview2--|--subview3--|三个subview中的每一个都具有相等的宽度。换句话说,subView1.width=subView2.width=subView3.widthsubView1.width+subView2.width+subView3.width=parentView.width我知道我可以使用乘数来设置subview1和subview2的宽度:subView1.widthAnchor.constraintEq

ios - 它显示 "required initializer init must be provided in subclass of UIControl"当我覆盖 init(frame : CGRect)

此代码有效:importUIKitclasswheel:UIControl{}但是这段代码没有:classwheel:UIControl{overrideinit(frame:CGRect){super.init(frame:frame)}当我覆盖init(frame:CGRect)而不是init(coderaDecoder:NSCoder).为什么我必须执行init(coderaDecoder:NSCoder)?如果我没有实现init(frame:CGRect)为什么我不需要实现它?我找到了一个类似的StackOverflow帖子,但没有解释:Swift:Error:'require