问题标签 [swift4.1]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
arrays - Adopt a protocol for Array and Dictionary
I have the following protocol:
I also implemented it's methods for some classes and structures in extensions:
When I tried to test it with the following code:
I received an error with text "[[String : String]]
is not convertible to Array<Dictionary<String, Any>>
". However my code works fine when I set type of the variable dict
like that:
Can someone explain me why the first version of my code is not compiling?
swift4.1 - 在 Swift 4 中使用对象和键初始化字典
我正在尝试使用 Objects(Array) 和相应的键初始化字典。我正在崩溃,它说[NSDictionary initWithObjects:forKeys:]: count
对象(12)与键数(1)不同“。不确定我在这里缺少什么。有人可以帮忙吗?
下面是我的代码。
它在最后一行代码中崩溃。
以下是我想要实现的
我的monthDictionary应该有
avfoundation - iOS保存到照片不起作用
我正在使用 Swift 4 和 iOS 11 开发我的应用程序。
问题是我可以在 UIImageView 中显示 UIImage,但我无法将它保存到 iPhone 的相册中。我一直在寻找很长时间,但不知道如何解决它。
这是我的代码的一部分:
将所有 videoCapture 代码放入VideoCapture.swift
.
ViewController.swift
文件如下:
PreviewViewController.swift
如下:
我使用 segue 从 ViewController 转到 PreviewViewController,并将 ViewController 中的图像传递给 PreviewViewController 中的 imageView。但是为什么它不将图像存储在相册中呢?
顺便说一句,我已经在info.plist
.
avfoundation - 如何一次下载多个视频?
我想一次下载多个视频,但在我的情况下,最多可以正确下载 3 个视频,但之后它会覆盖前一个。我正在使用 urlSession downloadTask 在后台运行并保存到文档目录中。有没有更好的方法来做到这一点?
ios - 从 UIText 字段的用户输入更改 UIView 框架的高度和宽度
我可以通过硬编码高度和宽度来更改按钮单击时 UIView 框架的高度和宽度,但是当我在 CGFloat 格式的 UItext 字段中从用户那里获得输入时,我无法更改它。
`
`
这里有人可以根据我的要求更新我的代码吗???
swift - 当我使用 NSSet 时,我得到了这个线程 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)?
当我使用 NSSet 时,我得到了这个线程 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)?
这是我的代码:
ios - 为什么我的动画不流畅?
我正在尝试使用自定义类为文本字段设置动画,当我将左侧约束从 0 更改为 (self.bounds.width - self.bounds.width/3) 时,动画不流畅,但是当我将其设置回0 完美运行。
这是我的自定义类的一部分:
ios - 如何使用 json 和 swift 4.1 在谷歌地图上添加多个标记?
使用 swift 4.1 在谷歌地图上不显示多个标记我正在连接 JSON 并在控制台上显示结果,但是如何使用谷歌地图连接纬度和经度。
这是我的谷歌地图代码: