小编Gus*_*cht的帖子

Firebase 存储覆盖文件

我的程序中有一个小错误。

我的应用程序中有 firebase 存储。我想让用户将图像上传到存储。

问题是当用户上传图像然后尝试上传另一张图像时。该程序会覆盖之前上传的图像。

我想要的是当用户想要上传另一张图像时避免“覆盖”。并将两个图像保存在不同的文件中

let currentUser = Auth.auth().currentUser
    let StorageRefrenece = Storage.storage().reference()
    let posterImageRef =
        StorageRefrenece.child("posters").child(currentUser!.uid).child("posterOne.jpg")
Run Code Online (Sandbox Code Playgroud)

谢谢

firebase swift firebase-storage

12
推荐指数
1
解决办法
8563
查看次数

Java/Kotlin相当于Swift [String:[String:Any]]

[String : [String : Any]]来自Kotlin或Java语言的Swift 相当于什么?

我需要从数据库中检索一个如下所示的结构:

Key:
    Key : Value
    Key : Value
    Key : Value
Key :
    Key : Value
    Key : Value
    Key : Value
Run Code Online (Sandbox Code Playgroud)

java android dictionary kotlin swift

7
推荐指数
1
解决办法
885
查看次数

Swift 4 - UITextfield边框半径颜色问题

我正在尝试使用UITextfields(我是初学者).现在我已经设置了我的应用程序的背景颜色并设置了边框半径,但是在执行此操作时我遇到了一个小问题.

我的代码:

        superView.backgroundColor = backgroundColorrr
        loginView.backgroundColor = backgroundColorrr

        loginLabel.textColor = UIColor.white
        loginLabel.text = "Login"

        loginButton.layer.cornerRadius = 5
        loginButton.layer.borderWidth = 2.0
        loginButton.imageView?.contentMode = UIViewContentMode.scaleToFill
        loginButton.layer.borderColor = UIColor.lightGray.cgColor
        loginButton.layer.backgroundColor = backgroundColorrr.cgColor
        loginButton.titleLabel?.textColor = UIColor.white
        loginButton.titleLabel?.text = "Login"

        userNameTextField.layer.cornerRadius = 15.0
        userNameTextField.layer.backgroundColor = backgroundColorrr.cgColor
        userNameTextField.layer.borderWidth = 0.5
Run Code Online (Sandbox Code Playgroud)

我的结果:

模拟器中的当前布局

你看到我想要实现的是与我的屏幕其他部分具有相同的背景颜色(我不希望文本字段边框旁边的白色.与我的按钮相同,边框半径不会改变完全(使用的图像与我按钮的大小相同).

欢迎任何帮助!

cornerradius uitextfield ios swift swift4

3
推荐指数
1
解决办法
2840
查看次数

具有多个参数的 Kotlin 补全

想象一个具有多参数完成的方法:

fun foo(completion : (p1 : Int, p2 : Int) -> Unit){
    completion(1, 2)
}
Run Code Online (Sandbox Code Playgroud)

通话时如何访问p1和p2 foo

android kotlin completionhandler

2
推荐指数
1
解决办法
1868
查看次数

在应用程序购买中使用自动更新订阅时需要还原按钮吗?

auto-renewable subscription在我的应用中使用过。一切正常,但是如果用户从中删除应用程序iPhone并再次安装,那么如何知道该用户是否已订阅?

我们必须存储用户数据还是服务器?

我提到了一些类似的问题,他们说Apple拒绝使用带有“恢复”按钮的应用auto-renewable In-App-Purchase

objective-c in-app-purchase ios swift

2
推荐指数
1
解决办法
3797
查看次数