小编Ame*_*mey的帖子

如何使NSMutableAttributedString响应来自设置应用程序的动态类型文本

let dictTitleColor = [NSAttributedStringKey.foregroundColor: UIColor.LTColor()]
let titleAttributedString = NSMutableAttributedString(string: title, attributes: dictTitleColor)
alert.setValue(titleAttributedString, forKey: "attributedTitle")
Run Code Online (Sandbox Code Playgroud)

当我增加设备的字体大小时标题字符串不增加我在alertview控制器中设置了这个字符串?那么如何使这个响应字体大小更改?

accessibility nsattributedstring ios swift dynamic-type-feature

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

如何在iPhone x中使用AutoLayout处理带有安全区域的键盘?

在iphone x中设置安全区域后。当键盘打开时,安全区域(键盘上方的白色区域)位于键盘上方,那么如何操作键盘?

在此处输入图片说明

键盘上方的白色区域。

处理键盘代码:-

func keyboardWillChangeFrameWithNotification(_ notification: Notification, showsKeyboard: Bool) {

        let userInfo = notification.userInfo!
        let animationDuration: TimeInterval = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
        let keyboardScreenEndFrame = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue

        // keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
        let keyBoardRect = self.view.convert(keyboardScreenEndFrame, from:nil)

        UIView.animate(withDuration: animationDuration, delay: 0, options: .beginFromCurrentState, animations: {

            // Keyboard is going to appear. move composebar up
            if showsKeyboard {
                self.constraintBottomAttachmentView.constant =  keyBoardRect.size.height
            } else { // Keyboard is going to disappear. Move composebar down.
                self.constraintBottomAttachmentView.constant = 0
            }

            self.view.layoutIfNeeded()
            }, …
Run Code Online (Sandbox Code Playgroud)

iphone ios swift ios11 safearealayoutguide

5
推荐指数
1
解决办法
2620
查看次数

如何在searchcontroller中更改uitextfield颜色?

在此处输入图片说明

我已经在导航栏中嵌入了SearchController。如何更改UITextField的颜色将搜索字符串保留为White的颜色?

uinavigationcontroller ios swift uisearchcontroller ios11

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