如何在textField中将文本位置设置为底部 [英] How to set text position to bottom in textField

查看:58
本文介绍了如何在textField中将文本位置设置为底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码通过代码创建了textField

I created a textField through code using the following code

UITextField *txtObj=[UITextField alloc]initWithFrame:CGRectMake(88,100,80,33)];

我正在按计划获取文本字段,但是我们在该文本字段中键入的文本似乎出现在文本的顶部而不是底部.谁能告诉我解决方案

I am getting the textfield as i planned, but the text we type in that text field seems to appear in the top area of text but not in bottom.I tried to align it but i got tired. Can anyone tell me what's the solution

推荐答案

应为:

txtObj.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;

此属性从UIControl类继承.默认值为:UIControlContentVerticalAlignmentTop,这就是为什么将文本放在顶部的原因.

This property is inherited from the UIControl class. The default is: UIControlContentVerticalAlignmentTop , that's why you get the text on top.

这篇关于如何在textField中将文本位置设置为底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆