我用下面的代码进行自动滚动的UITableView自动滚动的UITableView问题
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [DataArray count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
return 60;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"CustomTableCell";
CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil)
{
cell = [[[CustomTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
}
if(isAutoScrollEnabled)
[DataTable scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
cell.Time.text = [[DataArray objectAtIndex:indexPath.row]objectForKey:@"CurrentTime"];
cell.SerialNo.text = [NSString stringWithFormat:@"%d",indexPath.row+1];
return cell;
}
但每次我在tableview中加载数据时fluctates我的tableview。有没有解决方法?
任何人都可以帮助我吗?
在此先感谢......
你可以发布一些关于平滑向下滚动的代码吗? – dragon 2010-07-26 11:19:03
对不起,我做了一个繁重的工作,所以我无法编写一些代码。 但是,我解释了这个... 使用NSTimer间隔一段时间。 在时间事件(选择器) U可以在UITableView上的UIScrollView 或 (scrollToRowAtIndexPath:atScrollPosition:animated :)上滚动您的视图(scrollRectToVisible:animated :)。 祝你好运。 – TopChul 2010-07-27 05:09:03