2016-11-20 40 views
0

我有我的视图控制器和数据加载到表内的一个UITableView,但我无法通过它滚动的。我尝试了很多方法来修复它,但找不到解决方案。我也有使用SWRevealViewController的工具栏菜单,但我不认为这会降低滚动功能?不能滚动的UITableView - 目标C的Xcode 7.3

这里是我的视图控制器

- (void)viewDidLoad { 
[super viewDidLoad]; 

SWRevealViewController *revealViewController = self.revealViewController; 
if (revealViewController) 
{ 
    [self.barButton setTarget: self.revealViewController]; 
    [self.barButton setAction: @selector(revealToggle:)]; 
    [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer]; 
} 

_providerName = [NSMutableArray arrayWithObjects: 
       @"Food Bank of Alaska", 
       @"Community Food Bank of Central Alabama", 
       @"Food Bank of North Alabama", 
       @"Montgomery Area Food Bank", 
       @"Feeding the Gulf Coast", 
       @"Northwest Arkansas Food Bank", 
       @"River Valley Regional Food Bank", 
       @"Food Bank of Northeast Arkansas", 
       @"Arkansas Foodbank", 
       @"Harvest Texarkana Regional Food Bank", 
       @"United Food Bank", 
       @"St. Mary's Food Bank Alliance", 
       ... (there's more data here) 
       nil]; 
_providerId = [NSMutableArray arrayWithObjects:@"0", @"0", @"0", 
               @"0", @"0", @"0", 
               @"0", @"0", @"0", 
             ..... (there's more data here) 
               nil]; 


     self.navigationItem.title = @"Call History"; 
} 

- (void)viewDidAppear:(BOOL)animated { 
    [super viewDidAppear:animated]; 
    [self.tableView reloadData]; 
} 


-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Remove seperator inset 
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { 
     [cell setSeparatorInset:UIEdgeInsetsZero]; 
    } 

    // Prevent the cell from inheriting the Table View's margin settings 
    if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])  { 
     [cell setPreservesSuperviewLayoutMargins:NO]; 
    } 
    // Explictly set your cell's layout margins 
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 
     [cell setLayoutMargins:UIEdgeInsetsZero]; 
    } 
} 


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 
    return 1; 
} 

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 

    return [self.providerName count]; 
} 

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { 
    static NSString *CellIdentifier = @"moneyItemRow"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 
    cell.textLabel.text = [self.providerName objectAtIndex:indexPath.row]; 
    cell.detailTextLabel.text =[self.providerId objectAtIndex:indexPath.row]; 

    return cell; 

} 

这里面的代码是我的视图控制器的图片显示的是附近的任何边缘的表格视图心不是那么没有什么是重叠它

Description

+0

用户交互,我会给你表视图滚动的完整的答案? – KAR

+0

我补充说,我的代码,但它仍然没有工作 –

+0

你有你的视图层次任何其他滚动型?请分享视图层次结构。 – Adeel

回答

0

//删除该代码

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
// Remove seperator inset 
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { 
    [cell setSeparatorInset:UIEdgeInsetsZero]; 
} 

// Prevent the cell from inheriting the Table View's margin settings 
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])  { 
    [cell setPreservesSuperviewLayoutMargins:NO]; 
} 
// Explictly set your cell's layout margins 
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { 
    [cell setLayoutMargins:UIEdgeInsetsZero]; 
} 
} 
+0

Ÿü都在问到删除该代码,清除 – Vinodh

0

为你的表视图启用