星空网 > 软件开发 > 操作系统

UITextView

//初始化
    self.textView=[[UITextView alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    //设置内容
    self.textView.text=@"显示内容";
    //设置字体
    self.textView.font=[UIFont systemFontOfSize:20];
    //设置字体颜色
    self.textView.textColor=[UIColor whiteColor];
    //设置背景色
    self.textView.backgroundColor=[UIColor whiteColor];
    //设置返回键样式
    self.textView.returnKeyType=UIReturnKeyDefault;
    //设置键盘样式
    self.textView.keyboardType=UIKeyboardTypeDefault;
    //是否允许拖动
    self.textView.scrollEnabled=NO;
    //自适应
    self.textView.autoresizingMask=UIViewAutoresizingFlexibleHeight;
    //是否允许编辑
    self.textView.editable=NO;
    //添加到视图
    [self.view addSubview:self.textView];

//TextView继承自ScrollView,所以也具有偏移量属性,只是在ios7环境中,textView并不能立即更新contentSize,采用以下方法可以解决这个问题
    float height;
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
        
        CGRect textFrame=[[self.textView layoutManager]usedRectForTextContainer:[self.textView textContainer]];
        height = textFrame.size.height;
        
    }else {
        
        height = self.textView.contentSize.height;
    }

 



原标题:UITextView

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Tiktok玩家第128篇:Tik Tok跨境电商常见骗局,代运营被骗,卖家如何防范?:https://www.kjdsnews.com/a/1736021.html
eBay因销售非法药丸制造机被罚5900万美元!:https://www.kjdsnews.com/a/1736022.html
eBay美国站重要提醒:UPS费率出现上调!:https://www.kjdsnews.com/a/1736023.html
如何在TikTok上建立你的品牌形象:https://www.kjdsnews.com/a/1736024.html
全球演出市场井喷,跨境人如何接住这“泼天的富贵”?:https://www.kjdsnews.com/a/1736025.html
流量方法论!移动办公品牌MOFT如何成功踏浪出海?:https://www.kjdsnews.com/a/1736026.html
加拿大本地账户开立是否需要加拿大身份? :https://www.kjdsnews.com/a/1842166.html
加拿大本地账户开立是否需要加拿大身份? :https://www.xlkjsw.com/news/92266.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流