资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

iOSLabel随字自动变大效果

一、效果图。

成都创新互联公司基于成都重庆香港及美国等地区分布式IDC机房数据中心构建的电信大带宽,联通大带宽,移动大带宽,多线BGP大带宽租用,是为众多客户提供专业成都服务器托管报价,主机托管价格性价比高,为金融证券行业服务器托管,ai人工智能服务器托管提供bgp线路100M独享,G口带宽及机柜租用的专业成都idc公司。

iOS Label随字自动变大效果

二、工程图。

iOS Label随字自动变大效果

三、代码。

RootViewController.h

#import 
//添加HPGrowingTextView头文件
#import "HPGrowingTextView.h"

@interface RootViewController : UIViewController

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。


本文标题:iOSLabel随字自动变大效果
本文路径:http://cdkjz.cn/article/gopegg.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220