0

I've been working on an app which has included the ECSlidingViewController project to give me a navigation that I can slide in from the left. The navigation links are in an NSArray and displayed dynamically into a UITable using the following piece of code:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellIdentifier = @"MenuItemCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
            cell.contentView.backgroundColor=[UIColor blueColor];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

    cell.textLabel.text = [self.menuItems objectAtIndex:indexPath.row];

    return cell;
}

The problem is that the text is way too long in length to display once we view the slide out controller. It now looks like this:

enter image description here

I would love to be able to reduce the cell width if that is possible or even split the text onto two lines and make it look a lot more like this:

enter image description here

Any helpful advice would be much appreciated!

Jamie Gordon
  • 61
  • 1
  • 8

2 Answers2

1

I had exactly the same situation recently (although I am using ViewDeck rather than EDSlidingViewController).

My solution was to change the width of the entire UITableView instead by embedding it within another UIView ...

Mike Pollard
  • 10,195
  • 2
  • 37
  • 46
  • This works to a degree...I can resize the new UITableView, although my table is no longer populated by my NSArray. Any ideas? – Jamie Gordon May 16 '13 at 10:32
  • You need to make sure that the datasource and delegate of the UITableView are still set appropriately I guess? – Mike Pollard May 16 '13 at 11:54
0

If you are using ECSlidingViewController version 2 (iOS 7+) you can do this by setting edgesForExtendedLayout on the controller that you want to not hide.

For example if you wanted to show from the left the whole controller:

- (void)viewDidLoad {
    self.edgesForExtendedLayout = UIRectEdgeTop | UIRectEdgeBottom | UIRectEdgeLeft;
}

There is more examples one GitHub: https://github.com/ECSlidingViewController/ECSlidingViewController/tree/master/Examples/LayoutDemo

Adam
  • 1,467
  • 1
  • 15
  • 15