浮动uiview子视图在滚动时消失

时间:2011-12-30 01:23:09

标签: objective-c ios uitableview uiview

我有一个UIView被添加到我的UITableView。视图作为子视图。它看起来很棒并且工作正常,但当我滚动UITableView时,子视图会被切断并消失,但只是其中的一部分(主要是滚动的部分)。我可以通过致电来取回它:

[self.view bringSubviewToFront:self.myView];

但是我不想在UITableView滚动时调用它。有什么我做错了吗?提前谢谢。

disappearing uiview

2 个答案:

答案 0 :(得分:1)

试试这个..

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) { 
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
 }
}

答案 1 :(得分:0)

很难说明你的最终目标是什么,但是向UITableView添加子视图有点反直觉。 UITableView管理它的子视图(UITableViewCell)并且它们可能优先于您的子视图。您在寻找backgroundView吗?

相关问题