gpt4 book ai didi

ios - Barbuttons 正在离开位置

转载 作者:行者123 更新时间:2023-11-28 15:30:11 27 4
gpt4 key购买 nike

一切都很好,直到我呈现一个 uialertcontroller。当我展示它时,barbutton 从它们的位置向下移动。

Before presenting,everything was fine with barbuttons

When i present an alert,you can see the UIBarButtonItems are off their position

创建 barbuttonitems::

的代码
let editBtn:UIBarButtonItem = UIBarButtonItem(image: UIImage(named: IMAGE_EDIT_ICON), style: .plain, target: self, action: #selector(handleEditAction))
self.navigationItem.rightBarButtonItem = editBtn

呈现 UIAlertControlelr 如下:

let alertController = UIAlertController(title: "Reset Password", message: "Please enter current password and create new password", preferredStyle: .alert)
let okAction = UIAlertAction(title: "Confirm", style: .default, handler: { [weak alertController] (_) in
})


let cancelAction = UIAlertAction(title: "Cancel", style: .default) { (_) in }


alertController.addAction(cancelAction)
alertController.addAction(okAction)



okAction.isEnabled = false


alertController.addTextField { (textField) in
textField.placeholder = "Current Password"
}


}
alertController.addTextField { (textField) in
textField.placeholder = "New Password"
}


}
alertController.addTextField { (textField) in
textField.placeholder = "Confirm Password"
textField.isSecureTextEntry = true
NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextFieldTextDidChange, object:textField,
queue: OperationQueue.main) {
(notification) -> Void in
self.validateResetPassword(alertController: alertController,okAction: okAction)
}



}

self.present(alertController, animated: true, completion: nil)

谁能帮我解决这个问题。提前致谢

最佳答案

按如下所示替换您的栏按钮:

let barButton =    UIBarButtonItem(image: UIImage(named: "imageName"), style: .plain, target: self, action: #selector(self.YourSelectorTarget))

关于ios - Barbuttons 正在离开位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44793548/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com