예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromHSBA(220f / 360.0f, 0.08f, 0.93f, 1.0f);

            container = new UIView(View.Bounds)
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };

            // Creating ComposeBarView and initializing its properties
            composeBarView = new ComposeBarView(new RectangleF(0, View.Bounds.Height - ComposeBarView.InitialHeight, View.Bounds.Width, ComposeBarView.InitialHeight))
            {
                MaxCharCount       = 160,
                MaxLinesCount      = 5,
                Placeholder        = "Type something...",
                UtilityButtonImage = UIImage.FromBundle("Camera")
            };

            // This will handle when the user taps the main button
            composeBarView.DidPressButton += (sender, e) => {
                var composeBar = sender as ComposeBarView;
                Console.WriteLine("Main button pressed. Text:\n{0}", composeBar.Text);
                AppendTextToTextView(string.Format("Main button pressed. Text:\n{0}", composeBar.Text));
                composeBar.Text = string.Empty;
                composeBar.ResignFirstResponder();
            };

            // This will handle when the user taps the Utility button in this case a CameraButton
            composeBarView.DidPressUtilityButton += (sender, e) => {
                Console.WriteLine("Utility button pressed");
                AppendTextToTextView("Utility button pressed");
            };

            // Here we setup the view that will hold everything we write
            textView = new UITextView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height - composeBarView.Bounds.Height))
            {
                AutoresizingMask     = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                Editable             = false,
                BackgroundColor      = UIColor.Clear,
                AlwaysBounceVertical = true,
                Font = UIFont.SystemFontOfSize(UIFont.LabelFontSize),
                Text = "Welcome to the Demo!\n\nThis is just some placeholder text to give you a better feeling of how the compose bar can be used along other Views."
            };

            container.AddSubview(textView);
            container.AddSubview(composeBarView);
            View.AddSubview(container);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            View.BackgroundColor = UIColor.FromHSBA (220f/360.0f, 0.08f, 0.93f, 1.0f);

            container = new UIView (View.Bounds) {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };

            // Creating ComposeBarView and initializing its properties
            composeBarView = new ComposeBarView (new RectangleF (0, View.Bounds.Height - ComposeBarView.InitialHeight, View.Bounds.Width, ComposeBarView.InitialHeight)) {
                MaxCharCount = 160,
                MaxLinesCount = 5,
                Placeholder = "Type something...",
                UtilityButtonImage = UIImage.FromBundle ("Camera")
            };

            // This will handle when the user taps the main button
            composeBarView.DidPressButton += (sender, e) => {
                var composeBar = sender as ComposeBarView;
                Console.WriteLine ("Main button pressed. Text:\n{0}", composeBar.Text);
                AppendTextToTextView (string.Format ("Main button pressed. Text:\n{0}", composeBar.Text));
                composeBar.Text = string.Empty;
                composeBar.ResignFirstResponder ();
            };

            // This will handle when the user taps the Utility button in this case a CameraButton
            composeBarView.DidPressUtilityButton += (sender, e) => {
                Console.WriteLine ("Utility button pressed");
                AppendTextToTextView ("Utility button pressed");
            };

            // Here we setup the view that will hold everything we write
            textView = new UITextView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height - composeBarView.Bounds.Height)) {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                Editable = false,
                BackgroundColor = UIColor.Clear,
                AlwaysBounceVertical = true,
                Font = UIFont.SystemFontOfSize (UIFont.LabelFontSize),
                Text = "Welcome to the Demo!\n\nThis is just some placeholder text to give you a better feeling of how the compose bar can be used along other Views."
            };

            container.AddSubview (textView);
            container.AddSubview (composeBarView);
            View.AddSubview (container);
        }