Right to Left Alignment for UITableView

爷,独闯天下 提交于 2019-12-02 02:49:24

问题


I am working on an arabic app for iphone 3.0. i was wondering if there is a way that i can convert the UITableViewCell to be right-to-left. I want everything to be in the opposite direction. Any thoughts?


回答1:


Creating your own UITableViewCell subclass is not that hard to do and is probably the first thing you'll want to do to get a custom look. All you'll need is a custom XIB file and a bit of modified code in your cellForRowAtIndexPath function:

NSString *CellIdentifier = @"IndividualContractWithResult";
UITableViewCell *cell;

...

cell = [thisTableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil)
{
    // TODO: improve code by avoiding the view controller creation
    UIViewController *vc = [[UIViewController alloc] initWithNibName:@"IndividualContractWithResult" bundle:nil];
    cell = (IndividualContractWithResult_Cell *) vc.view;
    [vc release];
}



回答2:


Hmm.. It's really interesting) I have no solution, but few suggestions. First of all, you can try to use CGAffineTransformInvert to mirror your table. If it wil be useless, you can customize your tableView cells(make an UIImageView at the left side and UILabel with UITextAlignmentRight at the right). This is about your table. If you want to go to another view, you can just change your table view with UIViewAnimationTransitionFlipFromLeft animation instead of using UINavigationController. It's not a pretty solution, but it may do the trick) Good luck)



来源:https://stackoverflow.com/questions/1677988/right-to-left-alignment-for-uitableview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!