【问题标题】:iphone: change content of a view with Animationiphone:使用动画更改视图的内容
【发布时间】:2011-07-11 22:05:56
【问题描述】:

我在这件事上需要帮助。我有 3 个视图控制器说 Parent 和 Child1、Child2

在父视图控制器中,我有一个名为容器的视图和一个分段控件。

现在我希望每次分段控件的值发生变化时,这个“容器”视图的内容都会随着动画的变化而变化。

我已经完成了,请告诉我需要添加什么:

if (selectSearchType.selectedSegmentIndex==0) {



    [aAdvanceSearchViewContoller.view removeFromSuperview];
    [container addSubview:aBasicSearchViewController.view];

}else {
    NSLog(@"Advance Search");
    [aBasicSearchViewController.view removeFromSuperview];
    [container addSubview:aAdvanceSearchViewContoller.view];
}

【问题讨论】:

    标签: iphone objective-c ipad uiview


    【解决方案1】:

    将以下行添加到您的代码中:

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.75];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myview cache:YES];
    [myview removeFromSuperview]; //remove or addSubview as required
    [UIView commitAnimations];
    

    【讨论】:

    猜你喜欢
    • 2010-11-30
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-03
    • 2013-02-01
    • 2016-02-22
    相关资源
    最近更新 更多