Timothy Jeffcoat Timothy Jeffcoat - 1 year ago 198
iOS Question

SWRevealViewController right side menu

I am experimenting inserting a UITableView into the RightViewController of the first example located at https://github.com/John-Lluch/SWRevealViewController/tree/master/RevealControllerExample .

The issue is that that the table is aligned far left and the text in each cell is cutoff.

What are possible fixes for this? I have looked through the SWRevealViewController api and could not find a solution. Also, i looked through the UITableView api and tried each of the possible alignment setting, also in the xib builder. None seems to change the cutoff of the text

I have attached the image below. Notice the left aligned table.

right side controller

Answer Source

With the help of Center Align text in UITableViewCell problem modified for right instead of center I was able to get the menu to align to the right and final code is below.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    NSInteger row = indexPath.row;

if (nil == cell)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault     reuseIdentifier:cellIdentifier];

    cell.textLabel.textAlignment = NSTextAlignmentRight;
}


return cell;
}