Example #1
0
        /// <summary>
        /// Loads the view.
        /// </summary>
        public override void LoadView()
        {
            //
            var view = new UIView(UIScreen.MainScreen.Bounds);

            view.BackgroundColor = UIColor.DarkGray;
            mMusicFlowView       = new SCSiriWaveformView(view.Bounds);
            mMusicFlowView.TranslatesAutoresizingMaskIntoConstraints = false;
            view.Add(mMusicFlowView);
            this.View = view;

            NSLayoutConstraint constraintRatio   = NSLayoutConstraint.Create(mMusicFlowView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, mMusicFlowView, NSLayoutAttribute.Height, 1.0f, 0.0f);
            NSLayoutConstraint constraintCenterX = NSLayoutConstraint.Create(mMusicFlowView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterX, 1.0f, 0.0f);
            NSLayoutConstraint constraintCenterY = NSLayoutConstraint.Create(mMusicFlowView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterY, 1.0f, 0.0f);
            NSLayoutConstraint constraintWidth   = NSLayoutConstraint.Create(mMusicFlowView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, view, NSLayoutAttribute.Width, 1.0f, 0.0f);

            mMusicFlowView.AddConstraint(constraintRatio);
            view.AddConstraints(new NSLayoutConstraint[] { constraintWidth, constraintCenterX, constraintCenterY });
        }
        /// <summary>
        /// Loads the view.
        /// </summary>
        public override void LoadView()
        {
            //
            var view = new UIView(UIScreen.MainScreen.Bounds);
            view.BackgroundColor = UIColor.DarkGray;
            mMusicFlowView = new SCSiriWaveformView(view.Bounds);
            mMusicFlowView.TranslatesAutoresizingMaskIntoConstraints = false;
            view.Add (mMusicFlowView);
            this.View = view;

            NSLayoutConstraint constraintRatio = NSLayoutConstraint.Create (mMusicFlowView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, mMusicFlowView, NSLayoutAttribute.Height, 1.0f, 0.0f);
            NSLayoutConstraint constraintCenterX = NSLayoutConstraint.Create (mMusicFlowView,NSLayoutAttribute.CenterX ,NSLayoutRelation.Equal,view,NSLayoutAttribute.CenterX,1.0f,0.0f);
            NSLayoutConstraint constraintCenterY = NSLayoutConstraint.Create (mMusicFlowView,NSLayoutAttribute.CenterY,NSLayoutRelation.Equal,view,NSLayoutAttribute.CenterY,1.0f, 0.0f);
            NSLayoutConstraint constraintWidth = NSLayoutConstraint.Create (mMusicFlowView,NSLayoutAttribute.Width,NSLayoutRelation.Equal,view,NSLayoutAttribute.Width,1.0f,0.0f);

            mMusicFlowView.AddConstraint (constraintRatio);
            view.AddConstraints (new NSLayoutConstraint[]{constraintWidth, constraintCenterX, constraintCenterY});
        }