gpt4 book ai didi

ios - 在 iOS 中加载旁遮普语文本

转载 作者:IT王子 更新时间:2023-10-29 05:53:49 28 4
gpt4 key购买 nike

我收到了后端的回复,格式如下,我想同时显示旁遮普语、古尔穆基语旁遮普语和英语的内容,

  {
"AK_Index" = "APNE SEVAK KEE AAPE RAKE";
Ang = 747;
Author = "Guru Arjan Dev Ji";
Bani = "<null>";
"Bani_ID" = "<null>";
English = "Guru Nanak has met the Supreme Lord God; I am a sacrifice to Your Feet. ||4||1||47||";
"English_Initials" = gnmptckb;
Gurmukhi = "guru nwnku imilAw pwrbRhmu qyirAw crxw kau bilhwrw ]4]1]47]";
"Gurmukhi_Initials" = "gnmpqckb]";
ID = 32133;
Kirtan = Kirtan;
"Kirtan_ID" = 2853;
Punjabi = "gurU nwnk Awpxy prm pRBU nUM iml ipAw hY Aqy aus dy pYrW qoN GolI jWdw hY[";
Raag = "Raag Soohee";
"Teeka_Arth" = "hy pRBU! mYN qyry crnW qoN sdky jWdw hW[ ijs mnu`K nUM gurU nwnk iml ipAw, aus nUM prmwqmw iml ipAw ]4]1]47]";
"Teeka_Pad_Arth" = "kau = nUM, qoN ]4]1]47]";
}

附件是结果的截图。截图来自安卓。我想要在 iOS 中获得完全相同的结果。

enter image description here如何在 iOS 中实现这一点。任何帮助将不胜感激。

最佳答案

我创建了一个扩展来更改某些特定字符串的颜色字体。

extension NSMutableAttributedString {

func setFontColorAndSize(_ textToFind : String,withColor color: UIColor,andFont font :UIFont){
let range = self.mutableString.range(of: textToFind, options: .caseInsensitive)
if range.location != NSNotFound {
setAttributes([NSAttributedStringKey.font : font,NSAttributedStringKey.foregroundColor :color], range: range)
}
}

// This is how you change
let resultString = NSMutableAttributedString(string: "hello") // convert any string to mutable attributed
resultString.setFontColorAndSize("hel", withColor: UIColor.grey, andFont: UIFont.boldSystemFont(ofSize: 17)) // pass the string you want to set particular color and font
UILabel.attributedText = resultString // than update the label

关于ios - 在 iOS 中加载旁遮普语文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50083675/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com