public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; // Adjust taps/touches required to fit your needs. UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer() { NumberOfTapsRequired = 1, NumberOfTouchesRequired = 1, }; tapRecognizer.AddTarget((sender) => { // The foreach is only necessary if you have more than one touch for your recognizer. // For all else just roll with zero, `PointF location = tapRecognizer.LocationOfTouch(0, View);` foreach (int locationIndex in Enumerable.Range(0, tapRecognizer.NumberOfTouches)) { PointF location = tapRecognizer.LocationOfTouch(locationIndex, View); UIView newTapView = new UIView(new RectangleF(PointF.Empty, ItemSize)) { BackgroundColor = GetRandomColor(), }; newTapView.Center = location; View.Add(newTapView); // Remove the view after it's been around a while. Task.Delay(5000).ContinueWith(_ => InvokeOnMainThread(() => { newTapView.RemoveFromSuperview(); newTapView.Dispose(); })); } }); View.AddGestureRecognizer(tapRecognizer); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); int number = 0; int.TryParse(e.NewElement.Text, out number); if (number != 0) { Control.UserInteractionEnabled = true; Control.TextColor = UIColor.Blue; var gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var url = new NSUrl("tel:" + Control.Text); if (UIApplication.SharedApplication.CanOpenUrl(url)) { UIApplication.SharedApplication.OpenUrl(url); } }); Control.AddGestureRecognizer(gesture); } else { Control.UserInteractionEnabled = false; Control.TextColor = UIColor.Black; } }
// // 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) { UITabBarController tabBarController; window = new UIWindow (UIScreen.MainScreen.Bounds); //viewController = new TrafficDialogViewController(); var dv = new TrafficDialogViewController (){ Autorotate = true }; var tap = new UITapGestureRecognizer (); tap.AddTarget (() =>{ dv.View.EndEditing (true); }); dv.View.AddGestureRecognizer (tap); tap.CancelsTouchesInView = false; navigation = new UINavigationController (); navigation.PushViewController (dv, true); window = new UIWindow (UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible (); window.RootViewController = navigation; return true; }
/// <summary> /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class. /// </summary> public SlideoutNavigationController() { SlideSpeed = 0.2f; SlideWidth = 245f; // HACK to detect pan gesture from the whole viewport SlideHeight = float.MaxValue; LayerShadowing = false; _internalMenuViewLeft = new ProxyNavigationController { ParentController = this, View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight } }; _internalMenuViewRight = new ProxyNavigationController { ParentController = this, View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight } }; _internalMenuViewLeft.SetNavigationBarHidden (DisplayNavigationBarOnLeftMenu, false); _internalMenuViewRight.SetNavigationBarHidden (DisplayNavigationBarOnRightMenu, false); _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } }; _internalTopView.View.Layer.MasksToBounds = false; _tapGesture = new UITapGestureRecognizer (); _tapGesture.AddTarget (() => Hide ()); _tapGesture.NumberOfTapsRequired = 1; _panGesture = new UIPanGestureRecognizer { Delegate = new SlideoutPanDelegate(this), MaximumNumberOfTouches = 1, MinimumNumberOfTouches = 1 }; _panGesture.AddTarget (() => Pan (_internalTopView.View)); _internalTopView.View.AddGestureRecognizer (_panGesture); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.RestrictRotation(UIInterfaceOrientationMask.Portrait); UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(90, 89, 89) }; // Keyboard dispose when clicking outside the comment box var g = new UITapGestureRecognizer { CancelsTouchesInView = false }; g.AddTarget(() => View.EndEditing(true)); View.AddGestureRecognizer(g); txtEmail.TextColor = UIColor.FromRGB(90, 89, 89); txtEmail.ShouldReturn = delegate(UITextField textField) { btnSend.SendActionForControlEvents(UIControlEvent.TouchUpInside); return(true); }; }
private void LoadTabView() { typeSamples = ((string)Types).Split(','); featureSamples = ((string)Features).Split(','); customTab = new UIView(); customTab.BackgroundColor = UIColor.FromRGB(0, 123.0f / 255.0f, 229.0f / 255.0f); selectedTabHighlightView = new UIView(); selectedTabHighlightView.BackgroundColor = UIColor.FromRGB(1.0f, 198.0f / 255.0f, 66.0f / 255.0f); typesTextLabel = new UILabel(); typesTextLabel.TextColor = UIColor.White; typesTextLabel.Text = typeSamples[0]; typesTextLabel.TextAlignment = UITextAlignment.Center; typesTextLabel.Font = Utility.TitleFont; featuresTextLabel = new UILabel(); featuresTextLabel.TextColor = UIColor.White; featuresTextLabel.Text = featureSamples[0]; featuresTextLabel.TextAlignment = UITextAlignment.Center; featuresTextLabel.Font = Utility.TitleFont; customTab.AddSubview(selectedTabHighlightView); customTab.AddSubview(typesTextLabel); customTab.AddSubview(featuresTextLabel); UITapGestureRecognizer singleFingerTap = new UITapGestureRecognizer(); singleFingerTap.AddTarget(() => HandleSingleTap(singleFingerTap)); customTab.AddGestureRecognizer(singleFingerTap); this.View.AddSubview(customTab); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); if (e.OldElement == null) { var uiLabel = (UILabel)Control; uiLabel.TextColor = UIColor.Blue; uiLabel.BackgroundColor = UIColor.Clear; uiLabel.UserInteractionEnabled = true; uiLabel.AttributedText = new NSAttributedString(Element.Text, underlineStyle: NSUnderlineStyle.Single); var linkGesture = new UITapGestureRecognizer() { NumberOfTapsRequired = 1, DelaysTouchesBegan = true }; linkGesture.AddTarget(() => { Device.OpenUri(((HyperLinkLabel)Element).UriToNavigate); }); uiLabel.AddGestureRecognizer(linkGesture); } }
private void InvokeSecondCurrencyLabelTap() { var uITapGestureRecognizer = new UITapGestureRecognizer(); uITapGestureRecognizer.AddTarget(SecondLabelSelected); SecondCurrencyLabel.AddGestureRecognizer(uITapGestureRecognizer); }
private void InvokeFirstCurrencyLabelTap() { var uITapGestureRecognizer = new UITapGestureRecognizer(); uITapGestureRecognizer.AddTarget(FirstLabelSelected); FirstCurrencyLabel.AddGestureRecognizer(uITapGestureRecognizer); }
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { string element = this.elements[indexPath.Row]; UITableViewCell cell = new UITableViewCell(); cell.TextLabel.Text = element; cell.TextLabel.Font = UIFont.SystemFontOfSize(13); cell.TextLabel.TextColor = UIColor.Black; // branch locator text field layout //if(textField.Tag ==1032) // cell.TextLabel.TextColor = UIColor.White; cell.BackgroundColor = UIColor.Clear; cell.UserInteractionEnabled = true; UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer(); tapRecognizer.NumberOfTapsRequired = 1; cell.ContentView.AddGestureRecognizer(tapRecognizer); tapRecognizer.AddTarget(() => { this.DidSelectRow(tableView, indexPath.Row); }); return(cell); }
/// <summary> /// Called when the view is first loaded /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); _panelContainers = new List <PanelContainer>(); _tapToClose = new UITapGestureRecognizer(); _tapToClose.AddTarget(() => HidePanel(CurrentActivePanelContainer)); _slidingGesture = new SlidingGestureRecogniser(_panelContainers, ShouldReceiveTouch, this, View); _slidingGesture.ShowPanel += (sender, e) => ShowPanel(((SlidingGestureEventArgs)e).PanelContainer); _slidingGesture.HidePanel += (sender, e) => HidePanel(((SlidingGestureEventArgs)e).PanelContainer); View.ClipsToBounds = true; View.Layer.ShadowColor = ShadowColor; View.Layer.MasksToBounds = false; View.Layer.ShadowOpacity = ShadowOpacity; CGRect shadow = View.Bounds; shadow.Inflate(new CGSize(3, 3)); View.Layer.ShadowPath = UIBezierPath.FromRoundedRect(shadow, 0).CGPath; }
// // 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) { UITabBarController tabBarController; window = new UIWindow(UIScreen.MainScreen.Bounds); //viewController = new TrafficDialogViewController(); var dv = new TrafficDialogViewController() { Autorotate = true }; var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { dv.View.EndEditing(true); }); dv.View.AddGestureRecognizer(tap); tap.CancelsTouchesInView = false; navigation = new UINavigationController(); navigation.PushViewController(dv, true); window = new UIWindow(UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible(); window.RootViewController = navigation; return(true); }
protected override void OnElementChanged(ElementChangedEventArgs <View> e) { base.OnElementChanged(e); if (e.OldElement != null) { RemoveGestureRecognizer(panGesture); panGesture.RemoveTarget(panGestureToken); } if (e.NewElement != null) { var dragView = Element as DrawableAbsoluteLayout; panGesture = new UIPanGestureRecognizer(); panGestureToken = panGesture.AddTarget(DetectPan); AddGestureRecognizer(panGesture); tapGesture = new UITapGestureRecognizer(); tapGesture.NumberOfTapsRequired = 2; tapGestureToken = tapGesture.AddTarget(DetectTapped); AddGestureRecognizer(tapGesture); dragView.RestorePositionCommand = new Command(() => { if (!firstTime) { Center = originalPosition; } }); } }
/// <summary> /// On load set the config as per the chat application /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Remove the keyboard on a tap gesture var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Get a reference to the chat application ChatAppiOS chatApplication = ChatWindow.ChatApplication; //Update the settings based on previous values LocalServerEnabled.SetState(chatApplication.LocalServerEnabled, false); MasterIP.Text = chatApplication.ServerIPAddress; MasterPort.Text = chatApplication.ServerPort.ToString(); LocalName.Text = chatApplication.LocalName; EncryptionEnabled.SetState(chatApplication.EncryptionEnabled, false); //Set the correct segment on the connection mode toggle ConnectionMode.SelectedSegment = (chatApplication.ConnectionType == ConnectionType.TCP ? 0 : 1); }
/// <summary> /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class. /// </summary> public SlideoutNavigationController() { SlideSpeed = 0.2f; SlideWidth = 260f; SlideHeight = 44f; LayerShadowing = true; _internalMenuView = new ProxyNavigationController { ParentController = this, View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight } }; //_internalMenuView.SetNavigationBarHidden(true, false); _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } }; _internalTopView.View.Layer.MasksToBounds = false; _tapGesture = new UITapGestureRecognizer(); // _tapGesture.AddTarget(new ) _tapGesture.AddTarget(Hide); _tapGesture.NumberOfTapsRequired = 1; _panGesture = new UIPanGestureRecognizer { Delegate = new SlideoutPanDelegate(this), MaximumNumberOfTouches = 1, MinimumNumberOfTouches = 1 }; _panGesture.AddTarget(() => Pan(_internalTopView.View)); _internalTopView.View.AddGestureRecognizer(_panGesture); }
public CalTableCell(List <CalWorkoutModel> _workouts, nfloat _cellHt, int _index, CalendarViewController _calVC) : base(UITableViewCellStyle.Value1, Key) { workouts = _workouts; cellHt = _cellHt; index = _index; calVC = _calVC; name = MakeLabel(); weightReps = MakeLabel(); space = new UILabel() { BackgroundColor = Util.BackgroundGrey, Text = "" }; openNote = new UIImageView(UIImage.FromFile("Images/add.png")) { TintColor = UIColor.Black, ContentMode = UIViewContentMode.ScaleAspectFill }; UITapGestureRecognizer tapPlus = new UITapGestureRecognizer(); tapPlus.AddTarget(() => { OnSelect(index); }); openNote.UserInteractionEnabled = true; openNote.AddGestureRecognizer(tapPlus); ContentView.Add(name); ContentView.Add(weightReps); ContentView.Add(space); ContentView.Add(openNote); }
void SetupLinkButton() { _gestureRecognizer = new UITapGestureRecognizer(); _gestureRecognizer.AddTarget(() => OnSmittestopLinkButtonStackViewTapped(_gestureRecognizer)); SmittestopLinkButtonStackView.AddGestureRecognizer(_gestureRecognizer); SmittestopLinkButtonStackView.AccessibilityTraits = UIAccessibilityTrait.Link; }
private void tapGestureAction() { Action tapAction = new Action( delegate { { if (this.parentCell is PunchCell) { ImagePeviewViewController imagePreviewController = (this.parentCell as PunchCell).parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = ImageView; (this.parentCell as PunchCell).parentController.PresentViewController(imagePreviewController, false, null); } else if (this.parentCell is GuidedPhotoCell) { ImagePeviewViewController imagePreviewController = (this.parentCell as GuidedPhotoCell).parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = ImageView; (this.parentCell as GuidedPhotoCell).parentController.PresentViewController(imagePreviewController, false, null); } } }); UITapGestureRecognizer tb = new UITapGestureRecognizer(); tb.AddTarget(tapAction); ImageView.AddGestureRecognizer(tb); }
public override void ViewDidLoad() { CurrentNavigationItem = NavigationItem; base.ViewDidLoad(); TabBar.ItemSelected += NavigateOnTabBar; SearchBar.TextChanged += UpdateSearchValue; _categoryListController = Vm.Categories.GetController(CreateDefaultTableCell, BindCategoryCell); _categoryListController.TableView = CategoryTable; _categoryListController.SelectionChanged += SelectCategory; _foundCoursesListController = Vm.FoundCourses.GetController(CreateDefaultTableCell, BindCourseCell); _foundCoursesListController.TableView = SearchResultsTable; _foundCoursesListController.SelectionChanged += SelectCourse; var gestureRecognizer = new UITapGestureRecognizer { CancelsTouchesInView = false }; gestureRecognizer.AddTarget(() => View.EndEditing(true)); gestureRecognizer.ShouldReceiveTouch += (rec, t) => !(t.View is UIControl); View.AddGestureRecognizer(gestureRecognizer); }
protected override void OnElementChanged(ElementChangedEventArgs<Label> e) { base.OnElementChanged(e); if (e.OldElement == null) { var label = Control; label.TextColor = UIColor.Red; label.BackgroundColor = UIColor.Clear; label.UserInteractionEnabled = true; var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { var hyperLinkLabel = Element as HyperLinkControl; if (hyperLinkLabel != null) { var uri = hyperLinkLabel.NavigateUri; if (uri.Contains("@") && !uri.StartsWith("mailto:")) uri = string.Format("{0}{1}", "mailto:", uri); else if (uri.StartsWith("www.")) uri = string.Format("{0}{1}", @"http://", uri); UIApplication.SharedApplication.OpenUrl(new NSUrl(uri)); } }); tap.NumberOfTapsRequired = 1; tap.DelaysTouchesBegan = true; label.AddGestureRecognizer(tap); } }
/// <summary> /// On load initialise the example /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Subscribe to the keyboard events NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); //Remove the keyboard if the screen is tapped var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Create the chat application instance ChatApplication = new ChatAppiOS(ChatHistory, MessageBox); //Uncomment this line to enable logging //EnableLogging(); //Set the default serializer to Protobuf ChatApplication.Serializer = DPSManager.GetDataSerializer<NetworkCommsDotNet.DPSBase.ProtobufSerializer>(); //Get the initial size of the chat view ChatApplication.OriginalViewSize = ChatView.Frame; //Print out the application usage instructions ChatApplication.PrintUsageInstructions(); //Initialise comms to add the necessary packet handlers ChatApplication.RefreshNetworkCommsConfiguration(); }
private void Menu_Clicked(object sender, EventArgs e) { menuVC = new ToggleMenu(); NavigationController.NavigationBar.Hidden = true; View.Add(menuVC.View); menuVC.ViewDidLoad(); menuVC.View.Frame = new CGRect(0 - this.View.Frame.Width, 0, this.View.Frame.Width, this.View.Frame.Height); buttonList = menuVC.buttons; controllerList = menuVC.controllers; UIView.Animate(0.5f, () => { menuVC.View.Frame = new CGRect(0, 0, View.Frame.Width, View.Frame.Height); }); UITapGestureRecognizer tap = new UITapGestureRecognizer(); tap.AddTarget(() => { Util.SlideMenu(menuVC, this.View, this.NavigationController); }); menuVC.close.AddGestureRecognizer(tap); for (int i = 0; i < buttonList.Count; i++) { buttonList [i].TouchUpInside += ButtonClicked; } // menuVC.View.AddGestureRecognizer (TapBG ()); }
public override UIView GetViewForHeader(UITableView tableView, nint section) { UIView headerView = new UIView(new CGRect(0, 0, 320, 44)); UILabel headerTitleLabel = new UILabel(new CGRect(15, 12, 260, 20)); headerTitleLabel.Text = "Table of Contents"; headerTitleLabel.Font = UIFont.SystemFontOfSize(14); headerView.AddSubview(headerTitleLabel); UIView bottomLine = new UIView(new CGRect(15, 43, 305, 1)); bottomLine.BackgroundColor = UIColor.LightGray.ColorWithAlpha(0.6f); headerView.AddSubview(bottomLine); UIView sideBar = new UIView(new CGRect(0, 0, 5, 44)); sideBar.BackgroundColor = UIColor.FromRGB(255, 200, 200); headerView.AddSubview(sideBar); headerView.BackgroundColor = UIColor.White; UITapGestureRecognizer tapHeaderRecoginzer = new UITapGestureRecognizer(); tapHeaderRecoginzer.AddTarget(delegate() { HighlightedTOCNode = Tree.GetFirstPageNode().ParentNode; LatestOpendTOCNode = HighlightedTOCNode.ParentNode; DisplayedTocList = Tree.GetDisplayTOCNodeList(LatestOpendTOCNode); tableView.ReloadData(); }); headerView.UserInteractionEnabled = true; headerView.AddGestureRecognizer(tapHeaderRecoginzer); return(headerView); }
public UIView GetView(OutputFieldMetadata outputField, object value, MyFormHandler myFormHandler, FormMetadata formMetadata, List <FormInputManager> inputsManager, int yAxis) { var formLink = value.CastTObject <FormLink>(); var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30); this.OutputView = new UITextView { Text = outputField.Label + ": " + formLink.Label, Frame = new CGRect(new CGPoint(20, yAxis), size), TextColor = UIColor.Blue }; var gesture = new UITapGestureRecognizer(); gesture.AddTarget(() => { var metadata = myFormHandler.GetFormMetadataAsync(formLink.Form); myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, formLink.InputFieldValues)); }); this.OutputView.AddGestureRecognizer(gesture); return(this.OutputView); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // Dismiss editing var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); buttonSubscribe.TouchUpInside += buttonSubscribe_Clicked; buttonUnsubscribe.TouchUpInside += buttonUnsubscribe_Clicked; buttonNotify.TouchUpInside += buttonNotify_Clicked; client = new HttpMessageBus.DLL_Client.Common.Client(); this.textBoxPort.Text = client.Port.ToString(); this.textBoxHostIPAddress.Text = client.HostIPAddress; client.ResponseStringChanged += HandleResponseStringChanged; return; }
/// <summary> /// Shows the publication description info. /// </summary> private void ShowPublicationDescriptionInfo() { DescriptionContentLabel.Text = curPublication.Description; CGSize labelSize = TextDisplayUtil.GetStringBoundRect(curPublication.Description, UIFont.SystemFontOfSize(12), new CGSize(600, 6000)); if (labelSize.Height > 56) // 4 *14 { DescriptionContentLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapContentRecoginzer = new UITapGestureRecognizer(); tapContentRecoginzer.AddTarget(this.ShowAllDescription); DescriptionContentLabel.AddGestureRecognizer(tapContentRecoginzer); MoreDescriptionLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapMoreRecoginzer = new UITapGestureRecognizer(); tapMoreRecoginzer.AddTarget(this.ShowAllDescription); MoreDescriptionLabel.AddGestureRecognizer(tapMoreRecoginzer); ChangeViewHeightConstraint(MoreDescriptionLabel, 20); ChangeViewHeightConstraint(DescriptionInfoContainerView, 145); } else { ChangeViewHeightConstraint(MoreDescriptionLabel, 0); ChangeViewHeightConstraint(DescriptionInfoContainerView, labelSize.Height + 67); } }
/// <summary> /// Replaces the content area view controller with the specified view controller. /// </summary> /// <param name="newContentView"> /// New content view. /// </param> public void ChangeContentView(UIViewController newContentView) { if (_contentAreaView != null) { _contentAreaView.RemoveFromSuperview(); } if (ContentAreaController != null) { ContentAreaController.RemoveFromParentViewController(); } ContentAreaController = newContentView; SetVisibleView(); CloseMenu(); // setup a tap gesture to close the menu on root view tap _tapGesture = new UITapGestureRecognizer(); _tapGesture.AddTarget(() => CloseMenu()); _tapGesture.NumberOfTapsRequired = 1; _panGesture = new UIPanGestureRecognizer { Delegate = new SlideoutPanDelegate(), MaximumNumberOfTouches = 1, MinimumNumberOfTouches = 1 }; _panGesture.AddTarget(() => Pan(_contentAreaView)); _contentAreaView.AddGestureRecognizer(_panGesture); }
public override void ViewDidLoad( ) { base.ViewDidLoad( ); OrientationState = -1; UIScrollView = new CustomScrollView( ); UIScrollView.Interceptor = this; UIScrollView.Frame = View.Frame; UIScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(0x1C1C1CFF); UIScrollView.Delegate = new NavBarRevealHelperDelegate(Task.NavToolbar); UIScrollView.Layer.AnchorPoint = new CGPoint(0, 0); UITapGestureRecognizer tapGesture = new UITapGestureRecognizer( ); tapGesture.NumberOfTapsRequired = 2; tapGesture.AddTarget(this, new ObjCRuntime.Selector("DoubleTapSelector:")); UIScrollView.AddGestureRecognizer(tapGesture); View.BackgroundColor = UIScrollView.BackgroundColor; View.AddSubview(UIScrollView); // add a busy indicator Indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); UIScrollView.AddSubview(Indicator); // add a refresh button for debugging RefreshButton = UIButton.FromType(UIButtonType.System); RefreshButton.SetTitle("Refresh", UIControlState.Normal); RefreshButton.SizeToFit( ); // if they tap the refresh button, refresh the list RefreshButton.TouchUpInside += (object sender, EventArgs e) => { DeleteNote( ); PrepareCreateNotes(0, true); }; ResultView = new UIResultView(UIScrollView, View.Frame.ToRectF( ), OnResultViewDone); ResultView.Hide( ); // setup the tutorial overlay TutorialBacker = new UIView( ); TutorialBacker.Layer.AnchorPoint = CGPoint.Empty; TutorialBacker.Alpha = 0.00f; TutorialBacker.BackgroundColor = UIColor.Black; TutorialBacker.Hidden = true; View.AddSubview(TutorialBacker); AnimatingTutorial = false; TutorialOverlay = new UIImageView( ); TutorialOverlay.Layer.AnchorPoint = CGPoint.Empty; TutorialOverlay.Frame = View.Frame; TutorialOverlay.Alpha = 0.00f; View.AddSubview(TutorialOverlay); KeyboardAdjustManager = new Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager(View); }
public override void ViewDidLoad () { base.ViewDidLoad (); NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel); NavigationItem.LeftBarButtonItem.Clicked += (sender, e) => { this.NavigationController.PopViewController(true); }; NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done); NavigationItem.RightBarButtonItem.Clicked += async (sender, e) => { await SaveCheckin(); }; mapView.DidUpdateUserLocation += (sender, e) => { if (mapView.UserLocation != null) { CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate; UpdateMapLocation(coords); } }; UITapGestureRecognizer doubletap = new UITapGestureRecognizer(); doubletap.NumberOfTapsRequired = 1; // double tap doubletap.AddTarget (this, new ObjCRuntime.Selector("ImageTapped")); imageView.AddGestureRecognizer(doubletap); _dataSource = new LocationsDataSource (this); tableLocations.Source = _dataSource; txtComment.ShouldEndEditing += (tf) => { tf.ResignFirstResponder(); return true; }; }
public override void ViewDidLoad() { base.ViewDidLoad(); //allows us to get rid of keyboard by tapping outside an input var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { View.EndEditing(true); }); View.AddGestureRecognizer(tap); client = new JsonServiceClient("http://192.168.1.8:8080/api"); PopulateUsers(); addUserButton.TouchUpInside += (object sender, EventArgs e) => { client.Send(new AddUser { Name = nameText.Text, Goal = int.Parse(goalText.Text) }); nameText.Text = string.Empty; goalText.Text = string.Empty; PopulateUsers(); }; addAmountButton.TouchUpInside += (object sender, EventArgs e) => { var userPickerModel = selectUserPicker.Model as UserPickerModel; var response = client.Send(new AddProtein { Amount = int.Parse(amountText.Text), UserId = userPickerModel.SelectedItem.Id }); userPickerModel.SelectedItem.Total = response.NewTotal; totalLabel.Text = response.NewTotal.ToString(); }; }
public List <UIImageView> RestructureImages(List <UIImage> scrollImages) { try { nfloat h = 100.0f; nfloat w = 100.0f; nfloat padding = 10.0f; List <UIImageView> scrollImageCollection = new List <UIImageView> (); for (int i = 0; i < scrollImages.Count; i++) { UIImageView imageView = new UIImageView(); imageView.Frame = new CGRect(padding * (i + 1) + (i * w), 0, w, h); imageView.Image = scrollImages [i]; Action tapAction = new Action( delegate { imageView = HighlightSelectedImage(imageView); ImagePeviewViewController imagePreviewController = parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = imageView; parentController.PresentViewController(imagePreviewController, false, null); }); UITapGestureRecognizer tap = new UITapGestureRecognizer(); tap.AddTarget(tapAction); imageView.AddGestureRecognizer(tap); imageView.UserInteractionEnabled = true; scrollImageCollection.Add(imageView); } return(scrollImageCollection); } catch (Exception ex) { Debug.WriteLine("Exception Occured in RestructureImages method due to " + ex.Message); return(new List <UIImageView> ()); } }
public void IsRewardCollectionEmpty() { var itemsCount = CollectionView.Source.GetItemsCount(CollectionView, 0); if (itemsCount == 0) { EmptyCollectionView.Hidden = false; _swipe = new UISwipeGestureRecognizer(); _swipe.AddTarget(() => HideAreaCollection()); _swipe.Direction = UISwipeGestureRecognizerDirection.Up | UISwipeGestureRecognizerDirection.Down; EmptyCollectionView.AddGestureRecognizer(_swipe); _tap = new UITapGestureRecognizer(); _tap.AddTarget(() => HideAreaCollection()); EmptyCollectionView.AddGestureRecognizer(_tap); var data = NSData.FromFile("Images/panda-ohno.gif"); var image = AnimatedImageView.GetAnimatedImageView(data, ViewForImage); ViewForImage.Image = image.Image; ViewForImage.StartAnimating(); } if (itemsCount != 0) { EmptyCollectionView.Hidden = true; } }
/// <summary> /// On load set the config as per the chat application /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Remove the keyboard on a tap gesture var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Get a reference to the chat application ChatAppiOS chatApplication = ChatWindow.ChatApplication; //Update the settings based on previous values LocalServerEnabled.SetState(chatApplication.LocalServerEnabled, false); MasterIP.Text = chatApplication.ServerIPAddress; MasterPort.Text = chatApplication.ServerPort.ToString(); LocalName.Text = chatApplication.LocalName; EncryptionEnabled.SetState(chatApplication.EncryptionEnabled, false); //Set the correct segment on the connection mode toggle ConnectionMode.SelectedSegment = (chatApplication.ConnectionType == ConnectionType.TCP ? 0 : 1); }
private void ShowPublicationFullTextCaseInfo() { if (curPublication.IsFTC) //Full text case { foreach (var view in FullTextCaseInfoContainerView.Subviews) { view.Hidden = false; } ChangeViewHeightConstraint(FullTextCaseInfoContainerView, 165); ChangeViewHeightConstraint(MoreFullTextCaseDetailLabel, 20); FullTextCaseContentLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapDetailRecoginzer = new UITapGestureRecognizer(); tapDetailRecoginzer.AddTarget(this.ShowAllFullTextCaseDescription); FullTextCaseContentLabel.AddGestureRecognizer(tapDetailRecoginzer); MoreFullTextCaseDetailLabel.UserInteractionEnabled = true; UITapGestureRecognizer tapMoreRecoginzer = new UITapGestureRecognizer(); tapMoreRecoginzer.AddTarget(this.ShowAllFullTextCaseDescription); MoreFullTextCaseDetailLabel.AddGestureRecognizer(tapMoreRecoginzer); } else { foreach (var view in FullTextCaseInfoContainerView.Subviews) { view.Hidden = true; } ChangeViewHeightConstraint(FullTextCaseInfoContainerView, 0); } }
/// <summary> /// On load initialise the example /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); //Subscribe to the keyboard events NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); //Remove the keyboard if the screen is tapped var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { this.View.EndEditing(true); }); this.View.AddGestureRecognizer(tap); //Create the chat application instance ChatApplication = new ChatAppiOS(ChatHistory, MessageBox); //Uncomment this line to enable logging //EnableLogging(); //Set the default serializer to Protobuf ChatApplication.Serializer = DPSManager.GetDataSerializer <NetworkCommsDotNet.DPSBase.ProtobufSerializer>(); //Get the initial size of the chat view ChatApplication.OriginalViewSize = ChatView.Frame; //Print out the application usage instructions ChatApplication.PrintUsageInstructions(); //Initialise comms to add the necessary packet handlers ChatApplication.RefreshNetworkCommsConfiguration(); }
void LoadHiResCoverImage() { UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(); tapGesture.NumberOfTapsRequired = 1; tapGesture.AddTarget(this, new Selector("ShowHiResCover")); DetailsCover.AddGestureRecognizer(tapGesture); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); _gestureRecognizer = new UITapGestureRecognizer(); _gestureRecognizer.AddTarget(() => OpenWebPageBtnTapped(_gestureRecognizer)); ButtonView.AddGestureRecognizer(_gestureRecognizer); }
private UITapGestureRecognizer CreateHeaderTapGesture() { var headerTapGestureRecognizer = new UITapGestureRecognizer(); headerTapGestureRecognizer.AddTarget(HandleHeaderTapGesture); HeaderTapGestureRecognizers.Add(headerTapGestureRecognizer); return(headerTapGestureRecognizer); }
/// <summary> /// Call it to force dismiss keyboard when background is tapped /// </summary> public void DismissKeyboardOnBackgroundTap() { // Add gesture recognizer to hide keyboard var tap = new UITapGestureRecognizer { CancelsTouchesInView = false }; tap.AddTarget(() => Controller.View.EndEditing(true)); tap.ShouldReceiveTouch = (recognizer, touch) => !(touch.View is UIControl || touch.View.FindSuperviewOfType(Controller.View, typeof(UITableViewCell)) != null); Controller.View.AddGestureRecognizer(tap); }
protected void RegisterTapGestureRecognizer () { _tapGesture = new UITapGestureRecognizer (); _tapGesture.NumberOfTapsRequired = 1; _tapGesture.NumberOfTouchesRequired = 1; _targetToken = _tapGesture.AddTarget (EndTarget); View.AddGestureRecognizer (_tapGesture); }
public void InitGestureRecog () { var gestureRecognizer = new UITapGestureRecognizer(); gestureRecognizer.CancelsTouchesInView = false; gestureRecognizer.AddTarget(this, MySelector); gestureRecognizer.Delegate = new SwipeRecognizerDelegate(); // and last, add the recognizer to this view to take actions this.AddGestureRecognizer(gestureRecognizer); }
void SetupTapGesture() { var tapGestureRecognizer = new UITapGestureRecognizer (); tapGestureRecognizer.AddTarget (tg => { var currTapGesture = (tg as UITapGestureRecognizer); if (currTapGesture == null) return; lblGestureStatus.Text = string.Format ("Tap Location: @{0}", currTapGesture.LocationOfTouch (0, imgTapMe)); }); tapGestureRecognizer.NumberOfTapsRequired = 2; imgTapMe.AddGestureRecognizer (tapGestureRecognizer); }
protected void WireUpTapGestureRecognizer () { // create a new tap gesture UITapGestureRecognizer tapGesture = new UITapGestureRecognizer (); // wire up the event handler (have to use a selector) tapGesture.AddTarget ( () => { lblGestureStatus.Text = "tap me image tapped @" + tapGesture.LocationOfTouch (0, imgTapMe).ToString (); }); // configure it tapGesture.NumberOfTapsRequired = 2; // add the gesture recognizer to the view imgTapMe.AddGestureRecognizer (tapGesture); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); UITapGestureRecognizer scanBarcodeTapped = new UITapGestureRecognizer(); scanBarcodeTapped.AddTarget(async() => { var scanner = new ZXing.Mobile.MobileBarcodeScanner(); var result = await scanner.Scan(); Console.WriteLine(result.Text); }); scanBarcodeView.AddGestureRecognizer(scanBarcodeTapped); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear (animated); // TODO: move this to a base SnuggleViewController class // http://stackoverflow.com/questions/10824092/monotouch-dialog-dismissing-keyboard-by-touching-anywhere-in-dialogviewcontroll var tap = new UITapGestureRecognizer (); tap.AddTarget (() =>{ View.EndEditing (true); }); View.AddGestureRecognizer (tap); tap.CancelsTouchesInView = false; NavigationItem.RightBarButtonItem = new UIBarButtonItem (Locale.GetText ("Save"), UIBarButtonItemStyle.Plain, delegate { Save (); }); }
public SlidingCell(string resuseIdentifier) : base(UITableViewCellStyle.Default, resuseIdentifier) { scrollView = new UIScrollView(); scrollView.ShowsHorizontalScrollIndicator = false; scrollView.Delegate = new SlidingCellScrollDelegate(this); tapGesture = new UITapGestureRecognizer (); tapGesture.AddTarget (() => { if (scrollView.ContentOffset != PointF.Empty) { scrollView.SetContentOffset(PointF.Empty, false); return; } var table = this.Superview.Superview as UITableView; var indexPath = table.IndexPathForCell (this); table.Source.RowSelected (table, indexPath); }); scrollView.AddGestureRecognizer (tapGesture); ContentView.AddSubview(scrollView); scrollViewButtonView = new UIView(); scrollView.AddSubview(scrollViewButtonView); moreButton = UIButton.FromType(UIButtonType.Custom); moreButton.BackgroundColor = UIColor.FromRGBA(0.78f, 0.78f, 0.8f, 1.0f); moreButton.SetTitle("More", UIControlState.Normal); moreButton.SetTitleColor(UIColor.White, UIControlState.Normal); scrollViewButtonView.AddSubview(moreButton); deleteButton = UIButton.FromType(UIButtonType.Custom); deleteButton.BackgroundColor = UIColor.FromRGBA(1.0f, 0.231f, 0.188f, 1.0f); deleteButton.SetTitle("Delete", UIControlState.Normal); deleteButton.SetTitleColor(UIColor.White, UIControlState.Normal); scrollViewButtonView.AddSubview(deleteButton); scrollViewContentView = new UIView(); scrollViewContentView.BackgroundColor = UIColor.White; scrollView.AddSubview(scrollViewContentView); scrollViewLabel = new UILabel(); scrollViewContentView.AddSubview(scrollViewLabel); statusView = new UIImageView (); scrollView.AddSubview(statusView); }
public RevealController() { AnimationSpeed = 0.2f; HideStatusBar = true; internalMenuView = new ProxyNavigationController { ParentController = this, View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight } }; internalTopView = new UIViewController { View = { UserInteractionEnabled = true } }; internalTopView.View.Layer.MasksToBounds = false; tapGesture = new UITapGestureRecognizer(); tapGesture.AddTarget(Hide); tapGesture.NumberOfTapsRequired = 1; }
public void pickerViewModel(UITextField textFieldItem, List<string> segmentosStrings, UIButton button) { PickerModel picker_model_Segmentos = new PickerModel (segmentosStrings); UIPickerView picker_Segmentos = new UIPickerView (); picker_Segmentos.Model = picker_model_Segmentos; picker_Segmentos.ShowSelectionIndicator = true; UIToolbar toolbar = new UIToolbar (); toolbar.BarStyle = UIBarStyle.Black; toolbar.Translucent = true; toolbar.SizeToFit (); var tapRecognizer = new UITapGestureRecognizer (); tapRecognizer.AddTarget(() => { Console.WriteLine("CLICK"); }); tapRecognizer.NumberOfTapsRequired = 2; tapRecognizer.NumberOfTouchesRequired = 1; picker_Segmentos.AddGestureRecognizer(tapRecognizer); UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered,(s, e) => { // Console.WriteLine((int)picker_Segmentos.SelectedRowInComponent); Console.WriteLine(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ()); textFieldItem.Text = picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString (); if(button.Tag == 2 || button.Tag == 3){ Console.WriteLine("longCode ButtonClicked"); } textFieldItem.ResignFirstResponder (); }); UIBarButtonItem cancelButton = new UIBarButtonItem ("cancel", UIBarButtonItemStyle.Bordered, (s, e) => { textFieldItem.ResignFirstResponder (); }); toolbar.SetItems (new UIBarButtonItem[]{ doneButton, cancelButton }, true); toolbar.TintColor = UIColor.White; textFieldItem.InputView = picker_Segmentos; this.View.BackgroundColor = UIColor.Clear; textFieldItem.InputAccessoryView = toolbar; textFieldItem.AddGestureRecognizer (tapRecognizer); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = UIColor.Clear; Front = new FrontView (reviewableVerses[0]); View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile (Images.TableViewBackground)); Back = new BackView (reviewableVerses[position]); MemorizedImage = UIImage.FromFile (Images.HeartRedButton); NotMemorizedImage = UIImage.FromFile (Images.HeartGreyButton); TapGesture = new UITapGestureRecognizer { NumberOfTapsRequired = 1 }; TapGesture.AddTarget (FlipCardHandler); SwipeUpGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Up }; SwipeUpGesture.AddTarget (NextCardHandler); SwipeDownGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Down, }; SwipeDownGesture.AddTarget (NextCardHandler); RightSwipeGesture = new UISwipeGestureRecognizer { Direction = UISwipeGestureRecognizerDirection.Right }; RightSwipeGesture.AddTarget (RightSwipeHandler); HandleProductTourStep6 (); View.Add (Front); View.AddGestureRecognizer (SwipeUpGesture); View.AddGestureRecognizer (SwipeDownGesture); View.AddGestureRecognizer (RightSwipeGesture); View.AddGestureRecognizer (TapGesture); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Gesture Recognizers"; View.BackgroundColor = UIColor.White; lblGestureStatus = new UILabel(); lblGestureStatus.Text = "Tap Location: "; lblGestureStatus.Frame = new RectangleF(0, 350, View.Frame.Width, 44.0f); imgTapMe = new UIImageView(UIImage.FromBundle("Images/DoubleTapMe.png")); imgTapMe.UserInteractionEnabled = true; imgTapMe.Frame = new RectangleF(184, 275, 56, 56); //TODO: Step 10 - Add a tap gesture recognizer var tapGestureRecognizer = new UITapGestureRecognizer(); tapGestureRecognizer.AddTarget( (tg) => { var currTapGesture = (tg as UITapGestureRecognizer); if (currTapGesture == null) return; lblGestureStatus.Text = string.Format("Tap Location: @{0}", currTapGesture.LocationOfTouch(0, imgTapMe)); }); tapGestureRecognizer.NumberOfTapsRequired = 2; imgTapMe.AddGestureRecognizer(tapGestureRecognizer); imgDragMe = new UIImageView(UIImage.FromBundle("Images/DragMe.png")); imgDragMe.UserInteractionEnabled = true; imgDragMe.Frame = new RectangleF(78, 275, 56, 56); //TODO: Step 11a - Add a pan gesture recognizer for drag motions imgDragMe.AddGestureRecognizer(new UIPanGestureRecognizer(HandleDrag)); originalImageFrame = imgDragMe.Frame; View.AddSubviews(new UIView[] { lblGestureStatus, imgDragMe, imgTapMe }); }
public override void ViewDidLoad() { base.ViewDidLoad (); UIGestureRecognizer gesture = new UITapGestureRecognizer (); gesture.AddTarget (this, new Selector ("MySelector")); RectangleF rect = View.Frame; tabsView = new UIScrollView(new RectangleF(0, rect.Bottom - pagerSource.tabHeight, rect.Width, pagerSource.tabHeight)); tabsView.AddGestureRecognizer (gesture); tabsView.BackgroundColor = UIColor.LightGray; tabsView.ShowsHorizontalScrollIndicator = false; tabsView.ShowsVerticalScrollIndicator = false; tabsView.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin; View.Add (tabsView); reloadData (); SelectTabAtIndex (0); }
public TrafficViewDialogViewController (TrafficUpdates tu, string origin, string destination ) : base (UITableViewStyle.Grouped, null) { string head = "Traffic Update"; secOutput = new Section("Output"); root = new RootElement (head) { secOutput }; Origin = origin; Destination = destination; Root = root; dvc = new DialogViewController (root, true); var tap = new UITapGestureRecognizer (); tap.AddTarget (() =>{ dvc.View.EndEditing (true); }); dvc.View.AddGestureRecognizer (tap); tu.TrafficUpdate += Display; tap.CancelsTouchesInView = false; dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, delegate { secOutput.RemoveRange(0, secOutput.Count); tu.Origin = Origin; tu.Destination = Destination; tu.RunSearch("", false, false); }); AppDelegate.navigation.PushViewController (dvc, true); tu.Origin = Origin; tu.Destination = Destination; tu.RunSearch("", false, false); }
/// <summary> /// Called when [element changed]. /// </summary> /// <param name="e">The e.</param> protected override void OnElementChanged(ElementChangedEventArgs<Label> e) { base.OnElementChanged(e); if (e.OldElement == null) { var label = (UILabel)Control; label.TextColor = UIColor.Blue; label.BackgroundColor = UIColor.Clear; label.UserInteractionEnabled = true; var tapXamarin = new UITapGestureRecognizer(); tapXamarin.AddTarget(() => { var hyperLinkLabel = Element as HyperLinkLabel; UIApplication.SharedApplication.OpenUrl(new NSUrl(GetNavigationUri(hyperLinkLabel.NavigateUri))); }); tapXamarin.NumberOfTapsRequired = 1; tapXamarin.DelaysTouchesBegan = true; label.AddGestureRecognizer(tapXamarin); } }
public void AddTapGesture() { var tap = new UITapGestureRecognizer (); tap.AddTarget (ToggleControls); tap.NumberOfTapsRequired = 1; View.AddGestureRecognizer (tap); }
public override void ViewDidLoad () { base.ViewDidLoad (); TableView.SeparatorColor = UIColor.Clear; if (UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad) { NSNotificationCenter defaultCenter = NSNotificationCenter.DefaultCenter; defaultCenter.AddObserver (UIKeyboard.WillHideNotification, OnKeyboardNotification); defaultCenter.AddObserver (UIKeyboard.WillShowNotification, OnKeyboardNotification); } if (String.IsNullOrEmpty(tokenPayment.Token)) { DispatchQueue.MainQueue.DispatchAfter (DispatchTime.Now, () => { UIAlertView _error = new UIAlertView ("Missing Token", "No Card Token found. Please provide application with token via Pre-Authentication or Payment", null, "ok", null); _error.Show (); _error.Clicked += (sender, args) => { PaymentButton.Disable(); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { this.DismissViewController (true, null); } else { this.NavigationController.PopToRootViewController (true); } }; }); } else { SetUpTableView (); UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer (); tapRecognizer.AddTarget (() => { if (KeyboardVisible) { DismissKeyboardAction (); } }); tapRecognizer.NumberOfTapsRequired = 1; tapRecognizer.NumberOfTouchesRequired = 1; EncapsulatingView.AddGestureRecognizer (tapRecognizer); PaymentButton.Disable(); PaymentButton.SetTitleColor (UIColor.Black, UIControlState.Application); PaymentButton.TouchUpInside += (sender, ev) => { MakeTokenPayment (); }; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { FormClose.TouchUpInside += (sender, ev) => { this.DismissViewController (true, null); }; } } }
public override void ViewDidLoad () { base.ViewDidLoad (); this.View.BackgroundColor = UIColor.White; CGRect parentBounds = this.View.Bounds; float yPos = 80f; UILabel content = new UILabel(RectangleF.Empty); content.Text = "Essential Studio for iOS is a collection of user interface and file format manipulation components, that can be used to build line-of-business mobile applications."; content.Lines = 0; content.LineBreakMode = UILineBreakMode.WordWrap; content.Font = UIFont.FromName("Helvetica neue", 14f); content.ClipsToBounds = true; content.BackgroundColor = UIColor.Clear; content.TextColor = UIColor.FromRGB (137,137,137); content.TextAlignment = UITextAlignment.Left; CGRect contentFrame = new CGRect(); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { contentFrame = new CGRect (23, yPos, parentBounds.Size.Width - 46, 50); yPos += 60; } else { contentFrame = new CGRect (23, yPos, parentBounds.Size.Width - 46, 80); yPos += 90; } content.Frame = contentFrame; this.View.AddSubview (content); UILabel version = new UILabel(RectangleF.Empty); version.Text = "Version 13.3.0.7"; version.Lines = 1; version.Font = UIFont.FromName("Helvetica neue", 14f); version.ClipsToBounds = true; version.BackgroundColor = UIColor.Clear; version.TextColor = UIColor.FromRGB (137,137,137); version.TextAlignment = UITextAlignment.Left; CGSize versionSize = this.measureLabel (version); version.Frame = new CGRect (23, yPos, versionSize.Width, versionSize.Height); yPos += (float)versionSize.Height + 30; this.View.AddSubview (version); UILabel contact = new UILabel(RectangleF.Empty); contact.Text = "Contact Us"; contact.Lines = 1; contact.Font = UIFont.FromName("Helvetica neue", 17f); contact.ClipsToBounds = true; contact.BackgroundColor = UIColor.Clear; contact.TextColor = UIColor.Gray; contact.TextAlignment = UITextAlignment.Left; CGSize contactSize = this.measureLabel (contact); contact.Frame = new CGRect (23, yPos, contactSize.Width, contactSize.Height); yPos += (float)contactSize.Height + 20; this.View.AddSubview (contact); UILabel web = new UILabel (RectangleF.Empty); web.AttributedText = new NSAttributedString ( "http://www.syncfusion.com", underlineStyle: NSUnderlineStyle.Single); web.Lines = 1; web.Font = UIFont.FromName("Helvetica neue", 14f); web.ClipsToBounds = false; web.BackgroundColor = UIColor.Clear; web.TextColor = UIColor.FromRGB (137,137,137); web.TextAlignment = UITextAlignment.Left; CGSize webSize = this.measureLabel (web); web.Frame = new CGRect (23, yPos, webSize.Width+20, webSize.Height); web.UserInteractionEnabled = true; yPos += (float)webSize.Height+15; var tap = new UITapGestureRecognizer(); tap.AddTarget(() => UIApplication.SharedApplication.OpenUrl(new NSUrl(web.Text))); tap.NumberOfTapsRequired = 1; tap.DelaysTouchesBegan = true; web.AddGestureRecognizer(tap); View.AddSubview (web); UILabel support = new UILabel(RectangleF.Empty); support.Text = "*****@*****.**"; support.AttributedText = new NSAttributedString ( "*****@*****.**", underlineStyle: NSUnderlineStyle.Single); support.Lines = 1; support.Font = UIFont.FromName("Helvetica neue", 14f); support.ClipsToBounds = true; support.BackgroundColor = UIColor.Clear; support.TextColor = UIColor.FromRGB (137,137,137); support.TextAlignment = UITextAlignment.Left; CGSize supportSize = this.measureLabel (support); support.Frame = new CGRect (23, yPos, supportSize.Width, supportSize.Height); support.UserInteractionEnabled = true; yPos += (float)supportSize.Height+15; var tapSupport = new UITapGestureRecognizer(); tapSupport.AddTarget(() => UIApplication.SharedApplication.OpenUrl(new NSUrl("mailto:[email protected]"))); tapSupport.NumberOfTapsRequired = 1; tapSupport.DelaysTouchesBegan = true; support.AddGestureRecognizer(tapSupport); View.AddSubview (support); }
private void SetupGestureRecognizers() { TapGesture = new UITapGestureRecognizer (); TapGesture.AddTarget (() => CloseMenu()); TapGesture.NumberOfTapsRequired = 1; PanGesture = new UIPanGestureRecognizer { Delegate = new SlideoutPanDelegate(), MaximumNumberOfTouches = 1, MinimumNumberOfTouches = 1 }; PanGesture.AddTarget(() => Pan()); }
/// <summary> /// Initializes the control. /// </summary> void Initialize() { // Create the headerbuttons. var leftButton = UIButton.FromType(UIButtonType.Custom); var rightButton = UIButton.FromType(UIButtonType.Custom); // Create the list button. leftButton.Frame = new RectangleF(paddingX, paddingY, Theme.NavigationLeftIcon.Size.Width, Theme.NavigationLeftIcon.Size.Height); leftButton.SetImage(Theme.NavigationLeftIcon, UIControlState.Normal); this.Add(leftButton); // Create the info button. rightButton.Frame = new RectangleF(this.Bounds.Width - paddingX - Theme.NavigationRightIcon.Size.Width, paddingY, Theme.NavigationRightIcon.Size.Width, Theme.NavigationLeftIcon.Size.Height); rightButton.SetImage(Theme.NavigationRightIcon, UIControlState.Normal); this.Add(rightButton); // Create the title label. titleLabel = new UILabel() { Frame = new RectangleF(46, 10, 228, 22), TextColor = UIColor.White, Font = Theme.FontOfSize(17f), TextAlignment = UITextAlignment.Center, ShadowOffset = new SizeF(0, 1), ShadowColor = UIColor.Black, AdjustsFontSizeToFitWidth = true, Text = headerTitle }; // Create the title label. subtitleLabel = new UILabel() { Frame = new RectangleF(46, 30, 228, 22), TextColor = UIColor.White, Font = Theme.FontOfSize(12f), TextAlignment = UITextAlignment.Center, ShadowOffset = new SizeF(0, 1), ShadowColor = UIColor.Black, AdjustsFontSizeToFitWidth = true, Text = headerSubtitle }; // Add the labels to the header. this.Add(titleLabel); this.Add(subtitleLabel); // Makes sure that a tap on the header can be handled and bubble it up. var tap = new UITapGestureRecognizer(); tap.AddTarget(() => { Tapped(); }); this.AddGestureRecognizer(tap); }
public Pubnub_MessagingSub (string channelName, string cipher, bool enableSSL, Pubnub pubnub) : base (UITableViewStyle.Grouped, null) { Channel = channelName; Ssl = enableSSL; Cipher = cipher; this.pubnub = pubnub; string strSsl = ""; if (Ssl) { strSsl = "SSL,"; } string strCip = ""; if (!String.IsNullOrWhiteSpace (Cipher)) { strCip = "Cipher"; } string head = String.Format ("{0} {1}", strSsl, strCip); Section secAction = new Section (); bool bIphone = true; int viewHeight = 70; secAction.HeaderView = CreateHeaderView(viewHeight); secOutput = new Section("Output"); root = new RootElement (head) { secAction, secOutput }; Root = root; dvc = new DialogViewController (root, true); var tap = new UITapGestureRecognizer (); tap.AddTarget (() =>{ dvc.View.EndEditing (true); }); dvc.View.AddGestureRecognizer (tap); tap.CancelsTouchesInView = false; dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, delegate { pubnub.EndPendingRequests (); AppDelegate.navigation.PopToRootViewController(true); }); Menu = new SlideoutNavigationController (); Menu.TopView = dvc; Menu.MenuViewLeft = new LeftNavController (Menu, this); AppDelegate.navigation.PushViewController (Menu, true); Menu.ShowMenuLeft (); newChannels.Text = Channel; }
public override void ViewDidLoad() { base.ViewDidLoad(); IsOpen = true; var containerFrame = View.Bounds; containerFrame.X = View.Bounds.Width; ContainerView.Frame = containerFrame; ContainerView.BackgroundColor = UIColor.White; ContainerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; View.BackgroundColor = UIColor.White; _tapGesture = new UITapGestureRecognizer(); _tapGesture.AddTarget (() => Close(true)); _tapGesture.NumberOfTapsRequired = 1; _panGesture = new UIPanGestureRecognizer { Delegate = new PanDelegate(this), MaximumNumberOfTouches = 1, MinimumNumberOfTouches = 1 }; _panGesture.AddTarget (() => Pan (ContainerView)); ContainerView.AddGestureRecognizer(_panGesture); if (_menuViewController != null) SetMenuViewController(_menuViewController, false); if (_mainViewController != null) SetMainViewController(_mainViewController, false); //Create some shadowing if (ShadowEnabled) { ContainerView.Layer.ShadowOffset = new SizeF(-5, 0); ContainerView.Layer.ShadowPath = UIBezierPath.FromRect(ContainerView.Bounds).CGPath; ContainerView.Layer.ShadowRadius = 3.0f; ContainerView.Layer.ShadowColor = UIColor.Black.CGColor; } }