小编Dar*_*son的帖子

切换UITextField以在Swift中显示和隐藏

我正在尝试隐藏用户名文本字段,当切换到登录时从寄存器登录并在切换回时再次显示.我正在编写UI,我想知道如何隐藏文本字段,我是swift的新手,我认为有两个地方可以插入代码来隐藏用户名文本字段.如果没有请告诉我,谢谢!

我试图隐藏的图像. 用户名文本字段仍然显示何时切换登录

这里是UISegmentedControl

lazy var loginRegisterSegmentControl: UISegmentedControl = {
        let sc = UISegmentedControl(items: ["Login", "Register"])
        sc.translatesAutoresizingMaskIntoConstraints = false
        sc.tintColor = UIColor.white
        sc.selectedSegmentIndex = 1
        sc.addTarget(self, action: #selector(handleLoginRegisterChange), for: .valueChanged)
        return sc
    }()
Run Code Online (Sandbox Code Playgroud)

或者在HeightAnchor Change中

nameTextFieldHeightAnchor?.isActive = false
        nameTextFieldHeightAnchor = nameTextField.heightAnchor.constraint(equalTo: inputContainerView.heightAnchor, multiplier: loginRegisterSegmentControl.selectedSegmentIndex == 0 ? 0 : 1/3)
        nameTextFieldHeightAnchor?.isActive = true
Run Code Online (Sandbox Code Playgroud)

show-hide uitextfield ios swift

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

安装Firebase pod错误无效的Podfile

我正试图运行这个......

platform :ios. '9.0'
use frameworks!

pod 'Firebase', '>= 2.5.0'
Run Code Online (Sandbox Code Playgroud)

但我一直在pod安装上得到这个

[!] Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting '('
platform :ios. '9.0'
                ^. Updating CocoaPods might fix the issue.
Run Code Online (Sandbox Code Playgroud)

installation ios firebase swift

0
推荐指数
1
解决办法
276
查看次数

标签 统计

ios ×2

swift ×2

firebase ×1

installation ×1

show-hide ×1

uitextfield ×1