UITextView

//
// ViewController.swift
// UILabelTest
//
// Created by mac on 15/6/23.
// Copyright (c) 2015年 fangyuhao. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    var textview = UITextView(frame: CGRectMake(10, 100, 200, 100))
    textview.layer.borderWidth = 1
    textview.layer.borderColor = UIColor.grayColor().CGColor
    textview.editable = true//设置是否只读
    textview.text = "15088631226\n第二行"
    textview.dataDetectorTypes = UIDataDetectorTypes.PhoneNumber//还木有成功
    textview.allowsEditingTextAttributes = true//可进行加粗
    textview.scrollRangeToVisible(NSMakeRange(0, 5))


    self.view.addSubview(textview)



    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

posted @ 2016-12-16 23:52  乱笙歌  阅读(74)  评论(0编辑  收藏  举报