国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS Label隨字自動變大效果

2020-07-26 02:48:39
字體:
來源:轉載
供稿:網友

一、效果圖。

二、工程圖。

三、代碼。

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];    }

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 庆元县| 酉阳| 夏津县| 永济市| 辽阳市| 汶川县| 科尔| 南康市| 基隆市| 察哈| 青神县| 开封县| 琼中| 工布江达县| 清水河县| 汾阳市| 新巴尔虎左旗| 新绛县| 塔河县| 玛多县| 宜黄县| 仙桃市| 巴塘县| 威信县| 莫力| 榕江县| 信宜市| 万州区| 淄博市| 沈阳市| 色达县| 长春市| 屏山县| 英超| 佛冈县| 忻城县| 忻城县| 福泉市| 平江县| 涟源市| 阿巴嘎旗|