2013-05-15 48 views
0

我一直在研究一個包含ECSlidingViewController項目的應用程序,使我可以從左側滑入導航。導航鏈接是在一個NSArray並使用下面的代碼段動態地顯示成UITable:調整UITable /單元格寬度

- (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; 
} 

的問題是,該文本是太長的長度來顯示,一旦我們查看出控制器的幻燈片。現在看起來是這樣的:

enter image description here

我很想能夠減少單元格的寬度,如果這是可能的,甚至是文本拆分成兩行,使它看起來更像是這樣的:

enter image description here

任何有用的建議將不勝感激!

回答

1

我最近有完全相同的情況(儘管我使用的是ViewDeck而不是EDSlidingViewController)。

我的解決辦法。如果你正在使用ECSlidingViewController版本2(iOS版7+),你可以做到這一點通過在設置edgesForExtendedLayout通過代替其他的UIView中嵌入它改變了整個的UITableView的寬度......

+0

此作品在一定程度上...我可以調整新UITableView,儘管我的表不再由我的NSArray填充。有任何想法嗎? –

+0

你需要確保UITableView的數據源和委託仍然適當設置我猜? –