Right to Left Alignment for UITableView
Asked Answered
L

2

2

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?

Larry answered 5/11, 2009 at 2:40 Comment(0)
M
2

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];
}
Maletta answered 5/11, 2009 at 22:31 Comment(2)
Thanks,yes i went with the Custom UITableViewCell subclass :)Larry
@Larry : Could you share your code of the UITableView. I am also facing the same issue.Innate
D
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)

Decant answered 5/11, 2009 at 6:36 Comment(1)
i went with the UITableViewCell.. that worked well for my needs.. thanksLarry
M
2

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];
}
Maletta answered 5/11, 2009 at 22:31 Comment(2)
Thanks,yes i went with the Custom UITableViewCell subclass :)Larry
@Larry : Could you share your code of the UITableView. I am also facing the same issue.Innate

© 2022 - 2024 — McMap. All rights reserved.