• (分享)简单圆角UITextView


    UITextView has square edges, and looks ugly compared to a UITextField!

    Screen shot 2010-06-06 at 20.22.29

    Unfortunately, there isn’t an option to give the UITextView a nice border. There are various ways to do this, such as creating your own background image for the UITextView, but I have found a relatively easy way to do it – and one that anyone without photoshop skills can achieve.

    I achieve it by placing a UITextField behind the UITextView. However, in InterfaceBuilder you can’t change the height of a UITextField, so you have to edit the .xib file in Text Edit to change its height.

    Here are the steps you need to do:

    1. Add a UITextField to your View and put a UITextView on top of it.
    2. Decide on how high you want your UITextView and resize it.
    3. Give the UITextField a tag of 999 (or whatever you want) (hit CMD-1 to bring up the attributes inspector to do this).
    4. Save the .xib file and then right click the file > Open With > Other > TextEdit
    5. Search for your tag, 999, and in the same 
    6. You need to change 31 to the same height as your UITextView and then save the .xib file in TextEdit
    7. When you return to IB it will tell you the document has been modified, click Revert
      1     <object class="IBUITextField" id="154341485">
      2 <reference key="NSNextResponder" ref="774585933"/>
      3 <int key="NSvFlags">292</int>
      4 <string key="NSFrame">{{25, 199}, {275, 31}}</string> THIS IS THE LINE THAT YOU NEED TO EDIT.... CHANGE 31 TO THE HEIGHT OF YOUR UITEXTVIEW
      5 <reference key="NSSuperview" ref="774585933"/>
      6 <reference key="IBUIBackgroundColor" ref="157267157"/>
      7 <bool key="IBUIOpaque">NO</bool>
      8 <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
      9 <int key="IBUITag">999</int>THIS IS THE TAG YOU CHOSE TO HELP YOU FIND THIS SECTION IN THE XIB FILE
    8. You should now see a tall UITextField behind your UITextView. Make sure your UITextView has a transparent background!
  • 相关阅读:
    生成器 和 生成器 表达式
    函数的三大器
    02.python网络爬虫第二弹(http和https协议)
    python网络爬虫第三弹(<爬取get请求的页面数据>)
    线程
    网络编程
    分时操作系统 与 多道程序系统
    javascript原型深入解析2--Object和Function,先有鸡先有蛋
    javascript原型深入解析1-prototype 和原型链、js面向对象
    js模块化
  • 原文地址:https://www.cnblogs.com/woainilsr/p/2368517.html
Copyright © 2020-2023  润新知