5

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
(source: jeffcoat.net)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Timothy Jeffcoat
  • 775
  • 2
  • 9
  • 26
  • Hi can you take a look at [this thread](http://stackoverflow.com/questions/24517100/swrevealviewcontroller-rightviewcontroller) – LoveMeSomeFood Jul 02 '14 at 15:32

4 Answers4

12

assign 0 to _rightViewRevealOverdraw property of SWRevealViewController using below line

self.revealViewController.rightViewRevealOverdraw = 0.0f;

Or

in SWRevealViewController.m file search for line

_rightViewRevealOverdraw = 60.0f;

and change it like

_rightViewRevealOverdraw = 0.0f;

This will fix your problem.

More improved solution is to write below single line in controller instead of library.

  self.revealViewController.rightViewRevealOverdraw = 0.0f;
Uma Madhavi
  • 4,851
  • 5
  • 38
  • 73
Amit Saxena
  • 596
  • 7
  • 18
  • This seemed to work at the moment. Although I am a little worried about what those values currently do and how they affect the view. – Kalel Wade May 05 '14 at 15:40
8

In SWRevealViewController.m file search for line _rightViewRevealOverdraw = 60.0f; and change it like _rightViewRevealOverdraw = 0.0f;

Amit Saxenas answer above helped me, but instead of modifying the SWRevealViewController.m, the header file for the class declares a public property that can be set to change the rightViewRevealOverdraw.

self.revealViewController.rightViewRevealOverdraw = 0.0f;
[self.revealButtonItem setTarget:self.revealViewController];
[self.revealButtonItem setAction:@selector( rightRevealToggle: )];
[self.navigationController.navigationBar addGestureRecognizer:self.revealViewController.panGestureRecognizer];
0

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;
}
Community
  • 1
  • 1
Timothy Jeffcoat
  • 775
  • 2
  • 9
  • 26
  • Hi.. I have seen your active participation in SWRevealViewController.i got issue While using SWRevealViewController.can you go through once this url.http://stackoverflow.com/questions/25987486/app-login-issue-using-swrevealviewcontroller . Please guide me how to solve this issue? – ggg_1120 Sep 29 '14 at 13:26
0

Since the default _rightViewRevealOverdraw is 60.0f, you could use AutoLayout to make the tableView snap to all edges of your ViewController except for a Leading Space Margin of 60.

This would effectively give the tableView a frame of (60.0, 0, view.frame.size.width - 60.0, view.frame.size.height), allowing it to span across only the visible area.

Alex Koshy
  • 1,613
  • 15
  • 17