小编Kyl*_*loR的帖子

ImageView不会使用新图像进行更新

我正在尝试从用户的手机中选择图像并使用所述图像更新图像视图.

我遇到的问题是它不会更新图像.它确实到达那里,因为我添加了断点并且它到达了断点,并且图像视图可以在我手动尝试将其更改为其他地方时更改图像.

但它在我需要时拒绝工作.

我的图片视图:

    lazy var profilePictureImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "DefaultUser")
        imageView.translatesAutoresizingMaskIntoConstraints = false
        imageView.contentMode = .scaleAspectFill

        imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleSelectProfilePicture)))
        imageView.isUserInteractionEnabled = true
        return imageView
    }()
Run Code Online (Sandbox Code Playgroud)

通过在设备上挑选照片来更新图像的代码:

import UIKit

extension ProfileVC: UIImagePickerControllerDelegate, UINavigationControllerDelegate {

    func handleSelectProfilePicture() {
        let picker = UIImagePickerController()
        picker.delegate = self
        picker.allowsEditing = true
        present(picker, animated: true, completion: nil)
    }

    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
         var selectedImageFromPicker: UIImage?
         if let editedImage = info["UIImagePickerControllerEditedImage"] as? …
Run Code Online (Sandbox Code Playgroud)

image uiimagepickercontroller ios swift

8
推荐指数
1
解决办法
5095
查看次数

关闭推送视图控制器

所以我有一个视图控制器,我显示如下:

func showProfileForTrainer(trainer: Trainers) {
    let viewPTProfileVC = ViewPTProfileVC()
    viewPTProfileVC.trainer = trainer
    self.navigationController?.pushViewController(viewPTProfileVC, animated: true)
}
Run Code Online (Sandbox Code Playgroud)

但是当试图忽视这个观点时,我无法让它发挥作用.它在导航栏中有一个后退按钮,功能很好,但是当试图通过按钮关闭视图时,它什么都不做.我目前尝试过:

func handleMessageTrainer() {
    dismiss(animated: true) {
        print(1)
        self.tabBarVC?.showChatLogForTrainer(trainer: self.trainer!)
    }
    self.dismiss(animated: true) {
        print(2)
        self.tabBarVC?.showChatLogForTrainer(trainer: self.trainer!)
    }
    navigationController?.dismiss(animated: true, completion: {
        print(3)
        self.tabBarVC?.showChatLogForTrainer(trainer: self.trainer!)
    })
    self.navigationController?.dismiss(animated: true, completion: {
        print(4)
        self.tabBarVC?.showChatLogForTrainer(trainer: self.trainer!)
    })
    print(5)
}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,我尝试过各种各样的方法而且都没有工作,而控制台只是输出5.

令人沮丧的是,在我的应用程序的其他地方,我以与开头所示相同的方式呈现了一个视图,并且它被解雇了 dismiss(animated: true) { ... }

知道为什么它不能在这里工作吗?

uiviewcontroller viewcontroller dismiss ios swift

7
推荐指数
2
解决办法
8278
查看次数

电子生产如何调试

我无法使用电子打包程序在我构建的电子应用程序中打开 chrome 开发工具。

我已经尝试过,mainWindow.webContents.openDevTools()但这没有用。

在网上查看和其他答案时,我遇到了评论rendererConfig.devtool = ''webConfig.devtool = ''但这也没有什么区别。

我还尝试添加一个快捷键来打开开发工具,但这没有任何作用。

我正在使用最新版本的电子。

感谢您提前提供的任何帮助。

electron

6
推荐指数
1
解决办法
3988
查看次数

无法增加颤振中对话框的宽度

我需要在我的应用程序中构建一个弹出对话框。我正在使用 Dialog 类并用 SizedBox 类包装它以增加对话框的宽度。但是,对话框的宽度并没有增加。我怎样才能增加它的宽度?

onTap: () {
showDialog(
    context: context,
    child:SizedBox(
        width: 900,
        child: Dialog(
            backgroundColor :Colors.white,
            insetAnimationDuration: const Duration(milliseconds: 10),
            shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
            child: Container(
                child: Column(
                    children: <Widget>[
                        Text('hello'),
                        FlatButton(
                        onPressed: () {
                            Navigator.of(context).pop();
                        },
                        child: new Text("OK"),
                        ),
                    ]
                ),
            ),  
        ),
    ),
);
},
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

6
推荐指数
1
解决办法
6541
查看次数