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!

2 Answers 2

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 ...

Sign up to request clarification or add additional context in comments.

2 Comments

This works to a degree...I can resize the new UITableView, although my table is no longer populated by my NSArray. Any ideas?
You need to make sure that the datasource and delegate of the UITableView are still set appropriately I guess?
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.