首先,创建一个label:

agreeDeal = UILabel()

let tap = UITapGestureRecognizer.init(target: self, action: #selector(LoginViewController.showPrivatePolicy))

agreeDeal.addGestureRecognizer(tap)

agreeDeal.userInteractionEnabled = true

//富文本,不同字体颜色大小和颜色

let labelString = NSLocalizedString("Login_agree deal", comment: "") as NSString

let rang = labelString.rangeOfString("《")

let firstRang = NSMakeRange(0, rang.location)

let secondRang = NSMakeRange(rang.location, labelString.length - rang.location)

let labelText = NSMutableAttributedString(string: labelString as String as String)

labelText.addAttributes([NSForegroundColorAttributeName:UIColor.init(white: 1, alpha: 0.8),NSFontAttributeName:UIFont.boldSystemFontOfSize(12)], range: firstRang)

labelText.addAttributes([NSForegroundColorAttributeName:UIColor.redColor(),NSFontAttributeName:UIFont.boldSystemFontOfSize(12)], range: secondRang)

agreeDeal.attributedText = labelText

agreeDeal.textAlignment = .Center

agreeDeal.numberOfLines = 0

bottomView.addSubview(agreeDeal)

agreeDeal.snp_makeConstraints { (make) in

make.centerX.equalTo(bottomView)

make.width.equalTo(kscreenWidth)

make.top.equalTo(facebookBtn.snp_bottom).offset(10)

make.height.equalTo(50)

}

跳到下一个web view的界面:

import UIKit

import MBProgressHUD

private let url = "http://www.coollang.com/appcontent/responsibility?type=6"

class PrivatePolicyController: UIViewController,NavigationBackProtocol {

@IBOutlet weak var webView: UIWebView!

override func viewDidLoad() {

super.viewDidLoad()

configureNav()

loadWeb()

}

func configureNav()

{

let titleStr = NSLocalizedString("Login_Privacy Policy", comment: "隐私政策")

title = titleStr

leftNavigationItem()

}

func loadWeb(){

let webUrl = NSURL(string: url)

let request = NSURLRequest.init(URL: webUrl!, cachePolicy: .UseProtocolCachePolicy, timeoutInterval:requestOverTime)

webView.loadRequest(request)

webView.delegate = self

}

}

extension PrivatePolicyController:UIWebViewDelegate

{

func webViewDidStartLoad(webView: UIWebView) {

MBProgressHUD.showHUDAddedTo(webView, animated: true)

}

func webViewDidFinishLoad(webView: UIWebView) {

MBProgressHUD.hideHUDForView(webView, animated: true)

}

func webView(webView: UIWebView, didFailLoadWithError error: NSError?) {

MBProgressHUD.showTextWithMessageInBottom(error?.localizedDescription ?? "")

}

}

最新文章

  1. Spring.net 配置说明
  2. 分享我们项目中基于EF事务机制的架构
  3. 转载:C#中的泛型
  4. 怎么在Microsoft Project中冻结列
  5. pygal and matplotlib(again)
  6. Key-Value-Coding(KVC)
  7. PHP判断键值数组是否存在,使用empty或isset或array_key_exists
  8. 利用Jmeter做接口测试
  9. javassist动态修改class
  10. ARM启动流程
  11. poj 3154 Graveyard 贪心
  12. 广义后缀树(GST)算法的简介
  13. Java作业九(2017-11-6)
  14. Python脱产8期 Day13 2019/4/28
  15. ConcurrentHashMap源码
  16. 在 .NET 项目中集成 SwaggerUI(2018.9.30)
  17. Xutils简
  18. localStorage,sessionStorage的使用
  19. localStorage 不方便存储数组时的替代方法
  20. T-SQL 事务2

热门文章

  1. git之一
  2. MyCat:取代Cobar数据库中间件
  3. WPF学习之路(十二)控件(Content控件)
  4. WPF学习之路(九)导航和页面(续)
  5. linux命令 wget
  6. Aforge.net之旅——开篇:从识别验证码开始
  7. Python类属性的延迟计算
  8. Stanford coursera Andrew Ng 机器学习课程编程作业(Exercise 2)及总结
  9. shell脚本的执行
  10. ubuntu下apache2 安装 配置 卸载 CGI设置 SSL设置