【发布时间】:2011-08-05 20:11:49
【问题描述】:
在我的应用程序中,我有一个分屏,其中详细视图是滚动视图。我有 5 个表,它们是我的滚动视图的子视图,其中 3 个表视图在顶部并排,2 个表视图在底部并排
我已经实现了一种方法,当我单击滚动视图中任何表格的任何行时,该视图消失并且另一个视图放大到它的位置。
我在中间表格子视图的didSelectRowAtIndexPath中写了如下代码,
CGFloat xpos = self.view.frame.origin.x;
CGFloat ypos = self.view.frame.origin.y;
self.view.frame = CGRectMake(xpos+100,ypos+150,5,5);
[UIView beginAnimations:@"Zoom" context:NULL];
[UIView setAnimationDuration:2];
self.view.frame = CGRectMake(xpos,ypos,220,310);
[UIView commitAnimations];
[self.view addSubview:popContents.view];
popContents 是我需要放大到该特定表视图先前占用的视图的视图,并且该视图正确发生。
但是我面临的问题是,由于侧面有另一个表格子视图,如果我将帧大小增加到 250 左右,则放大视图的部分会被侧面的表格视图隐藏(就好像放大视图的一部分位于侧面的表格视图下方)。
有没有办法纠正这个问题,这样我放大的视图就不会被它两侧的 tableviews 隐藏?
希望我已经正确解释了我的问题...
更新:
这是我用来为滚动视图添加子视图的代码
// Scroll view
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 30, 1000, 740)];
scrollView.contentSize = CGSizeMake(1000, 700);
scrollView.delegate = self;
scrollView.scrollEnabled = YES;
scrollView.showsHorizontalScrollIndicator = YES;
scrollView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
[self.view addSubview:scrollView];
aView = [[aViewController alloc] initWithNibName:@"aViewController" bundle:nil];
aView.view.frame = CGRectMake(10, 25, 220, 310);
[aView loadList:objPatients];
[scrollView addSubview:aView.view];
bView = [[bViewController alloc] initWithNibName:@"bViewController" bundle:nil];
bView.view.frame = CGRectMake(10, 350, 220, 310);
[bView loadList:objPatients];
[scrollView addSubview:bView.view];
cView = [[cViewController alloc] initWithNibName:@"cViewController" bundle:nil];
cView.view.frame = CGRectMake(240, 25, 220, 310);
[cView loadList:objPatients];
[scrollView addSubview:cView.view];
dView = [[dViewController alloc] initWithNibName:@"dViewController" bundle:nil];
enView.view.frame = CGRectMake(240, 350, 220, 310);
[enView loadList:objPatients];
[scrollView addSubview:dView.view];
eView = [[eViewController alloc] initWithNibName:@"eViewController" bundle:nil];
eView.view.frame = CGRectMake(470, 25, 220, 310);
[eView loadList:objPatients];
[scrollView addSubview:eView.view];
比如说,我在 cViewController 子视图中添加了 didSelectRowAtIndexPath 的代码...
【问题讨论】:
标签: ipad uiscrollview core-animation zooming uisplitviewcontroller