小编Mil*_*loo的帖子

UITextview以文本中心对齐方式编写,快速

当我点击加粗按钮时,我有一个文本编辑器

我可以用粗体字写这是代码

txtEditor.typingAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.black/, NSAttributedStringKey.font.rawValue: UIFont.boldSystemFont(ofSize: (txtEditor.font?.pointSize)!)]
Run Code Online (Sandbox Code Playgroud)

我想在“中心文本中心对齐”中单击一个按钮(我写的行)时需要一个按钮,而不是其他行

这是代码

let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .center
Run Code Online (Sandbox Code Playgroud)

但是在将如何在UITextview中添加这2行代码以输入居中对齐之后呢?

uitextview nsattributedstring nsmutablearray ios swift

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

快速崩溃没有 http 或 https 的 uiwebview

我想在 Web 视图中显示 URL

这是我的代码

  let urlString:String = "https://www.apple.com"
        let url:URL = URL(string: urlString)!
        let urlRequest:URLRequest = URLRequest(url: url)
        webView.load(urlRequest)

        urlTextField.text = urlString
Run Code Online (Sandbox Code Playgroud)

如果用户忘记写入 http 或 https,应用程序崩溃了,我该如何解决此错误

uiwebview nsstring uitextfield ios swift

-1
推荐指数
1
解决办法
1127
查看次数