ScrollView-Ipad中的缩放动画问题

| 在我的应用程序中,我有一个拆分屏幕,其中详细视图是滚动视图。我有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左右,则放大视图的一部分将被侧面的表格视图隐藏(如(如果放大视图的一部分位于侧面的表格视图下)。 无论如何,有没有要纠正这个问题,以使放大的视图不会被侧面的桌面视图隐藏? 我希望我已经正确解释了我的问题... 更新: 这是我用来为滚动视图添加子视图的代码
// 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的代码...     
已邀请:
这是一种猜测,因为我需要知道如何将表视图添加到滚动视图,但是中间表视图可能是在侧面视图之前添加的。视图按照添加的顺序“堆叠”,最后一个在顶部。您需要使用此方法获取滚动视图,才能将中间视图移到前面
- (void)bringSubviewToFront:(UIView *)view
最好的方法是为表视图创建协议,并使滚动视图成为委托。该方法将是这样的
- (void) moveAViewToFront: (MyTableView *) aTableView
{
    [self.view bringSubviewToFront: aTableView.view];
}
然后,您可以在设置动画之前调用委托方法。 已编辑 经过一番思考后,我意识到子视图引用了其父视图,因此这段代码应提供有关如何解决问题的想法。我创建了一个测试应用程序,它具有一个视图控制器,该控制器添加了两个子视图。视图控制器头文件是MoveSubviewViewController.h
#import <UIKit/UIKit.h>

@interface MoveSubviewViewController : UIViewController
{
}

@end
它的实现是
#import \"MoveSubviewViewController.h\"
#import \"MoveableSubview.h\"

@implementation MoveSubviewViewController

    - (void)viewDidLoad
    {
        [super viewDidLoad];

        // Create two overlapping subviews. The blue subview will start at the top of
        //  the frame and extend down two thirds of the frame.
        CGRect superviewFrame = self.view.frame;
        CGRect view1Frame = CGRectMake( superviewFrame.origin.x, superviewFrame.origin.y,
                                       superviewFrame.size.width, superviewFrame.size.height * 2 / 3);
        MoveableSubview *view1 = [[MoveableSubview alloc] initWithFrame: view1Frame];
        view1.backgroundColor = [UIColor blueColor];
        [self.view addSubview: view1];
        [view1 release];

        // The green subview will start one third of the way down the frame and
        //  extend all the to the bottom.
        CGRect view2Frame = CGRectMake( superviewFrame.origin.x,
                                       superviewFrame.origin.y + superviewFrame.size.height / 3,
                                       superviewFrame.size.width, superviewFrame.size.height * 2 / 3);
        MoveableSubview *view2 = [[MoveableSubview alloc] initWithFrame: view2Frame];
        view2.backgroundColor = [UIColor greenColor];
        [self.view addSubview: view2];
        [view2 release];
    }

    @end
子视图类是带有另一个简单标题的MoveableSubview
#import <UIKit/UIKit.h>

@interface MoveableSubview : UIView
{
}
@end
和实施
#import \"MoveableSubview.h\"

@implementation MoveableSubview

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    // Move this view to the front in the superview.
    [self.superview bringSubviewToFront: self];
}

@end
要做的是添加
[self.superview bringSubviewToFront: self];
设置动画前的一行。     

要回复问题请先登录注册