玩具熊回家路

2023-06-08更新 / 7.1分 / 喜剧,家庭 / 捷克 / 2010

聚合云播

排序

玩具熊回家路剧情简介

" let dic = ToolsHelper.parserRichText(txt: storyText) DispatchQueue.main.async { self.richTextBox.attributedText = dic["attributedText"] as? NSAttributedString self.contentHeight = dic["height"] as? CGFloat ?? 0 self.contentWidth = dic["width"] as? CGFloat ?? 0 self.updateAttributedString() } } let tag = 200 DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() 1) { let subView = self.view.viewWithTag(tag) if subView != nil { subView?.removeFromSuperview() } } } // 编辑文本 func editText(txt: String) -> Void { let tags = [RichTextTag.Bold: "strong", RichTextTag.Italic: "em", RichTextTag.Underline: "ul", RichTextTag.Deleteline: "del"] var result = "" var otherTxt = txt for item in tags.keys { var tagStart = "", tagEnd = "" if otherTxt.contains(item.begin) && otherTxt.contains(item.end) { tagStart = "<(tags[item] ?? "")>" otherTxt.components(separatedBy: item.begin)[1] tagEnd = tagStart.components(separatedBy: item.end)[0] "" tagEnd tagStart = otherTxt.components(separatedBy: item.begin)[0] tagStart tagEnd = otherTxt.components(separatedBy: item.end)[1] tagEnd } if (tagStart == "") { continue } result = tagStart otherTxt = tagEnd } result = otherTxt print(result) } // 更新AttributedString func updateAttributedString() -> Void { let attributedtext = NSMutableAttributedString(attributedString: richTextBox.attributedText) let attr = attributedtext.attributes(at: 0, longestEffectiveRange: nil, in: NSRange(location: attributedtext.length - 1, length: 1)) let b = (contentHeight 20) > self.view.frame.height let font = UIFont.systemFont(ofSize:Config.TEMPMENUSIZE (b ? -1 : 1)) let paragraphyStyle = NSMutableParagraphStyle() paragraphyStyle.lineSpacing = 5 paragraphyStyle.lineBreakMode = .byTruncatingTail attributedtext.addAttribute(.paragraphStyle, value: paragraphyStyle, range: NSRange(location: 0, length: attributedtext.length)) attributedtext.addAttribute(.font, value: font, range: NSRange(location: 0, length: attributedtext.length)) for item in attr.keys { attributedtext.removeAttribute(item, range: NSRange(location: attributedtext.length - 1, length: 1)) } let constraints = [NSLayoutConstraint(item: view, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 10), NSLayoutConstraint(item: view, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: -10), NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 10), NSLayoutConstraint(item: view, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: -10)] let width = view.frame.width - 20 for constraint in constraints { switch constraint.firstAttribute { case .trailing: constraint.constant = width case .leading: constraint.constant = width default:break } } view.addConstraints(constraints) }}

猜你喜欢

阶梯下的恶魔

6.6 1991/美国/喜剧,悬疑,惊悚,恐怖

飞天法宝

7.2 1997/美国/喜剧,科幻,家庭

算死草

7.0 1997/香港/剧情,喜剧

兄弟恰似爱人

6.4 2016/阿根廷/剧情,喜剧,爱情

童贞放浪记

5.5 2009/日本/剧情,喜剧

纯属巧合

7.5 1988/法国/喜剧