一、效果图。
成都创新互联公司基于成都重庆香港及美国等地区分布式IDC机房数据中心构建的电信大带宽,联通大带宽,移动大带宽,多线BGP大带宽租用,是为众多客户提供专业成都服务器托管报价,主机托管价格性价比高,为金融证券行业服务器托管,ai人工智能服务器托管提供bgp线路100M独享,G口带宽及机柜租用的专业成都idc公司。
二、工程图。
三、代码。
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];
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。
网页名称:iOSLabel随字自动变大效果
网站路径:https://www.cdcxhl.com/article16/gopegg.html
成都网站建设公司_创新互联,为您提供外贸建站、软件开发、品牌网站建设、ChatGPT、电子商务、网站营销
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联