如何创建从右到左的UITableView? [英] How to create a right to left UITableView?

查看:38
本文介绍了如何创建从右到左的UITableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个从右到左的UITableView. 现在,我具有从左到右的表格视图.

I want to create a right to left UITableView. right now I have the left to right table view.

我想知道是否有一种简便的方法可以使用最新的iphone SDK从左至右表转换为从右至左表?

I would like to know if there is an easy way to transfrom the left to right table into right to left using the latest iphone SDK?

我在自定义表格视图单元中尝试了textAlignment,但没有成功.

I've tried the textAlignment on my custom table view cell but with no success.

谢谢

推荐答案

我认为您所需要的是一张桌子,单击后将以相反的方式滑动.而不是让FirstTable向左滑动,而SecondTable从右侧向右滑动,您希望它以另一种方式滑动.这将是一个更加困难的任务.

I think what you are after is a table that when click will slide the opposite way. Instead of FirstTable sliding out to the left and SecondTable sliding IN from the right you want it to slide the other way. This will be a more difficult task.

另一方面,将文本放在表格的另一侧:

On the other hand about having the text on the other side of the table:

确保使用默认样式定义单元格

Make sure that your cells are being defined with default style

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

所有您需要做的就是将textLabel中的文本向右对齐:

Then all you have to to is align the text in the textLabel to the right:

cell.textLabel.textAlignment = UITextAlignmentRight;

对于iOS7,请使用cell.textLabel.textAlignment = NSTextAlignmentRight;

For iOS7, use cell.textLabel.textAlignment = NSTextAlignmentRight;

希望这有帮助,

塞伯·卡德

这篇关于如何创建从右到左的UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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