【问题标题】:how to avoid the refreshing of view1 while switching from view1 to view2 via Segue通过Segue从view1切换到view2时如何避免刷新view1
【发布时间】:2012-05-16 17:38:40
【问题描述】:

我有 2 个视图,并通过模态 segue(全屏、交叉溶解)从 view1 切换到 view2。

当我使用我定义的按钮转到 view2 并返回 view1 时,view1 中的所有图像都将重置为其默认值。

如何防止这种情况发生?

【问题讨论】:

    标签: iphone uiview segue ios5.1 uistoryboardsegue


    【解决方案1】:

    如果您在 XIB 中获取 2 个视图,然后使用按钮单击事件处理此视图,则非常容易.... 意味着首先从xib​​获取2个视图,然后单击按钮隐藏视图1并显示视图2等等... 喜欢...

    如果你想使用动画,它的工作如下......

    -(IBAction)btnView1_Clicked:(id)sender{
    [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:appDelegate.window cache:YES];
            [UIView commitAnimations];
           view1.hidden=FALSE;
           view2.hidden=TRUE;
    }
    
    -(IBAction)btnView2_Clicked:(id)sender{
    [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1.0];
            [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:appDelegate.window cache:YES];
            [UIView commitAnimations];
          view1.hidden=TRUE; 
          view2.hidden=FALSE;
    
    }
    

    在这里你可以用这个逻辑来讨论你的观点...... 希望,这对你有帮助.... :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多