2

特定の製品の詳細が記載されたナビゲーションコントローラーがあります。詳細の1つは、製品の小さな画像です。次に、製品の拡大画像を含むViewControllerに移動する必要があるボタンを追加します。

拡大した画像が詳細画面と同じナビゲーションコントローラー上にあり、トランジションとして画面を反転させても、ヘッダーとタブバーが反転しないようにするにはどうすればよいですか。

ナビゲーションコントローラーの2つのビューの概要画像を追加しました。

ここに画像の説明を入力してください

4

2 に答える 2

2

次のようなものを使用できます。

    UIView.Transition(this.NavigationController.View, 1f, 
UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.TransitionFlipFromRight, 
delegate { this.NavigationController.PushViewController(this.ImageViewController, false); });

デフォルトのトランジションの代わりに、ナビゲーション コントローラーにプッシュされたときに画像ビューを反転させます。ImageViewController の title プロパティは、詳細からのものと同じである必要があります。

の考え方は、UINavigationController複数のコントローラーを処理することなので、ビューをオーバーレイしてそれに逆らってはいけません。

于 2012-12-03T18:58:05.473 に答える
1

コントローラーに 2 つのビューを追加し、それらのフレーム プロパティをアニメーション化して、必要な効果を得ます。
以下の例を参照してください。

using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;

namespace delete20121203
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the 
    // User Interface of the application, as well as listening (and optionally responding) to 
    // application events from iOS.
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;

        //
        // This method is invoked when the application has loaded and is ready to run. In this 
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            var ctrl = new MyViewController ();
            var nav = new UINavigationController (ctrl);

            window.RootViewController = nav;


            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
    }

    public class MyViewController : UIViewController
    {
        UIButton _button1;
        UIButton _button2;
        UIView _view1;
        UIView _view2;

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            Title = "Test";

            _view1 = new UIView (View.Bounds);
            _view1.AutoresizingMask = UIViewAutoresizing.All;
            _view1.BackgroundColor = UIColor.White;

            _button1 = UIButton.FromType (UIButtonType.RoundedRect);
            _button1.Frame = new System.Drawing.RectangleF (10, 10, 150, 44);
            _button1.SetTitle ("Click", UIControlState.Normal);
            _button1.TouchUpInside += Button1Click;

            _view2 = new UIView (View.Bounds);
            _view2.AutoresizingMask = UIViewAutoresizing.All;
            _view2.BackgroundColor = UIColor.LightGray;
            RectangleF hideRect = _view2.Frame;
            hideRect.X = hideRect.X + hideRect.Width;
            _view2.Frame = hideRect;

            _button2 = UIButton.FromType (UIButtonType.RoundedRect);
            _button2.Frame = new System.Drawing.RectangleF (10, 10, 150, 44);
            _button2.SetTitle ("Back", UIControlState.Normal);
            _button2.TouchUpInside += Button2Click;

            _view1.Add (_button1);
            _view2.Add (_button2);

            View.Add (_view1);
            View.Add (_view2);
        }

        void Button1Click (object sender, EventArgs e)
        {
            UIView.Animate (.5f, 0, UIViewAnimationOptions.CurveEaseInOut, delegate {
                _view2.Frame = View.Frame;

                RectangleF hideRect = _view1.Frame;
                hideRect.X = hideRect.X - hideRect.Width;
                _view1.Frame = hideRect;
            }, 
            null);
        }

        void Button2Click (object sender, EventArgs e)
        {
            UIView.Animate (.5f, 0, UIViewAnimationOptions.CurveEaseInOut, delegate {
                RectangleF hideRect = _view2.Frame;
                hideRect.X = hideRect.X + hideRect.Width;
                _view2.Frame = hideRect;

                _view1.Frame = View.Frame;
            }, 
            null);
        }
    }
}
于 2012-12-03T18:58:30.353 に答える