private void showUserMap()
        {
            map.MapType           = MKMapType.HybridFlyover;
            map.ShowsUserLocation = true;
            map.ZoomEnabled       = true;
            map.ScrollEnabled     = true;
            map.ShowsBuildings    = true;
            map.PitchEnabled      = true;
            map.ShowsCompass      = false;
            double lat = 30.2652233534254;
            double lon = -97.73815460962083;
            CLLocationCoordinate2D mapCenter = new CLLocationCoordinate2D(lat, lon);
            CLLocationCoordinate2D viewPoint = new CLLocationCoordinate2D(lat + 0.0050, lon - 0.0072);
            MKCoordinateRegion     mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 1500, 1500);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;
            var camera = MKMapCamera.CameraLookingAtCenterCoordinate(mapCenter, viewPoint, 500);

            map.Camera   = camera;
            mapDelegate  = new MapDelegate();
            map.Delegate = mapDelegate;
            askUserPermissions();

            var tapRecogniser     = new UITapGestureRecognizer(this, new Selector("MapTapSelector:"));
            var longTapRecogniser = new UILongPressGestureRecognizer(this, new Selector("MapLongTapSelector:"));

            map.AddGestureRecognizer(tapRecogniser);
            map.AddGestureRecognizer(longTapRecogniser);
            var hotelOverlay = MKCircle.Circle(mapCenter, 1000);

            map.AddOverlay(hotelOverlay);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SetupNavigationBar();

            Title = Constants.MapMarkers;

            _locationManager = new CLLocationManager();
            _locationManager.RequestWhenInUseAuthorization();

            _map.ShowsUserLocation = true;

            MarkerListFromRepository = ViewModel.MarkerList;

            if (MarkerListFromRepository.Any())
            {
                foreach (MapMarkerEntity coord in MarkerListFromRepository)
                {
                    _map.AddAnnotations(new MKPointAnnotation()
                    {
                        Title      = Constants.MapMarker,
                        Coordinate = new CLLocationCoordinate2D(coord.Latitude, coord.Longitude)
                    });
                }
            }

            var longPress = new UILongPressGestureRecognizer(LongPress);

            _map.AddGestureRecognizer(longPress);

            _map.ShowAnnotations(_map.Annotations, false);

            View = _map;
        }
Exemple #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);
            if (_nativeMap != null)
            {
                return;
            }
            _nativeMap               = Control as MKMapView;
            _nativeMap.ZoomEnabled   = true;
            _nativeMap.ScrollEnabled = true;

            var uiTapGesture = new UITapGestureRecognizer(tappedGesture => MapTapped(_nativeMap, tappedGesture));

            _nativeMap.AddGestureRecognizer(uiTapGesture);

            if (e.OldElement != null)
            {
                _nativeMap.RemoveOverlays(_nativeMap.Overlays);
                _nativeMap.OverlayRenderer = null;
            }

            if (e.NewElement != null)
            {
                _nativeMap.OverlayRenderer = OverlayRendererHandler;
                OnUpdateFeatures();
            }
        }
        private void SetUpCustomMap()
        {
            _mKMapView.ZoomEnabled   = true;
            _mKMapView.ScrollEnabled = true;
            CLLocationManager locationManager = new CLLocationManager();

            locationManager.RequestWhenInUseAuthorization();
            _mKMapView.ShowsUserLocation = true;


            _mKMapView.DidUpdateUserLocation += delegate
            {
                if (_mKMapView.UserLocation != null)
                {
                    CLLocationCoordinate2D coordinateUser     = _mKMapView.UserLocation.Coordinate;
                    MKCoordinateSpan       coordinateSpanUser = new MKCoordinateSpan(0.02, 0.02);
                    _mKMapView.Region = new MKCoordinateRegion(coordinateUser, coordinateSpanUser);
                }
            };
            if (!_mKMapView.UserLocationVisible)
            {
                CLLocationCoordinate2D coords = new CLLocationCoordinate2D(49.99181, 36.23572);
                MKCoordinateSpan       span   = new MKCoordinateSpan(0.05, 0.05);
                _mKMapView.Region = new MKCoordinateRegion(coords, span);
            }

            var longGesture = new UILongPressGestureRecognizer(LongPress);

            longGesture.MinimumPressDuration = 0.5;
            _mKMapView.AddGestureRecognizer(longGesture);

            _mKMapView.GetViewForAnnotation += GetViewForAnnotation;
        }
Exemple #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                locationManager.RequestWhenInUseAuthorization();
            }



            // change map type, show user location and allow zooming and panning
            map.MapType           = MKMapType.Standard;
            map.ShowsUserLocation = true;
            map.ZoomEnabled       = true;
            map.ScrollEnabled     = true;

            // set map center and region
            double lat = 30.2652233534254;
            double lon = -97.73815460962083;
            CLLocationCoordinate2D mapCenter = new CLLocationCoordinate2D(lat, lon);
            MKCoordinateRegion     mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 100, 100);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;

            // set the map delegate
            mapDelegate  = new MapDelegate();
            map.Delegate = mapDelegate;

            // add a custom annotation at the map center
            map.AddAnnotations(new ConferenceAnnotation("Evolve Conference", mapCenter));

            // add an overlay of the hotel
            MKPolygon hotelOverlay = MKPolygon.FromCoordinates(
                new CLLocationCoordinate2D[] {
                new CLLocationCoordinate2D(30.2649977168594, -97.73863627705),
                new CLLocationCoordinate2D(30.2648461170005, -97.7381627734755),
                new CLLocationCoordinate2D(30.2648355402574, -97.7381750192576),
                new CLLocationCoordinate2D(30.2647791309417, -97.7379872505988),
                new CLLocationCoordinate2D(30.2654525150319, -97.7377341711021),
                new CLLocationCoordinate2D(30.2654807195004, -97.7377994819399),
                new CLLocationCoordinate2D(30.2655089239607, -97.7377994819399),
                new CLLocationCoordinate2D(30.2656428950368, -97.738346460207),
                new CLLocationCoordinate2D(30.2650364981811, -97.7385709662122),
                new CLLocationCoordinate2D(30.2650470749025, -97.7386199493406)
            });

            map.AddOverlay(hotelOverlay);

            UITapGestureRecognizer tap = new UITapGestureRecognizer(g => {
                var pt = g.LocationInView(map);
                CLLocationCoordinate2D tapCoord = map.ConvertPoint(pt, map);

                Console.WriteLine("new CLLocationCoordinate2D({0}, {1}),", tapCoord.Latitude, tapCoord.Longitude);
            });

            map.AddGestureRecognizer(tap);
        }
Exemple #6
0
        public AnnotationManager(MKMapView mapView)
        {
            MapView = mapView;

            var gr = new UITapGestureRecognizer(OnMapTap);

            gr.Delegate = new MapGestureRecognizerDelegate();
            MapView.AddGestureRecognizer(gr);
        }
Exemple #7
0
        public void BindToNative(object native, BindOptions options = BindOptions.None)
        {
            UnbindFromNative();
            map = ViewHelpers.GetView <MKMapView> (native);

            singleTap = new UITapGestureRecognizer(HandleTap)
            {
                NumberOfTapsRequired = 1,
            };
            map.AddGestureRecognizer(singleTap);
            doubleTap = new UITapGestureRecognizer {
                NumberOfTapsRequired = 2,
            };
            map.AddGestureRecognizer(doubleTap);
            singleTap.RequireGestureRecognizerToFail(doubleTap);

            map.SetRegion(MKCoordinateRegion.FromDistance(
                              GetCoord(setRegionCoord), setRegionDistance, setRegionDistance),
                          false);
        }
        protected override void OnAttached()
        {
            mapView = Control as MKMapView;
            if (mapView == null)
            {
                throw new NotSupportedException(Control.GetType() + " is not supported.");
            }

            behavior = (Element as Map)?.Behaviors?.OfType <ClickBehavior>()?.FirstOrDefault();
            if (behavior == null)
            {
                return;
            }

            tapGesture = new UITapGestureRecognizer(recognizer =>
                                                    MapClicked?.Invoke(this, new MapClickedEventArgs(
                                                                           ConvertLocationToPosition(recognizer, mapView)))
                                                    )
            {
                NumberOfTapsRequired = 1,
            };

            longPressGesture = new UILongPressGestureRecognizer(recognizer =>
            {
                if (recognizer.State != UIGestureRecognizerState.Began)
                {
                    return;
                }

                MapLongClicked?.Invoke(this, new MapClickedEventArgs(
                                           ConvertLocationToPosition(recognizer, mapView)));
            });

            tapGesture.RequireGestureRecognizerToFail(longPressGesture);
            mapView.AddGestureRecognizer(longPressGesture);
            mapView.AddGestureRecognizer(tapGesture);
        }
Exemple #9
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            await Task.Run(() => LoadPredators());

            Title = ViewModel.Title;
            map   = new MKMapView(UIScreen.MainScreen.Bounds);
            map.ShowsUserLocation = true;
            View = map;

            map.MapLoaded += Map_MapLoaded;
            var tapRecogniser = new UILongPressGestureRecognizer(this, new ObjCRuntime.Selector("MapTapSelector:"));

            map.AddGestureRecognizer(tapRecogniser);
        }
Exemple #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "Map";

            _buttonBack       = new UIButton(UIButtonType.Custom);
            _buttonBack.Frame = new CGRect(0, 0, 40, 40);
            _buttonBack.SetImage(UIImage.FromBundle("icons8-back-filled-30.png"), UIControlState.Normal);
            this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(_buttonBack), false);

            _buttonSavePin       = new UIButton(UIButtonType.Custom);
            _buttonSavePin.Frame = new CGRect(0, 0, 40, 40);
            _buttonSavePin.SetImage(UIImage.FromBundle("baseline_add_location_black_48dp.png"), UIControlState.Normal);
            this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(_buttonSavePin), false);
            _buttonSavePin.TouchUpInside += ButtonGoogleMarkerSaveClick;

            MapViewIOS               = new MKMapView();
            View                     = MapViewIOS;
            MapViewIOS.ZoomEnabled   = true;
            MapViewIOS.ScrollEnabled = true;
            CLLocationManager locationManager = new CLLocationManager();

            locationManager.RequestWhenInUseAuthorization();
            MapViewIOS.ShowsUserLocation = true;

            var longGesture = new UILongPressGestureRecognizer(LongPress);

            longGesture.MinimumPressDuration = 1.5;
            MapViewIOS.AddGestureRecognizer(longGesture);

            MapViewIOS.GetViewForAnnotation += GetViewForAnnotation;

            if (ViewModel.LalitudeGoogleMarker != 0)
            {
                _lalitude  = this.ViewModel.LalitudeGoogleMarker;
                _longitude = this.ViewModel.LongitudeGoogleMarker;
                MapViewIOS.AddAnnotations(new MKPointAnnotation()
                {
                    Coordinate = new CLLocationCoordinate2D(_lalitude, _longitude)
                });
            }

            var set = this.CreateBindingSet <MapsView, MapsViewModel>();

            set.Bind(_buttonBack).To(vm => vm.BackTaskCommand);
            set.Bind(_buttonSavePin).To(vm => vm.SaveGoogleMapPointCommand);
            set.Apply();
        }
Exemple #11
0
        private void SetUpMapView()
        {
            MapKitView               = new MKMapView();
            View                     = MapKitView;
            MapKitView.ZoomEnabled   = true;
            MapKitView.ScrollEnabled = true;
            CLLocationManager locationManager = new CLLocationManager();

            locationManager.RequestWhenInUseAuthorization();
            MapKitView.ShowsUserLocation = true;

            MapKitView.DidUpdateUserLocation += delegate
            {
                if (MapKitView.UserLocation != null)
                {
                    CLLocationCoordinate2D coordinateUser     = MapKitView.UserLocation.Coordinate;
                    MKCoordinateSpan       coordinateSpanUser = new MKCoordinateSpan(0.02, 0.02);
                    MapKitView.Region = new MKCoordinateRegion(coordinateUser, coordinateSpanUser);
                }
            };
            if (!MapKitView.UserLocationVisible)
            {
                CLLocationCoordinate2D coords = new CLLocationCoordinate2D(49.99181, 36.23572);
                MKCoordinateSpan       span   = new MKCoordinateSpan(0.05, 0.05);
                MapKitView.Region = new MKCoordinateRegion(coords, span);
            }

            var longGesture = new UILongPressGestureRecognizer(LongPress);

            longGesture.MinimumPressDuration = 0.5;
            MapKitView.AddGestureRecognizer(longGesture);

            MapKitView.GetViewForAnnotation += GetViewForAnnotation;

            if (ViewModel.LalitudeMarker != 0)
            {
                _lalitude  = this.ViewModel.LalitudeMarker;
                _longitude = this.ViewModel.LongitudeMarker;
                MapKitView.AddAnnotations(new MKPointAnnotation()
                {
                    Coordinate = new CLLocationCoordinate2D(_lalitude, _longitude)
                });
            }
        }
        void AddLocationBox()
        {
            MapViewBoxRect = new RectangleF (x, y, mywidth, cube);
            mapView = new MKMapView (MapViewBoxRect);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            mapView.ShowsUserLocation = true;
            View.AddSubview(mapView);

            if (Double.IsNaN (this.myLager.latitude)) {
                SetMapToUserLocation ();
            }

            doubletap = new UITapGestureRecognizer (AddLocation);
            doubletap.NumberOfTapsRequired = 2;
            this.dtdelegate = new SwipeDelegate ();
            doubletap.Delegate = dtdelegate;

            mapView.AddGestureRecognizer (doubletap);

            y += cube;
        }
Exemple #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            scrollView = new UIScrollView();
            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            View.Add(scrollView);
            scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active       = true;
            scrollView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active     = true;
            scrollView.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active   = true;
            scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;

            containerView = new UIView();
            scrollView.Add(containerView);
            containerView.TranslatesAutoresizingMaskIntoConstraints = false;
            containerView.TopAnchor.ConstraintEqualTo(containerView.Superview.TopAnchor).Active       = true;
            containerView.LeftAnchor.ConstraintEqualTo(containerView.Superview.LeftAnchor).Active     = true;
            containerView.RightAnchor.ConstraintEqualTo(containerView.Superview.RightAnchor).Active   = true;
            containerView.BottomAnchor.ConstraintEqualTo(containerView.Superview.BottomAnchor).Active = true;
            containerView.WidthAnchor.ConstraintEqualTo(scrollView.WidthAnchor).Active   = true;
            containerView.HeightAnchor.ConstraintEqualTo(View.Frame.Height + 100).Active = true;

            titleTextField = new UITextField();
            containerView.Add(titleTextField);
            titleTextField.TranslatesAutoresizingMaskIntoConstraints = false;
            titleTextField.Placeholder = "Задача";
            titleTextField.BecomeFirstResponder();
            titleTextField.BorderStyle = UITextBorderStyle.RoundedRect;
            titleTextField.LeftAnchor.ConstraintEqualTo(titleTextField.Superview.LeftAnchor, 10).Active    = true;
            titleTextField.TopAnchor.ConstraintEqualTo(titleTextField.Superview.TopAnchor, 10).Active      = true;
            titleTextField.RightAnchor.ConstraintEqualTo(titleTextField.Superview.RightAnchor, -10).Active = true;
            titleTextField.HeightAnchor.ConstraintEqualTo(30).Active = true;

            dateTextField = new UITextField();
            containerView.Add(dateTextField);
            dateTextField.TranslatesAutoresizingMaskIntoConstraints = false;
            dateTextField.BorderStyle   = UITextBorderStyle.RoundedRect;
            dateTextField.TextAlignment = UITextAlignment.Center;
            dateTextField.TopAnchor.ConstraintEqualTo(titleTextField.BottomAnchor, 10).Active            = true;
            dateTextField.LeftAnchor.ConstraintEqualTo(dateTextField.Superview.LeftAnchor, 10).Active    = true;
            dateTextField.HeightAnchor.ConstraintEqualTo(titleTextField.HeightAnchor).Active             = true;
            dateTextField.RightAnchor.ConstraintEqualTo(dateTextField.Superview.RightAnchor, -10).Active = true;

            date = DateTime.Now;
            dateTextField.Text = date.ToShortDateString();

            dateDatePicker               = new UIDatePicker();
            dateDatePicker.Mode          = UIDatePickerMode.DateAndTime;
            dateTextField.InputView      = dateDatePicker;
            dateDatePicker.ValueChanged += DateDatePicker_ValueChanged;

            commentDescriptionLabel      = new UILabel();
            commentDescriptionLabel.Text = "Комментарий";
            containerView.Add(commentDescriptionLabel);
            commentDescriptionLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            commentDescriptionLabel.TopAnchor.ConstraintEqualTo(dateTextField.BottomAnchor, 10).Active = true;
            commentDescriptionLabel.LeftAnchor.ConstraintEqualTo(commentDescriptionLabel.Superview.LeftAnchor, 10).Active    = true;
            commentDescriptionLabel.RightAnchor.ConstraintEqualTo(commentDescriptionLabel.Superview.RightAnchor, -10).Active = true;
            commentDescriptionLabel.HeightAnchor.ConstraintEqualTo(14).Active = true;
            commentDescriptionLabel.Font      = UIFont.SystemFontOfSize(12);
            commentDescriptionLabel.TextColor = UIColor.DarkTextColor.ColorWithAlpha(0.6f);

            commentTextView = new UITextView();
            containerView.Add(commentTextView);
            commentTextView.TranslatesAutoresizingMaskIntoConstraints = false;
            commentTextView.TopAnchor.ConstraintEqualTo(commentDescriptionLabel.BottomAnchor, 5).Active      = true;
            commentTextView.LeftAnchor.ConstraintEqualTo(commentTextView.Superview.LeftAnchor, 10).Active    = true;
            commentTextView.RightAnchor.ConstraintEqualTo(commentTextView.Superview.RightAnchor, -10).Active = true;
            commentTextView.HeightAnchor.ConstraintEqualTo(60).Active = true;
            commentTextView.Layer.CornerRadius = 5;
            commentTextView.Layer.BorderWidth  = 1;
            commentTextView.Layer.BorderColor  = UIColor.FromRGB(229, 228, 229).CGColor;

            //photo = new UIImageView();
            //photo.BackgroundColor = UIColor.Black;

            //containerView.Add(photo);
            //photo.TranslatesAutoresizingMaskIntoConstraints = false;
            //photo.TopAnchor.ConstraintEqualTo(commentTextView.BottomAnchor, 5).Active = true;
            //photo.RightAnchor.ConstraintEqualTo(photo.Superview.RightAnchor, 50).Active = true;
            //photo.LeftAnchor.ConstraintEqualTo(photo.Superview.LeftAnchor, 280).Active = true;
            //photo.WidthAnchor.ConstraintEqualTo(70).Active = true;
            //photo.HeightAnchor.ConstraintEqualTo(70).Active = true;
            //photo.Layer.BorderWidth = 1;
            //photo.Layer.BorderColor = UIColor.FromRGB(229, 228, 229).CGColor;
            //photo.tou

            img_UploadImage = new UIButton(UIButtonType.Custom);
            img_UploadImage.BackgroundColor = UIColor.Gray;
            img_UploadImage.SetTitle("фото", UIControlState.Normal);
            img_UploadImage.Font.WithSize(10);

            containerView.Add(img_UploadImage);
            img_UploadImage.TranslatesAutoresizingMaskIntoConstraints = false;
            img_UploadImage.TopAnchor.ConstraintEqualTo(commentTextView.BottomAnchor, 10).Active             = true;
            img_UploadImage.RightAnchor.ConstraintEqualTo(img_UploadImage.Superview.RightAnchor, -10).Active = true;
            img_UploadImage.WidthAnchor.ConstraintEqualTo(70).Active  = true;
            img_UploadImage.HeightAnchor.ConstraintEqualTo(70).Active = true;

            img_UploadImage.TouchUpInside += ImageButton_TouchUpInside;
            chooseLocation = new UIButton(UIButtonType.System);
            chooseLocation.SetTitle("Геопозиция", UIControlState.Normal);
            chooseLocation.Font.WithSize(10);
            //chooseLocation.Frame = new RectangleF(150, 200, 120, 70);


            chooseLocation.TouchUpInside += (sender, e) => {
                map = new MKMapView(UIScreen.MainScreen.Bounds);

                View.AddSubview(map);
                CLLocationManager locationManager = new CLLocationManager();
                locationManager.RequestWhenInUseAuthorization();
                map.ShowsUserLocation = true;
                var tapRecogniser = new UITapGestureRecognizer(this, new ObjCRuntime.Selector("MapTapSelector:"));
                map.AddGestureRecognizer(tapRecogniser);
            };


            containerView.Add(chooseLocation);
            chooseLocation.TranslatesAutoresizingMaskIntoConstraints = false;
            chooseLocation.TopAnchor.ConstraintEqualTo(img_UploadImage.BottomAnchor, 10).Active            = true;
            chooseLocation.RightAnchor.ConstraintEqualTo(chooseLocation.Superview.RightAnchor, -10).Active = true;


            saveButton = new UIButton();
            containerView.AddSubview(saveButton);
            saveButton.TranslatesAutoresizingMaskIntoConstraints = false;
            saveButton.TopAnchor.ConstraintEqualTo(commentTextView.BottomAnchor, 120).Active = true;
            saveButton.CenterXAnchor.ConstraintEqualTo(titleTextField.CenterXAnchor).Active  = true;
            saveButton.WidthAnchor.ConstraintEqualTo(200).Active = true;
            saveButton.HeightAnchor.ConstraintEqualTo(40).Active = true;
            saveButton.SetTitle("Save", UIControlState.Normal);
            saveButton.SetTitleColor(View.TintColor, UIControlState.Normal);
            //saveButton.TouchUpInside += SaveButton_TouchUpInside;
            saveButton.TouchUpInside += SaveButton_TouchUpInside;
        }
Exemple #14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            scrollView = new UIScrollView();
            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            View.Add(scrollView);
            scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active       = true;
            scrollView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active     = true;
            scrollView.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active   = true;
            scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;

            containerView = new UIView();
            scrollView.Add(containerView);
            containerView.TranslatesAutoresizingMaskIntoConstraints = false;
            containerView.TopAnchor.ConstraintEqualTo(containerView.Superview.TopAnchor).Active       = true;
            containerView.LeftAnchor.ConstraintEqualTo(containerView.Superview.LeftAnchor).Active     = true;
            containerView.RightAnchor.ConstraintEqualTo(containerView.Superview.RightAnchor).Active   = true;
            containerView.BottomAnchor.ConstraintEqualTo(containerView.Superview.BottomAnchor).Active = true;
            containerView.WidthAnchor.ConstraintEqualTo(scrollView.WidthAnchor).Active   = true;
            containerView.HeightAnchor.ConstraintEqualTo(View.Frame.Height + 100).Active = true;

            titleTextField = new UITextField();
            containerView.Add(titleTextField);
            titleTextField.TranslatesAutoresizingMaskIntoConstraints = false;
            titleTextField.Placeholder = "Задача";
            titleTextField.BecomeFirstResponder();
            titleTextField.BorderStyle = UITextBorderStyle.RoundedRect;
            titleTextField.LeftAnchor.ConstraintEqualTo(titleTextField.Superview.LeftAnchor, 10).Active    = true;
            titleTextField.TopAnchor.ConstraintEqualTo(titleTextField.Superview.TopAnchor, 10).Active      = true;
            titleTextField.RightAnchor.ConstraintEqualTo(titleTextField.Superview.RightAnchor, -10).Active = true;
            titleTextField.HeightAnchor.ConstraintEqualTo(30).Active = true;

            dateTextField = new UITextField();
            containerView.Add(dateTextField);
            dateTextField.TranslatesAutoresizingMaskIntoConstraints = false;
            dateTextField.BorderStyle   = UITextBorderStyle.RoundedRect;
            dateTextField.TextAlignment = UITextAlignment.Center;
            dateTextField.TopAnchor.ConstraintEqualTo(titleTextField.BottomAnchor, 10).Active            = true;
            dateTextField.LeftAnchor.ConstraintEqualTo(dateTextField.Superview.LeftAnchor, 10).Active    = true;
            dateTextField.HeightAnchor.ConstraintEqualTo(titleTextField.HeightAnchor).Active             = true;
            dateTextField.RightAnchor.ConstraintEqualTo(dateTextField.Superview.RightAnchor, -10).Active = true;

            date = DateTime.Now;
            dateTextField.Text = date.ToShortDateString();

            dateDatePicker               = new UIDatePicker();
            dateDatePicker.Mode          = UIDatePickerMode.DateAndTime;
            dateTextField.InputView      = dateDatePicker;
            dateDatePicker.ValueChanged += DateDatePicker_ValueChanged;

            commentDescriptionLabel      = new UILabel();
            commentDescriptionLabel.Text = "Комментарий";
            containerView.Add(commentDescriptionLabel);
            commentDescriptionLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            commentDescriptionLabel.TopAnchor.ConstraintEqualTo(dateTextField.BottomAnchor, 10).Active = true;
            commentDescriptionLabel.LeftAnchor.ConstraintEqualTo(commentDescriptionLabel.Superview.LeftAnchor, 10).Active    = true;
            commentDescriptionLabel.RightAnchor.ConstraintEqualTo(commentDescriptionLabel.Superview.RightAnchor, -10).Active = true;
            commentDescriptionLabel.HeightAnchor.ConstraintEqualTo(14).Active = true;
            commentDescriptionLabel.Font      = UIFont.SystemFontOfSize(12);
            commentDescriptionLabel.TextColor = UIColor.DarkTextColor.ColorWithAlpha(0.6f);

            commentTextView = new UITextView();
            containerView.Add(commentTextView);
            commentTextView.TranslatesAutoresizingMaskIntoConstraints = false;
            commentTextView.TopAnchor.ConstraintEqualTo(commentDescriptionLabel.BottomAnchor, 5).Active      = true;
            commentTextView.LeftAnchor.ConstraintEqualTo(commentTextView.Superview.LeftAnchor, 10).Active    = true;
            commentTextView.RightAnchor.ConstraintEqualTo(commentTextView.Superview.RightAnchor, -10).Active = true;
            commentTextView.HeightAnchor.ConstraintEqualTo(60).Active = true;
            commentTextView.Layer.CornerRadius = 5;
            commentTextView.Layer.BorderWidth  = 1;
            commentTextView.Layer.BorderColor  = UIColor.FromRGB(229, 228, 229).CGColor;

            //photo = new UIImageView();
            //photo.BackgroundColor = UIColor.Black;

            //containerView.Add(photo);
            //photo.TranslatesAutoresizingMaskIntoConstraints = false;
            //photo.TopAnchor.ConstraintEqualTo(commentTextView.BottomAnchor, 5).Active = true;
            //photo.RightAnchor.ConstraintEqualTo(photo.Superview.RightAnchor, 50).Active = true;
            //photo.LeftAnchor.ConstraintEqualTo(photo.Superview.LeftAnchor, 280).Active = true;
            //photo.WidthAnchor.ConstraintEqualTo(70).Active = true;
            //photo.HeightAnchor.ConstraintEqualTo(70).Active = true;
            //photo.Layer.BorderWidth = 1;
            //photo.Layer.BorderColor = UIColor.FromRGB(229, 228, 229).CGColor;
            //photo.tou

            img_UploadImage = new UIButton(UIButtonType.Custom);
            img_UploadImage.BackgroundColor = UIColor.Gray;
            img_UploadImage.SetTitle("фото", UIControlState.Normal);
            img_UploadImage.Font.WithSize(10);
            img_UploadImage.Frame = new RectangleF(300, 200, 70, 70);
            containerView.Add(img_UploadImage);
            img_UploadImage.TouchUpInside += async(sender, e) => {
                await CrossMedia.Current.Initialize();

                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    UIAlertView alert = new UIAlertView("Ошибка", "Камера недоступна!", null, "Ok");
                    alert.Show();
                    return;
                }

                var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                {
                    Directory = "Sample",
                    Name      = "test.jpg"
                });

                if (file == null)
                {
                    return;
                }

                img_UploadImage.SetImage(UIImage.FromFile(file.Path), UIControlState.Normal);
                file.Dispose();
            };
            chooseLocation = new UIButton(UIButtonType.System);
            chooseLocation.SetTitle("Геопозиция", UIControlState.Normal);
            chooseLocation.Font.WithSize(10);
            chooseLocation.Frame = new RectangleF(150, 200, 120, 70);


            chooseLocation.TouchUpInside += (sender, e) => {
                map = new MKMapView(UIScreen.MainScreen.Bounds);

                View.AddSubview(map);
                CLLocationManager locationManager = new CLLocationManager();
                locationManager.RequestWhenInUseAuthorization();
                map.ShowsUserLocation = true;
                var tapRecogniser = new UITapGestureRecognizer(this, new ObjCRuntime.Selector("MapTapSelector:"));
                map.AddGestureRecognizer(tapRecogniser);
            };


            containerView.Add(chooseLocation);
            saveButton = new UIButton();
            containerView.AddSubview(saveButton);
            saveButton.TranslatesAutoresizingMaskIntoConstraints = false;
            saveButton.TopAnchor.ConstraintEqualTo(commentTextView.BottomAnchor, 120).Active = true;
            saveButton.CenterXAnchor.ConstraintEqualTo(titleTextField.CenterXAnchor).Active  = true;
            saveButton.WidthAnchor.ConstraintEqualTo(200).Active = true;
            saveButton.HeightAnchor.ConstraintEqualTo(40).Active = true;
            saveButton.SetTitle("Save", UIControlState.Normal);
            saveButton.SetTitleColor(View.TintColor, UIControlState.Normal);
            saveButton.TouchUpInside += SaveButton_TouchUpInside;
        }