【代码笔记】iOS-Label随字自动变大
来源:互联网 发布:beyonce running 知乎 编辑:程序博客网 时间:2024/05/18 03:46
一,效果图。
二,工程图。
三, 代码。
RootViewController.h
#import <UIKit/UIKit.h>//添加HPGrowingTextView头文件#import "HPGrowingTextView.h"@interface RootViewController : UIViewController<HPGrowingTextViewDelegate>{ HPGrowingTextView *textView;}@end
RootViewController.m
- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. textView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(10, 100, 240, 40)]; textView.isScrollable = NO; textView.contentInset = UIEdgeInsetsMake(0, 5, 0, 5); textView.minNumberOfLines = 1; textView.maxNumberOfLines = 6; // you can also set the maximum height in points with maxHeight // textView.maxHeight = 200.0f; textView.returnKeyType = UIReturnKeyGo; //just as an example textView.font = [UIFont systemFontOfSize:15.0f]; textView.delegate = self; textView.internalTextView.scrollIndicatorInsets = UIEdgeInsetsMake(5, 0, 5, 0); textView.backgroundColor = [UIColor greenColor]; textView.placeholder = @"Type to see the textView grow!"; [self.view addSubview:textView]; }
阅读全文
0 0
- 【代码笔记】iOS-Label随字自动变大
- 【代码笔记】iOS-长条label
- 【代码笔记】iOS-可拷贝的label
- label自动换行代码
- Label自动换行代码
- label自动换行代码
- Label自动换行代码
- label自动换行代码
- iOS label自动换行
- #iOS开发笔记#实现label的自动换行
- 【代码笔记】iOS-导航条的标题(label)
- iOS —label自动换行
- iOS —label自动换行
- iOS 代码tableViewCell自适应label
- iOS开发笔记--描边label
- 【代码笔记】iOS-cell自动变化大小
- 【代码笔记】iOS-UIAlertView自动关闭
- iOS小技巧--Label自动换行
- c++ 中文输出
- WINHEX 数据恢复实用脚本
- 程序设计模式(十) C++ 外观(Facade)模式
- NYOJ
- 剑指Offer——(28)数组中出现次数超过一半的数字
- 【代码笔记】iOS-Label随字自动变大
- docker install on ubuntu 14.04 server
- Zen Coding插件
- 百度图表插件功能
- springmvc案例一
- RecyclerView添加下拉刷新和上拉加载更多
- 排序子序列
- GCD使用经验与技巧浅谈
- 《Tensorflow和深度学习笔记》100页