如何对齐标签的文本?
我想将标签的文本右对齐。但问题是我的标签位于 UITableViewCell 中,并且我正在使用 UITableViewCell 的“Value1”。所以我想将detailText标签与单元格的右侧对齐,但有时标签位于两行或三行中,因此在这种情况下,我希望标签的下一行左对齐,以便看起来下一行是从左边。
请帮忙!!!!
I want to align the text of my label to right aligned. But the problem is my label is in UITableVIewCell and i am using 'Value1' of UITableViewCell. So i want to align detailText label to the right side of the cell but sometimes the labels is in two or three lines so in that case i want the next line of the label to be left aligned so that it looks the next line is starting from left.
Please help!!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用自定义表格视图单元格。将 UITableViewCell 类添加到您的项目中并将其命名为 CustomCell,在 Iterface Builder 中创建一个 TableViewCell。添加两个标签,一个右对齐称为“label1”,另一个左对齐称为“label2”,或者做你想做的事情,然后你可以在你的主类中使用它,如下所示:
}
You can use custom tableview cells. Add a UITableViewCell class to your project and call it CustomCell, create a TableViewCell in Iterface Builder. Add two Labels, One right aligned called "label1", the other one left aligned called "label2", or do what ever you want, Then you can use it in your main class like this:
}
您需要查看不同的单元格类型或创建自己的自定义单元格类型,因为据我所知,每个表格单元格的布局方式都是一成不变的
You need to look at a different cell type or create your own custom one because as far as I know, the way each table cell is laid out is set in stone