小编Kru*_*nal的帖子

自动调整UILabel

有没有办法自动调整UILabel的大小?给定尺寸为40 x 40时,文本字体大小将根据字符数进行调整.

objective-c uilabel autoresize ios swift

13
推荐指数
1
解决办法
1万
查看次数

如何获取Documents目录中文件的所有路径?

我通常使用路径NSBundle.

但是,NSBundle不包含Documents文件夹.

如何获取Documents目录中文件的所有路径(或名称)?

iphone xcode nsfilemanager nsbundle ios

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

自ios 11.0以来,底部布局已弃用

我可以做些什么来修复底部布局,不推荐使用iOS 11,我正在使用Xcode 9 beta 2.

在此输入图像描述

autolayout ios11 xcode9-beta xcode9 safearealayoutguide

13
推荐指数
3
解决办法
5903
查看次数

Swift 4 Label属性

我正在从swift 3转到swift 4.我有UILabels,我给标签提供了非常具体的文本属性.初始化strokeTextAttributes时,我在获取"意外发现nil时解包可选值"错误.坦白说,我完全迷失了.

在swift 3中,strokeTextAttributes是[String:Any],但是swift 4引发了错误,直到我将其更改为下面的内容.

let strokeTextAttributes = [
    NSAttributedStringKey.strokeColor.rawValue : UIColor.black,
    NSAttributedStringKey.foregroundColor : UIColor.white,
    NSAttributedStringKey.strokeWidth : -2.0,
    NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 18)
    ] as! [NSAttributedStringKey : Any]


chevronRightLabel.attributedText = NSMutableAttributedString(string: "0", attributes: strokeTextAttributes)
Run Code Online (Sandbox Code Playgroud)

nsattributedstring uilabel ios swift swift4

13
推荐指数
2
解决办法
3万
查看次数

目标C:如何以编程方式在Safe Area中创建self.view

我刚刚将我的应用程序从支持iOS 8改为支持iOS 9及更高版本.

由于我不使用故事板来创建我的视图,我想知道是否有编程方式的"使用安全区域指南"选项或类似的东西.

我试图锚定我的视图,但它们在iPhone X模拟器中保持顶部和底部重叠.

xcode objective-c ios swift safearealayoutguide

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

旋转180度为UIImageView,并以相同的路线向后旋转

我有一个按钮,想要旋转里面的图像:

self.DashButton.imageView.transform = CGAffineTransformMakeRotation(M_PI);

用户点击图像后向上箭头向下箭头当再次点击按钮时,我希望向下箭头再次向上旋转向上箭头,但它是逆时针旋转相同,但我只想让箭头向后反转向上箭头

旋转代码:

self.DashButton.imageView.transform = CGAffineTransformIdentity;

我试过了

self.DashButton.imageView.transform = CGAffineTransformMakeRotation(-M_PI);

我想要的不是旋转整圆,只旋转180度和-180旋转,而不是360度全旋转

xcode core-animation objective-c ios swift

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

Xcode 8中的代码折叠

是否有人在Xcode 8中遇到代码折叠问题?每次我折叠GameScene.swift(或任何其他文件),切换到,例如AppDelegate.swift,然后切换回GameScene.swift(之前折叠),它展开.

xcode code-folding

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

ARKit无法运行会话,此设备不支持配置

在iPhone 6 plus上使用ARWorldTrackingSessionConfiguration获取和错误 Unable to run the session, configuration is not supported on this device

它能是什么?

ios ios11 arkit

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

Flutter:'package get' 尚未运行;'Pub get' 尚未运行

我从 git 下载了一个用于目录的 Flutter 示例代码,它显示了一个警告,

'package get' 尚未运行
'Pub get' 尚未运行

这是什么意思?如何解决?我应该按照警告中的链接的建议忽略此警告或更新依赖项吗?

在此处输入图片说明

android-studio flutter flutter-dependencies

12
推荐指数
3
解决办法
3万
查看次数

类型'NSNotification.Name'没有成员'UITextField'

使用Swift 4.2,得到以下错误,这对Swift 4工作正常.

类型'NSNotification.Name'没有成员'UITextField'

这是我的错误代码.

NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextField.textDidChangeNotification, object: textField, queue: OperationQueue.main) { (notification) in
            loginAction.isEnabled = textField.text != ""
        }
Run Code Online (Sandbox Code Playgroud)

完整代码:

@IBAction func alertWithLogin(){

    let alertController = UIAlertController(title: "Please Enter Credential", message: nil, preferredStyle: .alert)

    // ADD ACTIONS HANDLER
    let loginAction = UIAlertAction(title: "Login", style: .default) { (_) in

        let loginTextField = alertController.textFields![0] as UITextField
        let passwordTextField = alertController.textFields![1] as UITextField

        // do something with after login
    }
    loginAction.isEnabled = false
    alertController.addAction(loginAction)

    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { …
Run Code Online (Sandbox Code Playgroud)

nsnotificationcenter ios swift4.2

12
推荐指数
2
解决办法
8327
查看次数