添加新行时,UITableView会停止滚动

时间:2015-07-28 15:17:54

标签: ios objective-c uitableview scroll uiscrollview

我有一个带有UIImages作为主要内容的单元格的UITableView。表视图是分页的,所以当我接近UITableView的末尾时,我向API发出一个新的请求并插入新的单元格(无限滚动)。

问题是当来自API的数据到达时,我将它们添加到表视图中时,滚动会完全停止。

我已经尝试了

[tableview reloadData]

[tableview beginUpdates]
[tableview insertRows...]
[tableview endUpdates]

但滚动动画在两种情况下都会完全停止。

2 个答案:

答案 0 :(得分:31)

I just found the problem: After the new data arrived I had a UIRefreshControl calling [self.refreshControl endRefreshing]. And for some reason that method stopped all scrolling animation in the table view.

By adding

if ([self.refreshControl isRefreshing]) {
    [self.refreshControl endRefreshing];
}

the problem was solved.

答案 1 :(得分:0)

迅速5:

<div class="form-group col-md-3">
            <p-calendar
              placeholder="Requeu Date"
              id="date"
              formControlName="date"
              dataType="string"
              dateFormat="MM dd, yy"
              [hideOnDateTimeSelect]="true"
              [defaultDate]="getDefaultDate()"
              [locale]="ptBR"
              [showButtonBar]="true"
              [showTime]="true"
              [disabledDays]="[0,6]"
              [showIcon]="true">              
            </p-calendar>
</div>
相关问题