제목과 내용이 두 개의 문자열이 있습니다.
여기에 글꼴 20과 굵은 글꼴로 제목이 필요하고 글꼴 15는 규칙적인 내용이 필요하지만 전체 텍스트가 동일한 글꼴 크기로 표시됩니다.
다음은 코드입니다.
import UIKit
class RefundandCancellationViewController: UIViewController {
@IBOutlet weak var refundTextview: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
var heading = "Bills or Taxes once paid through the payment gateway shall not be refunded other then in the following circumstances:"
var content = "\n \n 1. Multiple times debiting of Consumer Card/Bank Account due to ticnical error excluding Payment Gateway charges would be refunded to the consumer with in 1 week after submitting complaint form. \n \n 2. Consumers account being debited with excess amount in single transaction due to tecnical error will be deducted in next month transaction. \n \n 3. Due to technical error, payment being charged on the consumers Card/Bank Account but the Bill is unsuccessful.
refundTextview.textColor = UIColor.gray
refundTextview.text = heading + content
}
}
attributeText 를 사용하면 됩니다.
이렇게 해봐
var heading = "Bills or Taxes once paid through the payment gateway shall not be refunded other then in the following circumstances:"
var content = "\n \n 1. Multiple times debiting of Consumer Card/Bank Account due to ticnical error excluding Payment Gateway charges would be refunded to the consumer with in 1 week after submitting complaint form. \n \n 2. Consumers account being debited with excess amount in single transaction due to tecnical error will be deducted in next month transaction. \n \n 3. Due to technical error, payment being charged on the consumers Card/Bank Account but the Bill is unsuccessful."
let attributedText = NSMutableAttributedString(string: heading, attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 20)])
attributedText.append(NSAttributedString(string: content, attributes: [NSAttributedStringKey.font: UIFont.SystemFont(ofSize: 15), NSAttributedStringKey.foregroundColor: UIColor.blue]))
refundTextview.attributedText = attributedText
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다