Reputation: 61
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:
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:
Any helpful advice would be much appreciated!
Upvotes: 0
Views: 109
Reputation: 1477
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
Upvotes: 0
Reputation: 10195
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 ...
Upvotes: 1