public override void LoadView () { View = new UIView (); View.BackgroundColor = UIColor.White; var imageView = new UIImageView (); imageView.ContentMode = UIViewContentMode.ScaleAspectFit; imageView.TranslatesAutoresizingMaskIntoConstraints = false; ImageView = imageView; View.Add (ImageView); var ratingControl = new RatingControl (); ratingControl.TranslatesAutoresizingMaskIntoConstraints = false; ratingControl.AddTarget (RatingChanges, UIControlEvent.ValueChanged); RatingControl = ratingControl; View.Add (RatingControl); var overlayButton = new OverlayView (); overlayButton.TranslatesAutoresizingMaskIntoConstraints = false; OverlayButton = overlayButton; View.Add (OverlayButton); UpdatePhoto (); View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("|[imageView]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "imageView", imageView)); View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:|[imageView]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "imageView", imageView)); View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("[ratingControl]-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "ratingControl", ratingControl)); View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("[overlayButton]-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "overlayButton", overlayButton)); View.AddConstraints (NSLayoutConstraint.FromVisualFormat ("V:[overlayButton]-[ratingControl]-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "overlayButton", overlayButton, "ratingControl", ratingControl)); var constraints = new List<NSLayoutConstraint> (); constraints.AddRange (NSLayoutConstraint.FromVisualFormat ("|-(>=20)-[ratingControl]", NSLayoutFormatOptions.DirectionLeadingToTrailing, "ratingControl", ratingControl)); constraints.AddRange (NSLayoutConstraint.FromVisualFormat ("|-(>=20)-[overlayButton]", NSLayoutFormatOptions.DirectionLeadingToTrailing, "overlayButton", overlayButton)); foreach (var constraint in constraints) constraint.Priority = (int)UILayoutPriority.Required - 1; View.AddConstraints (constraints.ToArray ()); }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell (CellIdentifier); string item = TableItems[indexPath.Row]; if(ContentItems!=null) item2 = ContentItems[indexPath.Row]; if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Default, CellIdentifier); } if (customise) { UIView centerview = new UIView (); centerview.Frame = cell.Frame; centerview.BackgroundColor = UIColor.White; UILabel ll = new UILabel (new CGRect (15, 2, 100, 20)); ll.Font= UIFont.FromName ("Helvetica", 15f); ll.Text = item; centerview.Add (ll); UILabel ll1 = new UILabel (new CGRect (15, 20, 300, 20)); ll1.Text = item2; ll1.Font= UIFont.FromName ("Helvetica", 13f); centerview.Add (ll1); cell.ContentView.Add (centerview); } else { cell.TextLabel.Text = item; } return cell; }
public override void LoadView () { var view = new UIView ().Apply (Style.Screen); view.Add (nameTextField = new TextField () { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "NewProjectNameHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), } .Apply (Style.NewProject.NameField)); nameTextField.EditingChanged += (sender, e) => ValidateProjectName (); view.Add (clientButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, } .Apply (Style.NewProject.ClientButton).Apply (Style.NewProject.NoClient)); clientButton.SetTitle ("NewProjectClientHint".Tr (), UIControlState.Normal); clientButton.TouchUpInside += OnClientButtonTouchUpInside; view.AddConstraints (VerticalLinearLayout (view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; var addBtn = new UIBarButtonItem ( "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnSetBtnPressed) .Apply (Style.NavLabelButton).Apply (Style.DisableNavLabelButton); addBtn.Enabled = false; NavigationItem.RightBarButtonItem = addBtn; }
public override void InitializeContent() { _TextField = new UITextField(new RectangleF(50, 10, 250, 30)); _Image = new UIImageView(new RectangleF(10, 10, 25, 25)); if (ViewModel != null) _Image.BackgroundColor = ViewModel.Color; base.InitializeContent(); ElementView = new UIView(RectangleF.Empty) { BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor }; ElementView.Add(_Image); ElementView.Add(_TextField); _TextField.EditingChanged += delegate { if (_TextField.Text.Length > 5) { ViewModel.Color = UIColor.Blue; } else { ViewModel.Color = UIColor.Red; } _Image.BackgroundColor = ViewModel.Color; }; if (ViewModel != null) _TextField.Text = ViewModel.Text; }
private RootElement GetRoot() { var rect = new RectangleF(PadX, 0, View.Bounds.Width - 30 - PadX * 2, 100); _detailView = new SeriesDetailView(_series, rect); _triangleView = new TriangleView (UIColor.FromRGB(247, 247, 247), UIColor.FromRGB (171, 171, 171)) { Frame = new RectangleF (43, _detailView.Bounds.Height - 7, 16, 8) }; _containerView = new UIView(rect); _containerView.Add(_detailView); _containerView.Add(_triangleView); var text = new StyledMultilineElement(_series.Description); text.TextColor = UIColor.DarkGray; text.LineBreakMode = UILineBreakMode.WordWrap; text.Font = UIFont.ItalicSystemFontOfSize(14); text.DetailColor = text.TextColor; var main = new Section(_containerView) { text }; var root = new RootElement("") { main }; return root; }
public override void LoadView () { var view = new UIView (); view.BackgroundColor = UIColor.White; ImageView = new UIImageView { ContentMode = UIViewContentMode.ScaleAspectFit, TranslatesAutoresizingMaskIntoConstraints = false }; view.Add (ImageView); NameLabel = new UILabel { Font = UIFont.PreferredHeadline, TranslatesAutoresizingMaskIntoConstraints = false }; view.Add (NameLabel); ConversationsLabel = new UILabel { Font = UIFont.PreferredBody, TranslatesAutoresizingMaskIntoConstraints = false }; view.Add (ConversationsLabel); PhotosLabel = new UILabel { Font = UIFont.PreferredBody, TranslatesAutoresizingMaskIntoConstraints = false }; view.Add (PhotosLabel); View = view; UpdateUser (); UpdateConstraintsForTraitCollection (TraitCollection); }
public static UIView CreateToolbarTextImageIcon(string label, EventHandler action, UIImage iconImage, UIColor textColor, float width = 60) { float height = 30; float iconSize = 20; float iconMargin = 5; UILabel lb = new UILabel() { Font = UIFont.SystemFontOfSize(14), TextColor = textColor, Text = label, BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Left }; lb.SizeToFit(); int x = (int)(iconSize + (iconMargin * 2)); int y = (int)((height - lb.Frame.Height) / 2); lb.Frame = new RectangleF (x, y, width-y, lb.Frame.Height); UIButton btn = new UIButton(UIButtonType.Custom); btn.Frame = new RectangleF(0, 0, width, height); if (action != null) btn.TouchUpInside += action; UIImageView iv = new UIImageView(iconImage); iv.Frame = new RectangleF(iconMargin, iconMargin, iconSize, iconSize); UIView container = new UIView(new RectangleF(0, 0, width, height)); container.Add(iv); container.Add(btn); container.Add(lb); return container; }
public FABarButtonItem(FA icon, string title, UIColor fontColor, EventHandler handler) : base() { UIView view = new UIView (new CGRect (0, 0, 32, 32)); _iconButton = new UIButton (new CGRect (0, 0, 32, 21)) { Font = icon.Font (20), }; _iconButton.SetTitleColor (fontColor, UIControlState.Normal); _iconButton.TouchUpInside += handler; _titleLabel = new UILabel (new CGRect (0, 18, 32, 10)) { TextColor = fontColor, Font = UIFont.SystemFontOfSize(10f), TextAlignment = UITextAlignment.Center }; this.Title = title; this.Icon = icon.String(); view.Add (_iconButton); view.Add (_titleLabel); CustomView = view; }
public override void LoadView () { var view = new UIView ().Apply (Style.Screen); view.Add (nameTextField = new TextField () { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString ( "NewProjectNameHint".Tr (), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder (), }.Apply (Style.NewProject.NameField).Apply (BindNameField)); nameTextField.EditingChanged += OnNameFieldEditingChanged; view.Add (clientButton = new UIButton () { TranslatesAutoresizingMaskIntoConstraints = false, }.Apply (Style.NewProject.ClientButton).Apply (BindClientButton)); clientButton.TouchUpInside += OnClientButtonTouchUpInside; view.AddConstraints (VerticalLinearLayout (view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; NavigationItem.RightBarButtonItem = new UIBarButtonItem ( "NewProjectAdd".Tr (), UIBarButtonItemStyle.Plain, OnNavigationBarAddClicked) .Apply (Style.NavLabelButton); }
public override void LoadView() { var view = new UIView(UIScreen.MainScreen.ApplicationFrame) { BackgroundColor = FlatUI.Color.Clouds, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; bbi = new UIBarButtonItem("New", UIBarButtonItemStyle.Plain, HandleTouchUpInside); NavigationItem.RightBarButtonItem = bbi; btnShadowed = new FUIShadowedButton(new RectangleF(50, 50, 320 - 100, 44), FlatUI.Color.PeterRiver, FlatUI.Color.PeterRiver.Darken(1)); btnShadowed.SetTitle("Shadowed", UIControlState.Normal); view.Add(btnShadowed); btnFlat = new FUIButton(new RectangleF(50, 120, 320 - 100, 44), FlatUI.Color.PeterRiver, FlatUI.Color.PeterRiver.Darken(1)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth, Font = FlatUI.BoldFontOfSize(19) }; btnFlat.SetTitle("Flat", UIControlState.Normal); view.Add(btnFlat); this.View = view; }
public RootElement GetRoot() { CreateTweetView("..."); var width = View.Bounds.Width - 30 - PadX * 2; var frame = new RectangleF(PadX, 0, width, 100); var headerView = new UIView(frame); _view = new BioView(_bio, frame, true); headerView.Add(_view); // Speech bubble triangle var triangleFrame = new RectangleF(Util.IsPad() ? 63 : 43, _view.Bounds.Height - 7, 16, 8); var triangle = new TriangleView (UIColor.FromRGB(247, 247, 247), UIColor.FromRGB(171, 171, 171)) { Frame = triangleFrame }; headerView.Add(triangle); _view.UrlTapped += delegate { WebViewController.OpenUrl(this, _bio.Url); }; _main = new Section(headerView) { _tweetBox }; var text = new StyledMultilineElement(AppManifest.Current.Biography); text.TextColor = UIColor.DarkGray; text.LineBreakMode = UILineBreakMode.WordWrap; text.Font = UIFont.ItalicSystemFontOfSize(15); text.DetailColor = text.TextColor; text.SelectionStyle = UITableViewCellSelectionStyle.None; var secondary = new Section("About " + AppManifest.Current.FirstName) { text }; var root = new RootElement("Bio") { _main, secondary }; // Required for resizing bubble for new tweets root.UnevenRows = true; return root; }
public override void InitializeContent() { ContentView = new UIView() { Opaque = false, BackgroundColor = UIColor.Clear }; YearLabel = new UILabel(Cell.Bounds) { Opaque = false, BackgroundColor = UIColor.Clear }; ContentView.Add(YearLabel); }
public override void Draw (RectangleF bounds, CGContext context, UIView view) { //UIColor.White.SetFill (); //context.FillRect (bounds); try { UIView searchView = view.ViewWithTag(1); if (searchView == null) { var photoCellView = new PhotoCellView(_images, cellIndex, null); photoCellView.Tag = 1; view.Add(photoCellView); } else { var photoCellView = (PhotoCellView)searchView; photoCellView.Update(_images, cellIndex); photoCellView.DrawBorder(UIColor.Green); } } catch (Exception ex) { Util.LogException("Draw ImagesElement", ex); } }
public Layer(UIView parent) : base(CGRect.Empty) { parent.Add (this); // make all layers receive touches UserInteractionEnabled = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); if (RespondsToSelector(new Selector("edgesForExtendedLayout"))) EdgesForExtendedLayout = UIRectEdge.None; var source = new MvxStandardTableViewSource(TableView, UITableViewCellStyle.Subtitle, new NSString("sub"), "TitleText PriceText;ImageUrl ImageUri;DetailText DetailsText", UITableViewCellAccessory.DisclosureIndicator); TableView.Source = source; var set = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>(); set.Bind(source).To(vm => vm.Properties); set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.PropertiesSelectedCommand); set.Bind(this).For(s => s.Title).To(vm => vm.Title); var myFooter = new UIView(new RectangleF(0, 0, 320, 40)); UIButton loadMoreButton = new UIButton(new RectangleF(0, 0, 320, 40)); loadMoreButton.SetTitle("Load More", UIControlState.Normal); loadMoreButton.SetTitleColor(UIColor.Black, UIControlState.Normal); set.Bind(loadMoreButton).To(vm => vm.LoadMoreCommand); set.Bind(loadMoreButton).For("Title").To(vm => vm.Title); myFooter.Add(loadMoreButton); TableView.TableFooterView = myFooter; set.Apply(); TableView.ReloadData(); ViewModel.WeakSubscribe(PropertyChanged); NavigationItem.BackBarButtonItem = new UIBarButtonItem("Results", UIBarButtonItemStyle.Bordered, BackButtonEventHandler); }
RootElement CreateRoot () { return new RootElement ("Settings") { new Section (){ new StringElement ("mes photos" /*, el => { int userId = AppDelegateIPhone.AIphone.MainUser.Id; return new MembersPhotoViewControler(AppDelegateIPhone.meNavigationController, userId); } */, ()=> { Action act = ()=> { int userId = AppDelegateIPhone.AIphone.MainUser.Id; var m = new MembersPhotoViewControler(AppDelegateIPhone.meNavigationController, userId, false); //this.PresentModalViewController(m, true); AppDelegateIPhone.meNavigationController.PushViewController(m, false); var view = new UIView(); var btn = UIButton.FromType(UIButtonType.Custom); btn.Frame = new RectangleF(0, -13, 26, 26); btn.SetBackgroundImage(Graphics.GetImgResource("back"), UIControlState.Normal); view.Add(btn); }; AppDelegateIPhone.ShowRealLoading(View, "Loading photos", null, act); } ), new StringElement ("mon profile"), new StringElement("mes autres reseaux"), } }; }
public object GetContent(ButtonConfig okButtonConfig) { var panel = new UIView(); panel.Frame = new CGRect(0, 0, 200, 50); var label = new UILabel(); label.Text = "Do you agree?"; label.SizeToFit(); label.AdjustsFontSizeToFitWidth = true; panel.Add(label); var uiSwitch = new UISwitch(); uiSwitch.Frame = new CGRect(200, 0, 27, 27); uiSwitch.ValueChanged += (o, args) => { okButtonConfig.IsEnabled = uiSwitch.On; }; panel.Add(uiSwitch); return panel; }
public IncrementalLoadingViewModel () { border = new UIView (); this.lable = new UILabel (); this.loaderindicator = new UIActivityIndicatorView (); this.loaderindicator.Color = UIColor.FromRGB (255, 255, 255); border.BackgroundColor = UIColor.FromRGB(70, 183, 118); border.Add (lable); border.Add (loaderindicator); string uri = "http://services.odata.org/Northwind/Northwind.svc/"; if (CheckConnection (uri).Result) { gridSource = new IncrementalList<Order> (LoadMoreItems) { MaxItemCount = 1000 }; northwindEntity = new NorthwindEntities (new Uri (uri)); } else { NoNetwork = true; IsBusy = false; } }
public void Show(UIView container) { RemoveFromSuperview(); container.Add(this); // reset foreach (var s in Subviews) s.RemoveFromSuperview(); Frame = container.Bounds; // configurable bits BackgroundColor = UIColor.White; AutoresizingMask = UIViewAutoresizing.All; var centeredBox = new UIView(new RectangleF(0,0,Frame.Width, 100)); centeredBox.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; centeredBox.Center = new PointF(Frame.Width / 2, Frame.Height / 2); // create the activity spinner, center it horizontall and put it 5 points above center x activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); activitySpinner.Color = Application.ThemeColors.Main; activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; activitySpinner.Center = new PointF(centeredBox.Frame.Width / 2, (centeredBox.Frame.Height / 2) - 60); centeredBox.Add(activitySpinner); activitySpinner.StartAnimating (); // create and configure the "Loading Data" label loadingLabel = new UILabel(); loadingLabel.BackgroundColor = UIColor.Clear; loadingLabel.Font = Application.ThemeColors.MenuFont; loadingLabel.TextColor = Application.ThemeColors.Main2; loadingLabel.Text = LoadingText; loadingLabel.TextAlignment = UITextAlignment.Center; loadingLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; loadingLabel.Frame = new RectangleF(0, 0, centeredBox.Frame.Width, 50); loadingLabel.Center = new PointF(centeredBox.Frame.Width / 2, centeredBox.Frame.Height / 2); centeredBox.Add(loadingLabel); Add(centeredBox); }
/* public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { base.Selected (dvc, tableView, path); } */ public override void Draw (RectangleF bounds, CGContext context, UIView view) { UIColor.White.SetFill (); context.FillRect (bounds); RectangleF frame = _inviteButton.Frame; frame.X = view.Frame.Width - frame.Width - 10; _inviteButton.Frame = frame; view.Add(_inviteButton); if (userImage != null) { //context.DrawImage(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35), userImage.CGImage); userImage.Draw(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35)); } if (graph.ContainsKey(_User.id)) _User = graph[_User.id]; UIColor.Black.SetColor (); if (_User.name != null) { view.DrawString(_User.name, new RectangleF(50, 5, bounds.Width/2, 10 ), fromFont, UILineBreakMode.TailTruncation); if (userImage == null) { userImage = ImageStore.RequestFullPicture((long)_User.id, (long)_User.id, SizeDB.SizeFacebook, this); userImage = userImage ?? ImageStore.EmptyProfileImage; userImage = UIImageUtils.resizeImage(userImage, new SizeF (35, 35)); userImage = GraphicsII.RemoveSharpEdges(userImage); if (userImage != null) userImage.Draw(new RectangleF((_height - 35)/2, (_height - 35)/2, 35, 35)); } } else { ThreadPool.QueueUserWorkItem(o => { GraphUser gUser = AppDelegateIPhone.AIphone.FacebookServ.GetFriend(_User.id); if (gUser == null) return; lock (lock_graph) { graph[gUser.id] = gUser; } if (gUser.id == _User.id) { _User = gUser; nss.InvokeOnMainThread(()=> view.SetNeedsDisplay()); } }); } }
public override void ViewDidLoad() { View = new UIView(){ BackgroundColor = UIColor.White}; base.ViewDidLoad(); // ios7 layout if (RespondsToSelector(new Selector("edgesForExtendedLayout"))) EdgesForExtendedLayout = UIRectEdge.None; var enterPhonewordLabel = new UILabel(new RectangleF(20, 80, 280, 21)); enterPhonewordLabel.Text = "Enter a Phoneword:"; View.Add(enterPhonewordLabel); var phoneNumberText = new UITextField(new RectangleF(20, 119, 280, 30)); phoneNumberText.BorderStyle = UITextBorderStyle.RoundedRect; phoneNumberText.Text = "1-855-CALLME"; View.Add(phoneNumberText); var translateButton = UIButton.FromType(UIButtonType.RoundedRect); translateButton.Frame = new RectangleF(20, 192, 280, 30); translateButton.SetTitle("Translate", UIControlState.Normal); View.Add(translateButton); var callButton = UIButton.FromType(UIButtonType.RoundedRect); callButton.Frame = new RectangleF(20, 269, 280, 30); callButton.SetTitle("Call", UIControlState.Normal); callButton.Enabled = false; View.Add(callButton); var callHistoryButton = UIButton.FromType(UIButtonType.RoundedRect); callHistoryButton.Frame = new RectangleF(20, 346, 280, 30); callHistoryButton.SetTitle("Call History", UIControlState.Normal); View.Add(callHistoryButton); var set = this.CreateBindingSet<HomeView, Core.ViewModels.HomeViewModel>(); set.Bind(phoneNumberText).To(vm => vm.PhoneNumber); set.Bind(translateButton).To(vm => vm.TranslateNumberCommand); set.Bind(callButton).To(vm => vm.MakePhoneCallCommand); set.Bind(callHistoryButton).To(vm => vm.CallHistoryCommand); set.Bind(callButton).For("Title").To(vm => vm.CallButtonText); set.Apply(); }
public MoreScreenCell(UITableViewCellStyle style, string cellIdentifier) : base(style, cellIdentifier) { SelectionStyle = UITableViewCellSelectionStyle.Gray; ContentView.BackgroundColor = UIColor.Clear; lb_item = new UILabel () { BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("HelveticaNeue-Light", 14f), TextColor = UIColor.Black }; btn_Right = UIButton.FromType(UIButtonType.Custom); btn_Right.SetImage (UIImage.FromFile ("ic_right_arrow_thin.png"), UIControlState.Normal); cellView = new UIView (new CGRect( 40, 0, ContentView.Bounds.Width-40, ContentView.Bounds.Height)); cellView.Add (lb_item); cellView.Add (btn_Right); ContentView.AddSubviews(cellView); }
public override void ViewDidLoad() { base.ViewDidLoad (); _view = new UIView(); _view.BackgroundColor = UIColor.GroupTableViewBackgroundColor; UILabel label = new UILabel(); label.Text = _stopInfo.StopName; label.BackgroundColor = UIColor.GroupTableViewBackgroundColor; label.SizeToFit(); label.Frame = new RectangleF(10,0, 300, 40); _view.Add(label); UIButton button = UIButton.FromType(UIButtonType.RoundedRect); button.SetTitle("Legg til i favoritter", UIControlState.Normal);; button.Frame = new RectangleF(10, 120, 150, 50); _view.Add(button); _view.SizeToFit(); button.TouchUpInside += delegate { _busStopRepository.AddFavorite(_stopInfo); }; webView = new UIWebView { ScalesPageToFit = false }; webView.LoadHtmlString (FormatText (), new NSUrl ()); // Set the web view to fit the width of the app. webView.SizeToFit (); // Reposition and resize the receiver _view.Frame = new RectangleF (0, 0, this.View.Bounds.Width, this.View.Bounds.Height); // Add the table view as a subview this.View.AddSubview (_view); }
public PickerAlert(string[] values, int currentSelected, Action<int> selected) : base(new RectangleF(0, 0, 320f, 480f)) { AutosizesSubviews = true; this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; _values = values; _currentSelected = currentSelected; _selected = selected; _pickerView = new UIPickerView(); _pickerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _pickerView.ShowSelectionIndicator = true; _pickerView.Model = new PickerModel(values); _pickerView.BackgroundColor = UIColor.FromRGB(244, 244, 244); _pickerView.Select(currentSelected, 0, false); _toolbar = new UIToolbar(); _toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; _toolbar.Items = new UIBarButtonItem[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => { _selected(_pickerView.SelectedRowInComponent(0)); Dismiss(); }) }; _innerView = new UIView(new RectangleF(0, Frame.Height, Frame.Width, 44f + _pickerView.Frame.Height)); _innerView.AutosizesSubviews = true; _innerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; _toolbar.Frame = new RectangleF(0, 0, Frame.Width, 44f); _innerView.Add(_toolbar); _pickerView.Frame = new RectangleF(0, 44f, Frame.Width, _pickerView.Frame.Height); _innerView.Add(_pickerView); Add(_innerView); }
private void SetupUserInterface () { NavigationController.NavigationBarHidden = true; mainView = new UIView { Frame = new CGRect (0, 0, 320, View.Frame.Height), UserInteractionEnabled = true }; hamburgerMenu = new UIButton { Frame = new CGRect (10, 10, 25, 25) }; hamburgerMenu.SetImage (UIImage.FromFile ("HamburgerMenu.png"), UIControlState.Normal); hamburgerMenu.TouchUpInside += (sender, e) => { flyout.ToggleMenu (); }; // In the three steps below, each of the views take up 1/3 of the main view // Step 1: Choose a make. makeView = new MakeView (View.Frame, this) { Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height/3) }; // Step 2: Choose a year. yearView = new YearView (View.Frame, this) { Frame = new CGRect (0, View.Bounds.Height/3, View.Bounds.Width, View.Bounds.Height/3) }; // Step 3: Choose a part name. partNameView = new PartNameView (View.Frame, this) { Frame = new CGRect (0, View.Bounds.Height * 2/3, View.Bounds.Width, View.Bounds.Height/3) }; mainView.Add (makeView); mainView.Add (hamburgerMenu); mainView.Add (yearView); mainView.Add (partNameView); View.Add (mainView); }
private void InitWheel() { var sectionNumber = _settings.Slices.Count; _container = new UIView(Frame); _slices = new List<WheelSlice>(sectionNumber); var angleSize = (float)(2 * Math.PI / sectionNumber); for (int i = 0; i < sectionNumber; i++) { var imageView = new UIImageView(_settings.SegmentImage); imageView.Layer.AnchorPoint = new PointF(1.0f, 0.5f); var slicePosX = (float)(_container.Bounds.Size.Width / (2.0 - _container.Frame.X)); var slicePosY = (float)(_container.Bounds.Size.Height / 2.0 - _container.Frame.Y); imageView.Layer.Position = new PointF(slicePosX, slicePosY); imageView.Transform = CGAffineTransform.MakeRotation(angleSize * i); imageView.Alpha = _minAlphaValue; imageView.Tag = i; if (i == 0) { imageView.Alpha = _maxAlphaValue; } var sliceImageView = new UIImageView(new RectangleF(12, 15, 40, 40)); var sliceImage = _settings.Slices[i].Image; sliceImageView.Image = sliceImage; imageView.Add(sliceImageView); _container.Add(imageView); } _container.UserInteractionEnabled = false; Add(_container); var backgroundView = new UIImageView(Frame) { Image = _settings.BackgroundImage }; Add(backgroundView); var mask = new UIImageView(new RectangleF(0, 0, 58, 58)) { Image = _settings.CenterButtonImage, Center = Center }; mask.Center = new PointF(mask.Center.X, mask.Center.Y + 3); Add(mask); if (sectionNumber % 2 == 0) { BuildSlicesEvenly(); } else { BuildSlicesUnEvenly(); } //SliceDidChanged(this, new SliceDidChangedEventArgs { Value = _settings.Slices[0].Value }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var frame = View.Frame; frame.Width = 200; View.Frame = frame; TableView.ScrollEnabled = false; var binder = this.CreateBindingSet<MenuView, MenuViewModel>(); Func<string, string, Expression<Func<MenuViewModel, object>>, StyledStringElement> createElement = (text, imageFileName, property) => { var element = new StyledStringElement(text) { Accessory = UITableViewCellAccessory.DisclosureIndicator, ShouldDeselectAfterTouch = true, Image = UIImage.FromFile(imageFileName), BackgroundColor = AppStyles.MenuCellBackgroundColor }; binder.Bind(element) .For(el => el.SelectedCommand) .To(property); return element; }; Root = new RootElement("") { new Section { createElement("Overview", "home.png", vm => vm.ShowOverviewCommand), createElement("Full Schedule", "clock.png", vm => vm.ShowSessionsCommand), createElement("Speakers", "users.png", vm => vm.ShowSpeakersCommand), createElement("Sponsors", "sponsors.png", vm => vm.ShowSponsorsCommand), createElement("Facility Map", "map.png", vm => vm.ShowMapCommand) } }; var headerView = new UIView(new RectangleF(0, 0, View.Frame.Width, 60)); headerView.Add(new UILabel(new RectangleF(15, 0, headerView.Frame.Width - 15, headerView.Frame.Height)) { Text = "NYC Code Camp 8", Font = UIFont.FromName("HelveticaNeue-Bold", 18), BackgroundColor = UIColor.Clear, TextColor = AppStyles.StandardTextColor }); TableView.TableHeaderView = headerView; binder.Apply(); }
public void CanGetParentController() { var controller = new UIViewController(); var view1 = new UIView(); controller.View.Add(view1); var view2 = new UIView(); view1.Add(view2); Assert.IsTrue(view1.ParentController() == controller); Assert.IsTrue(view2.ParentController() == controller); }
public DetailScreenCell(UITableViewCellStyle style, string cellIdentifier) : base(style, cellIdentifier) { SelectionStyle = UITableViewCellSelectionStyle.Gray; ContentView.BackgroundColor = UIColor.Clear; lb_Detail = new UITextView () { BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Left, //MinimumFontSize = 10f, Font = UIFont.FromName("HelveticaNeue-Light", 14f), //Lines = 4 , Editable = false, TintColor = UIColor.FromRGB(126,126,126) }; lb_Hours = new UILabel () { BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("HelveticaNeue-Light", 12f), TextColor = UIColor.FromRGB(186,186,186) }; lb_number = new UILabel () { BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Center, TextColor = UIColor.FromRGB(45,154,212) }; sipperReplyIcon = new UIImageView (); sipperReplyIcon.Image = UIImage.FromFile ("ic_peek_violet.png"); cellView = new UIView (new CGRect( 10, 10, ContentView.Bounds.Width-50, ContentView.Bounds.Height-20)); cellView.Add (lb_Detail); cellView.Add (lb_Hours); cellView.Add (sipperReplyIcon); cellView.Add (lb_number); ContentView.AddSubviews(cellView); }
private void AddButtonShowMore() { var button = CreateButton(); var buttonContainer = new UIView(new RectangleF(0, 0, 320, 60)); buttonContainer.Add(button); TableWithTweets.TableFooterView = buttonContainer; button.TouchUpInside += (s, e) => { AddTwittsAsync(); }; }
void HandleBrowsingCompleted(object sender, EventArgs e) { activity.StopAnimating(); if (!webViewVisible) { return; } if (authenticatingView == null) { authenticatingView = new UIView(View.Bounds) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, BackgroundColor = UIColor.FromRGB(0x33, 0x33, 0x33), }; progress = new ProgressLabel("Authenticating..."); var f = progress.Frame; var b = authenticatingView.Bounds; f.X = (b.Width - f.Width) / 2; f.Y = (b.Height - f.Height) / 2; progress.Frame = f; authenticatingView.Add(progress); } else { authenticatingView.Frame = View.Bounds; } webViewVisible = false; progress.StartAnimating(); UIView.Transition( fromView: webView, toView: authenticatingView, duration: TransitionTime, options: UIViewAnimationOptions.TransitionCrossDissolve, completion: null); }
public override void LoadView() { var view = new UIView().Apply(Style.Screen); view.Add(NameTextField = new TextField { TranslatesAutoresizingMaskIntoConstraints = false, AttributedPlaceholder = new NSAttributedString( "NewClientNameHint".Tr(), foregroundColor: Color.Gray ), ShouldReturn = (tf) => tf.ResignFirstResponder(), }.Apply(Style.NewProject.NameField)); NameTextField.EditingChanged += (sender, e) => ValidateClientName(); view.AddConstraints(VerticalLinearLayout(view)); EdgesForExtendedLayout = UIRectEdge.None; View = view; NavigationItem.RightBarButtonItem = new UIBarButtonItem( "NewClientAdd".Tr(), UIBarButtonItemStyle.Plain, OnNavigationBarAddClicked) .Apply(Style.DisableNavLabelButton); }
UIView get2images(nfloat pos, int pi, int pf) { var images = new UIView(new CGRect(margin, pos, 800, height1)); for (int i = pi; i <= pf; i++) { var img = new UIImageView(new CGRect(i * (width1 + separation), 0, width1, height1)); img.ContentMode = UIViewContentMode.ScaleAspectFill; img.Layer.MasksToBounds = true; //img.Image = UIImage.FromFile ("MyImage.png"); img.BackgroundColor = UIColor.Gray; YConstants.DownloadImageAsync(source.Itemize[i].ImageUrl).ContinueWith((task) => InvokeOnMainThread(() => { try { img.Image = task.Result; } catch { } })); SetNeedsDisplay(); images.Add(img); } return(images); }
void initWorkView() { workView = new UIView(new CGRect(0, v_pos, v_width, v_height)) { BackgroundColor = UIColor.White }; secondView.Add(workView); workScroll = new UIScrollView(new CGRect(0, 0, v_width, v_height)) { BackgroundColor = UIColor.Clear }; //workScroll.ShowsVerticalScrollIndicator = false; workView.Add(workScroll); workView.Layer.ZPosition = 1; workView.Alpha = 0; //tmp nfloat tx, ty = 0, tdelta = 48, th = 150; for (int i = 0; i < 8; i++) { ty = tdelta * (i / 2 + 1) + th * (nfloat)Math.Floor((double)i / 2); if (i % 2 == 0) { tx = 80; } else { tx = 358; } HomeworkThumb lo = new HomeworkThumb(tx, ty); workScroll.Add(lo); workScroll.ContentSize = new CGSize(v_width, ty + th + tdelta); } }
void AddButtons(List <UIButton> buttons) { if (buttons == null || (buttons.Count == 0)) { return; } float spacing = 10f; float height = 44f; float width = (buttons.Count * 44) + ((buttons.Count - 1) * spacing); var rect = new CGRect((Frame.Width - width) / 2, (Frame.Height - height) / 2, width, height); _buttonContainer = new UIView(rect); _buttonContainer.AutoresizingMask = UIViewAutoresizing.FlexibleMargins; for (int i = 0; i < buttons.Count; i++) { UIButton button = buttons[i]; button.Frame = new CGRect(54 * i, 0, button.Frame.Width, button.Frame.Height); _buttonContainer.Add(button); } Add(_buttonContainer); }
void HandleBrowsingCompleted(object sender, EventArgs e) { if (authenticatingView == null) { authenticatingView = new UIView(Bounds) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, BackgroundColor = UIColor.FromRGB(0x33, 0x33, 0x33), }; progress = new ProgressLabel("Authenticating..."); var f = progress.Frame; var b = authenticatingView.Bounds; f.X = (b.Width - f.Width) / 2; f.Y = (b.Height - f.Height) / 2; progress.Frame = f; authenticatingView.Add(progress); } else { authenticatingView.Frame = Bounds; } progress.StartAnimating(); }
protected sealed override List <UIView> ControllsToAdd() { _postText = new FeedWebView(); _postText.ScrollView.ScrollEnabled = false; _postText.ScrollView.Bounces = false; _postText.AllowsLinkPreview = false; _postText.LoadFinished += WebViewOnLoadFinished; _heightConstraint = NSLayoutConstraint.Create(_postText, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 40); _postText.AddConstraint(_heightConstraint); _childContentContainer = new UIView { BackgroundColor = UIColor.Clear }; foreach (var addChildControl in AddChildControls()) { _childContentContainer.Add(addChildControl); } return(new List <UIView> { _postText, _childContentContainer }); }
void initInputRegText() { //nombre regNameView = getRoundBoardView(334, 337, 358, 58); regNameInput = getInputText(32, 20, 290, 22, "Nombre", "HelveticaNeue"); regNameInput.AutocapitalizationType = UITextAutocapitalizationType.None; regNameView.Add(regNameInput); regView.Add(regNameView); regNameInput.Started += RegInput_Started; regNameInput.Ended += RegInput_Ended; //user regUserView = getRoundBoardView(334, 404, 358, 58); regUserInput = getInputText(32, 20, 290, 22, "Usuario", "HelveticaNeue"); regUserView.Add(regUserInput); regUserInput.AutocapitalizationType = UITextAutocapitalizationType.None; regView.Add(regUserView); regUserInput.Started += RegInput_Started; regUserInput.Ended += RegInput_Ended; //email regEmailView = getRoundBoardView(334, 472, 358, 58); regEmailInput = getInputText(32, 20, 290, 22, "Direccion de correo", "HelveticaNeue"); regEmailView.Add(regEmailInput); regView.Add(regEmailView); regEmailInput.Started += RegInput_Started; regEmailInput.Ended += RegInput_Ended; //password regPassView = getRoundBoardView(334, 540, 358, 58); regPassInput = getInputText(32, 20, 290, 22, "Contrasena", "HelveticaNeue"); regPassInput.AutocapitalizationType = UITextAutocapitalizationType.None; regPassView.Add(regPassInput); regView.Add(regPassView); regPassInput.Started += RegInput_Started; regPassInput.Ended += RegInput_Ended; }
/// <summary> /// По TCellModel создает Cells и биндит их с данными. /// </summary> /// <returns> /// Вернет View с колонками, количество определяется количеством полей в TCellModel. /// Стилизовать внутри функции. /// </returns> public UIView CreateCells() { var view = new UIView(); for (int i = 0; i < fieldsTModel.Count; i++) { var itemLabel = new UILabel(new CGRect(1 + 80 * i, 1, 80, 20)); this.CreateStyle(itemLabel); view.Add(itemLabel); var j = i; this.baseViewCell.DelayBind( () => { var set = this.baseViewCell.CreateBindingSet <TCell, TCellModel>(); set.Bind(itemLabel).To(this.fieldsTModel[j]); set.Apply(); }); #region Пример использования замыкания в DelayBind() //this.self.DelayBind( // ((Func<int, Action>)((ind) => // () => // { // var set = this.self.CreateBindingSet<TCell, TModel>(); // set.Bind(itemLabel).To(this.fieldsTModel[ind]); // set.Apply(); // } // ))(i) // ); #endregion } return(view); }
void addTopView() { //top topView = new UIView(new CGRect(0, 410, 1024, 122)); //topView.BackgroundColor = UIColor.Red; contentView.Add(topView); var topImage = new UIImageView(new CGRect(0, 0, 1024, 122)); topView.ContentMode = UIViewContentMode.ScaleToFill; topView.Layer.MasksToBounds = true; topImage.Image = UIImage.FromFile("efiles/topwhite.png"); topView.Add(topImage); numberView = new UIView(new CGRect(54, 76, 40, 40)); numberView.Layer.CornerRadius = 20; numberView.Layer.MasksToBounds = true; topView.Add(numberView); numberLabel = new UILabel(new CGRect(0, 3, 40, 36)) { Text = "1", TextColor = UIColor.White, Font = UIFont.FromName("HelveticaNeue", 24), TextAlignment = UITextAlignment.Center }; numberView.Add(numberLabel); titleLabel = new UILabel(new CGRect(104, 90, 600, 24)) { Text = "FAUNA AMAZONICA", TextColor = UIColor.White, Font = UIFont.FromName("HelveticaNeue", 22), TextAlignment = UITextAlignment.Left }; topView.Add(titleLabel); }
public static UIStatusBarView CreateAndAddTo(UIView viewToAddTo) { var statusBar = new UIStatusBarView() { TranslatesAutoresizingMaskIntoConstraints = false }; viewToAddTo.Add(statusBar); statusBar.StretchWidth(viewToAddTo); statusBar.PinToTop(viewToAddTo); // https://stackoverflow.com/questions/46344381/ios-11-layout-guidance-about-safe-area-for-iphone-x if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { statusBar.BottomAnchor.ConstraintEqualTo(viewToAddTo.SafeAreaLayoutGuide.TopAnchor) }); } else { statusBar.ConfigureHeight(); } return(statusBar); }
/// <summary> /// Gets the view for header. /// </summary> /// <returns>The view for header.</returns> /// <param name="tableView">Table view.</param> /// <param name="section">Section.</param> public override UIView GetViewForHeader(UITableView tableView, nint section) { // if (section == 0) { return(null); } // var view = new UIView(new CGRect(0, 0, tableView.Frame.Size.Width, 34)); view.BackgroundColor = UIColor.FromRGBA(167 / 255.0f, 167 / 255.0f, 167 / 255.0f, 0.6f); UILabel label = new UILabel(new CGRect(10, 8, 0, 0)); label.Text = @"Friends Online"; label.Font = UIFont.SystemFontOfSize(15); label.TextColor = UIColor.White; label.BackgroundColor = UIColor.Clear; label.SizeToFit(); view.Add(label); return(view); }
public static ToastMessageBar DisplayInfoBar(UIView view, String title = "", String description = "", int seconds = 5 , Action actionOnDisolve = null, Action actionOnTap = null, Action actionOnSwipe = null) { actualMessageBar?.Remove(); int barWidth = (int)view.Frame.Width - 20; int yLoc = OSHelper.deviceHasNotch() ? 100 : 70; ToastMessageBar toastMessageBar = new ToastMessageBar(10, yLoc, seconds, title, description, new UIImage("Icons/mb-info.png"), barWidth); toastMessageBar.BackgroundColor = UIColor.Blue; toastMessageBar.OnTap = actionOnTap; toastMessageBar.OnSwipe = actionOnSwipe; toastMessageBar.OnDisolve = actionOnDisolve; view.Add(toastMessageBar); view.BringSubviewToFront(toastMessageBar); actualMessageBar = toastMessageBar; return(toastMessageBar); }
private void SetupUserInterface() { var frame = View.Frame; var tabBarFrame = TabBar.Frame; var topButtonY = View.Bounds.Bottom - 50; var topLeftX = View.Bounds.X + 25; _playerBar = new UIView() { Frame = new CGRect(frame.Left, 0, frame.Width, 50) }; _playButton = new UIButton() { Frame = new CGRect(topLeftX, topButtonY, 37, 37) }; _playButton.SetBackgroundImage(UIImage.FromFile("NoFlashButton.png"), UIControlState.Normal); _playerBar.Add(_playButton); View.Add(_playerBar); }
void initSignFacebook() { signFaceView = new UIView(new CGRect(332, 628, 360, 56)); signFaceView.Alpha = 0; //mainView.Add (signFaceView); signFaceView.Add(new UIImageView(new CGRect(0, 0, 360, 56)) { //Image = UIImage.FromFile(filepath + "signupface.png"), ContentMode = UIViewContentMode.ScaleAspectFit }); //Go to Facebook Action action = async() => { //await Authenticate(MobileServiceAuthenticationProvider.Facebook); }; var tapgest = new UITapGestureRecognizer(action) { NumberOfTapsRequired = 1 }; signFaceView.AddGestureRecognizer(tapgest); }
public void ElementSizeChanged(double w, double h) { if (oglView != null) { // // 現在のOGLViewを削除 oglView.RemoveFromSuperview(); oglView.Dispose(); oglView = null; } oglView = new OGLView(new CGRect(0, 0, w, h)) { Sphere = ((EquirectanglarView)Element).Sphere, VertexShader = ((EquirectanglarView)Element).VertexShader, FragmentShader = ((EquirectanglarView)Element).FragmentShader, TextureImage = ((EquirectanglarView)Element).TextureImage }; baseView.Add(oglView); // // iOSでは iPhoneOSGameView::OnLoadがコールされないので、ここで明示的にInitializeをコールする // oglView.Initialize(); }
public override UIView GetViewForHeader(UITableView tableView, int section) { var title = tweets.ElementAt(section).Key; var bg = new UIView(new RectangleF(0, 0, 320, 40)); bg.BackgroundColor = UIColor.Clear; //var bg2 = new UIView(new Rectangle(0,0,320,30)); //bg2.BackgroundColor = UIColor.FromRGBA(108/255f,195/255f,22/255f,0.6f); var bg2 = new UIImageView(new Rectangle(0, 0, 320, 30)); bg2.Image = UIImage.FromBundle("tweet_Header"); var lbl_Header = new UILabel(new RectangleF(10, 0, 300, 30)); lbl_Header.Text = title; lbl_Header.TextAlignment = UITextAlignment.Left; lbl_Header.BackgroundColor = UIColor.Clear; lbl_Header.TextColor = UIColor.White; lbl_Header.Font = App.FontForTweetHeader; bg2.Add(lbl_Header); bg.Add(bg2); return(bg); }
static void CreateHeader(string title, UIView view) { const float horizontalPadding = 15f; const float verticalPadding = 10f; float viewWidth = view.Bounds.Width; headerView = new UIView(); UIImageView logo = new UIImageView(HeaderImage) { ContentMode = Utilities.UserInterfaceIdiomIsPhone ? UIViewContentMode.TopLeft : UIViewContentMode.Center }; UILabel logoText = new UILabel { Font = UIFont.SystemFontOfSize(title.Length > 7 ? 28 : 36), Text = Utilities.UserInterfaceIdiomIsPhone ? title.Replace(' ', '\n') : title, TextColor = UIColor.DarkTextColor, ShadowColor = HighlightColor, ShadowOffset = new SizeF(1, 1), BackgroundColor = UIColor.Clear, Lines = Utilities.UserInterfaceIdiomIsPhone && title.Contains(" ") ? 2 : 1 }; logo.SizeToFit(); logoText.SizeToFit(); float requiredWidth = logo.Bounds.Width + horizontalPadding + logoText.Bounds.Width; float requiredHeight = Math.Max(logo.Bounds.Height, logoText.Bounds.Height); headerView.Frame = new RectangleF((viewWidth - requiredWidth) / 2, verticalPadding, requiredWidth, requiredHeight + verticalPadding); logo.Frame = new RectangleF(0, 0, logo.Bounds.Width, logo.Bounds.Height); logoText.Frame = new RectangleF(logo.Bounds.Width + horizontalPadding / 2, (logo.Bounds.Height - logoText.Bounds.Height) / 2, logoText.Bounds.Width, logoText.Bounds.Height); headerView.Add(logo); headerView.Add(logoText); view.Add(headerView); }
void CreateOsXMonthOrDaysVector(System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, string> > resource) { nfloat xFirstStep = 40f; nfloat xStep = (250) / (nfloat)(resource.Count - 1); osXview = new UIView(new CGRect(0, 0, 320, GraphicViewWindow.Frame.Height)); GraphicViewWindow.Add(osXview); nfloat heightOfFrame = GraphicsViewWorker.CountFrameHeight(osXview.Frame.Height); osXview.BackgroundColor = UIColor.Clear; if (resource.Count < 15) { foreach (var item in resource) { UILabel label = new UILabel(new CGRect(xFirstStep - 12.5f, heightOfFrame, 25, 25)); label.TextAlignment = UITextAlignment.Center; label.Font = UIFont.FromName("HelveticaNeue-Light", 10f); label.TextColor = UIColor.LightGray; label.Text = Enum.GetName(typeof(Months), Convert.ToInt32(item.Key)); osXview.Add(label); xFirstStep += xStep; } } }
public RadialMenuCustomization() { tempColor = GetRandomColor(); isEraserSelected = false; colorPaletteView = new UIView(); colorPaletteView.BackgroundColor = UIColor.FromRGB(230, 230, 230); nfloat elementCount = UIScreen.MainScreen.Bounds.Width / 30; nfloat xPos = 5; for (int i = 0; i < elementCount; i++) { UIButton button = new UIButton(); button.Tag = 1000 + i; button.Layer.CornerRadius = 15; button.Frame = new CGRect(xPos, 5, 30, 30); button.BackgroundColor = GetRandomColor(); button.AddTarget(HandleEventHandler, UIControlEvent.TouchDown); colorPaletteView.Add(button); xPos += 40; } startUpLabel = new UILabel(); startUpLabel.Text = "Touch to draw"; startUpLabel.TextColor = UIColor.FromRGB(0, 191, 255); startUpLabel.TextAlignment = UITextAlignment.Center; startUpLabel.BackgroundColor = UIColor.Clear; radialMenu = new SfRadialMenu(); radialMenu.IsDragEnabled = false; radialMenu.RimRadius = 120; radialMenu.CenterButtonRadius = 40; radialMenu.CenterButtonBorderThickness = 0; radialMenu.CenterButtonBorderColor = UIColor.Clear; radialMenu.CenterButtonBackgroundColor = UIColor.Clear; radialMenu.EnableRotation = true; radialMenu.RimColor = UIColor.Clear; radialMenu.SeparatorThickness = 10; radialMenu.SeparatorColor = UIColor.Clear; centerView = new UIView(); centerView.Frame = new CGRect(0, 0, 80, 80); centerImage = new UIImageView(); centerImage.Image = UIImage.FromBundle("blue.png"); centerImage.Frame = new CGRect(0, 0, 80, 80); centerView.Add(centerImage); UILabel centerLabel = new UILabel(); centerLabel.Frame = new CGRect(0, 5, 80, 80); centerLabel.Text = "U"; centerLabel.TextAlignment = UITextAlignment.Center; centerLabel.Font = UIFont.FromName("ios", 30); centerLabel.TextColor = UIColor.White; centerView.Add(centerLabel); radialMenu.EnableCenterButtonAnimation = false; radialMenu.CenterButtonView = centerView; UIView penView = new UIView(); penView.Frame = new CGRect(0, 0, 80, 80); UIImageView penImage = new UIImageView(); penImage.Image = UIImage.FromBundle("green.png"); penImage.Frame = new CGRect(0, 0, 80, 80); penView.Add(penImage); UILabel penLabel = new UILabel(); penLabel.Frame = new CGRect(0, 5, 80, 80); penLabel.Text = "L"; penLabel.TextAlignment = UITextAlignment.Center; penLabel.Font = UIFont.FromName("ios", 30); penLabel.TextColor = UIColor.White; penView.Add(penLabel); SfRadialMenuItem pen = new SfRadialMenuItem() { Height = 80, Width = 80, View = penView, BackgroundColor = UIColor.Clear }; pen.ItemTapped += Pen_ItemTapped; radialMenu.Items.Add(pen); UIView brushView = new UIView(); brushView.Frame = new CGRect(0, 0, 80, 80); UIImageView brushImage = new UIImageView(); brushImage.Image = UIImage.FromBundle("green.png"); brushImage.Frame = new CGRect(0, 0, 80, 80); brushView.Add(brushImage); UILabel brushLabel = new UILabel(); brushLabel.Frame = new CGRect(0, 5, 80, 80); brushLabel.Text = "A"; brushLabel.TextAlignment = UITextAlignment.Center; brushLabel.Font = UIFont.FromName("ios", 30); brushLabel.TextColor = UIColor.White; brushView.Add(brushLabel); SfRadialMenuItem brush = new SfRadialMenuItem() { Height = 80, Width = 80, View = brushView, BackgroundColor = UIColor.Clear }; brush.ItemTapped += Brush_ItemTapped; radialMenu.Items.Add(brush); UIView eraserView = new UIView(); eraserView.Frame = new CGRect(0, 0, 80, 80); UIImageView eraserImage = new UIImageView(); eraserImage.Image = UIImage.FromBundle("green.png"); eraserImage.Frame = new CGRect(0, 0, 80, 80); eraserView.Add(eraserImage); UILabel eraserLabel = new UILabel(); eraserLabel.Frame = new CGRect(0, 5, 80, 80); eraserLabel.Text = "R"; eraserLabel.TextAlignment = UITextAlignment.Center; eraserLabel.Font = UIFont.FromName("ios", 30); eraserLabel.TextColor = UIColor.White; eraserView.Add(eraserLabel); SfRadialMenuItem eraser = new SfRadialMenuItem() { Height = 80, Width = 80, View = eraserView, BackgroundColor = UIColor.Clear }; eraser.ItemTapped += Eraser_ItemTapped; radialMenu.Items.Add(eraser); UIView removeView = new UIView(); removeView.Frame = new CGRect(0, 0, 80, 80); UIImageView removeImage = new UIImageView(); removeImage.Image = UIImage.FromBundle("green.png"); removeImage.Frame = new CGRect(0, 0, 80, 80); removeView.Add(removeImage); UILabel removeLabel = new UILabel(); removeLabel.Frame = new CGRect(0, 5, 80, 80); removeLabel.Text = "Q"; removeLabel.TextAlignment = UITextAlignment.Center; removeLabel.Font = UIFont.FromName("ios", 30); removeLabel.TextColor = UIColor.White; removeView.Add(removeLabel); SfRadialMenuItem remove = new SfRadialMenuItem() { Height = 80, Width = 80, View = removeView, BackgroundColor = UIColor.Clear }; remove.ItemTapped += Remove_ItemTapped; radialMenu.Items.Add(remove); UIView paintView = new UIView(); paintView.Frame = new CGRect(0, 0, 80, 80); UIImageView paintImage = new UIImageView(); paintImage.Image = UIImage.FromBundle("green.png"); paintImage.Frame = new CGRect(0, 0, 80, 80); paintView.Add(paintImage); UILabel paintLabel = new UILabel(); paintLabel.Frame = new CGRect(0, 5, 80, 80); paintLabel.Text = "G"; paintLabel.TextAlignment = UITextAlignment.Center; paintLabel.Font = UIFont.FromName("ios", 30); paintLabel.TextColor = UIColor.White; paintView.Add(paintLabel); SfRadialMenuItem paint = new SfRadialMenuItem() { Height = 80, Width = 80, View = paintView, BackgroundColor = UIColor.Clear }; paint.ItemTapped += Paint_ItemTapped; radialMenu.Items.Add(paint); UIView paintBoxView = new UIView(); paintBoxView.Frame = new CGRect(0, 0, 80, 80); UIImageView paintBoxImage = new UIImageView(); paintBoxImage.Image = UIImage.FromBundle("green.png"); paintBoxImage.Frame = new CGRect(0, 0, 80, 80); paintBoxView.Add(paintBoxImage); UILabel paintBoxLabel = new UILabel(); paintBoxLabel.Frame = new CGRect(0, 5, 80, 80); paintBoxLabel.Text = "V"; paintBoxLabel.TextAlignment = UITextAlignment.Center; paintBoxLabel.Font = UIFont.FromName("ios", 30); paintBoxLabel.TextColor = UIColor.White; paintBoxView.Add(paintBoxLabel); SfRadialMenuItem paintBox = new SfRadialMenuItem() { Height = 80, Width = 80, View = paintBoxView, BackgroundColor = UIColor.Clear }; paintBox.ItemTapped += PaintBox_ItemTapped; radialMenu.Items.Add(paintBox); if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { //radialMenu.RimRadius = 250; radialMenu.CenterButtonRadius = 50; centerLabel.Font = UIFont.FromName("ios", 40); pen.IconFont = UIFont.FromName("ios", 40); pen.Height = 100; pen.Width = 100; brush.IconFont = UIFont.FromName("ios", 40); brush.Height = 100; brush.Width = 100; eraser.IconFont = UIFont.FromName("ios", 40); eraser.Height = 100; eraser.Width = 100; remove.Height = 100; remove.Width = 100; remove.IconFont = UIFont.FromName("ios", 40); paintBox.Height = 100; paintBox.Width = 100; paintBox.IconFont = UIFont.FromName("ios", 40); paint.Height = 100; paint.Width = 100; paint.IconFont = UIFont.FromName("ios", 40); } drawingTool = new CustomDrawing(); drawingTool.PenColor = tempColor; drawingTool.Tapped += DrawingTool_Tapped; this.ClipsToBounds = true; this.Add(drawingTool); this.Add(startUpLabel); this.Add(colorPaletteView); this.Add(radialMenu); }
public ContextualMenu() { titleLabel = new UILabel(); titleLabel.Text = "About Syncfusion"; titleLabel.Font = UIFont.FromName("Helvetica", 20f); shareText = new UILabel(); shareText.Text = "\tSyncfusion is the enterprise technology partner of choice for software development, delivering a broad range of web, mobile, and desktop controls coupled with a service-oriented approach throughout the entire application lifecycle. Syncfusion has established itself as the trusted partner worldwide for use in applications."; shareText.Lines = 0; shareText.LineBreakMode = UILineBreakMode.WordWrap; shareText.Font = UIFont.FromName("Helvetica", 16f); shareView = new UIView(); shareView.BackgroundColor = UIColor.White; shareButton = new UIButton(); shareButton.SetAttributedTitle(new NSAttributedString("Tap here to follow us", underlineAttr), UIControlState.Normal); shareButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; shareButton.BackgroundColor = UIColor.Clear; shareButton.SetTitleColor(UIColor.FromRGB(41, 146, 247), UIControlState.Normal); shareButton.TouchUpInside += shareButtonClicked; shareView.Add(shareButton); radialMenu = new SfRadialMenu(); radialMenu.Hidden = true; CGRect apprect = UIScreen.MainScreen.Bounds; //radialMenu.Position = new CGPoint(apprect.Width / 2, apprect.Height - apprect.Height/3 - 55); radialMenu.IsDragEnabled = false; radialMenu.RimRadius = 100; radialMenu.CenterButtonRadius = 25; radialMenu.CenterButtonBorderThickness = 2; radialMenu.EnableRotation = true; radialMenu.RimColor = UIColor.Clear; radialMenu.CenterButtonText = "\ue703"; radialMenu.CenterButtonBackgroundColor = UIColor.FromRGB(0, 207, 72); radialMenu.CenterButtonTextColor = UIColor.White; radialMenu.CenterButtonIconFont = UIFont.FromName("Social", 30); radialMenu.CenterButtonTextFrame = new CGRect(-1, 5, 50, 50); radialMenu.Closed += RadialMenu_Closed; SfRadialMenuItem facebook = new SfRadialMenuItem() { Image = "facebook.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue700" }; facebook.ItemTapped += facebook_ItemTapped; radialMenu.Items.Add(facebook); SfRadialMenuItem gplus = new SfRadialMenuItem() { Image = "gplus.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue707" }; gplus.ItemTapped += gPlus_ItemTapped; radialMenu.Items.Add(gplus); SfRadialMenuItem twitter = new SfRadialMenuItem() { Image = "twitter.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue704" }; twitter.ItemTapped += twitter_ItemTapped; radialMenu.Items.Add(twitter); SfRadialMenuItem pinterest = new SfRadialMenuItem() { Image = "pinterest.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue705" }; pinterest.ItemTapped += pinterest_ItemTapped; radialMenu.Items.Add(pinterest); SfRadialMenuItem linkedIn = new SfRadialMenuItem() { Image = "linkedin.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue706" }; linkedIn.ItemTapped += linkedIn_ItemTapped; radialMenu.Items.Add(linkedIn); SfRadialMenuItem instagram = new SfRadialMenuItem() { Image = "instagram.png", FontIconFrame = new CGRect(0, 4, 30, 30), IconFont = UIFont.FromName("Social", 20), FontIconColor = UIColor.White, FontIcon = "\ue708" }; instagram.ItemTapped += instagram_ItemTapped; radialMenu.Items.Add(instagram); alertWindow = new UIAlertView(); alertWindow.AddButton("OK"); this.Add(titleLabel); this.Add(shareText); this.Add(shareView); this.Add(radialMenu); }
private void initRegister() { RegisterPhoto = new UIView(new CGRect(119, 56 - 150, 82, 82)); //150 -> to take it up var img_photo = new UIImageView(new RectangleF(0, 0, 82, 82)); img_photo.ContentMode = UIViewContentMode.ScaleToFill; RegisterPhoto.ContentMode = UIViewContentMode.ScaleToFill; img_photo.Image = UIImage.FromFile("MLResources/Icons/icon_photo.png"); RegisterPhoto.Add(img_photo); View.Add(RegisterPhoto); //user views R_UserView = getRoundImageView(30 + DeviceWidth, 160, null, null); View.Add(R_UserView); R_PassView = getRoundImageView(30 + DeviceWidth, 220, null, null); View.Add(R_PassView); R_CorreoView = getRoundImageView(30 + DeviceWidth, 280, null, null); View.Add(R_CorreoView); R_NombreView = getRoundImageView(30 + DeviceWidth, 340, null, null); View.Add(R_NombreView); R_ApellidoView = getRoundImageView(30 + DeviceWidth, 400, null, null); View.Add(R_ApellidoView); R_ProfView = getRoundImageView(30 + DeviceWidth, 460, "MLResources/Icons/icon_enter.png", "Soy profesor?"); View.Add(R_ProfView); DoRegisterBt = new UIButton(new CGRect(205, 0, 55, 55)); R_ProfView.Add(DoRegisterBt); DoRegisterBt.TouchUpInside += delegate { //show r_login }; R_UserText = getInputText("Usuario"); R_UserView.Add(R_UserText); R_PassText = getInputText("Contrasena"); R_PassView.Add(R_PassText); R_CorreoText = getInputText("Correo"); R_CorreoView.Add(R_CorreoText); R_NombreText = getInputText("Nombre"); R_NombreView.Add(R_NombreText); R_ApellidoText = getInputText("Apellido"); R_ApellidoView.Add(R_ApellidoText); //registrarse button Back RegisterBackBt = new UIButton(new CGRect(40 + DeviceWidth, 532, 100, 22)); RegisterBackBt.SetTitle("Back", UIControlState.Normal); RegisterBackBt.SetTitleColor(UIColor.Yellow, UIControlState.Normal); View.Add(RegisterBackBt); RegisterBackBt.TouchUpInside += delegate { //go to back view if (login_state == -1) { loginanimate(DeviceWidth, true); login_state = 0; } else { socialanimate(DeviceWidth, true, true); social_state = 0; } registeranimate(DeviceWidth, false); sign_state = 1; }; //camera RCameraBt = new UIButton(new CGRect(0, 0, 82, 82)); RegisterPhoto.Add(RCameraBt); RCameraBt.TouchUpInside += delegate { if (_iscameraopen) { UIView.Animate(0.24, 0, UIViewAnimationOptions.CurveEaseIn, () => { CameraMenu.Center = new PointF((float)CameraMenu.Center.X, (float)CameraMenu.Center.Y + 250); }, null); } else { UIView.Animate(0.24, 0, UIViewAnimationOptions.CurveEaseIn, () => { CameraMenu.Center = new PointF((float)CameraMenu.Center.X, (float)CameraMenu.Center.Y - 250); }, null); } _iscameraopen = !_iscameraopen; }; }
private void initCameraMenu() { CameraMenu = new UIView(new CGRect(0, 382 + 250, 320, 186)); //250 to hide CameraMenu.BackgroundColor = UIColor.FromRGBA(0.0f, 0.0f, 0.0f, 0.4f); View.Add(CameraMenu); var title = new UILabel(new CGRect(24, 20, 210, 20)); title.TextColor = UIColor.White; title.Text = "Elegir imagen de peril"; CameraMenu.Add(title); var cimage = new UIImageView(new CGRect(60, 54, 60, 60)); cimage.Image = UIImage.FromFile("MLResources/Icons/icon_camara.png"); cimage.ContentMode = UIViewContentMode.ScaleToFill; CameraMenu.Add(cimage); var bimage = new UIImageView(new CGRect(200, 54, 60, 60)); bimage.Image = UIImage.FromFile("MLResources/Icons/icon_biblioteca.png"); bimage.ContentMode = UIViewContentMode.ScaleToFill; CameraMenu.Add(bimage); CamButton = new UIButton(new CGRect(60, 54, 60, 60)); CameraMenu.Add(CamButton); CamButton.TouchUpInside += delegate { }; BibButton = new UIButton(new CGRect(200, 54, 60, 60)); CameraMenu.Add(BibButton); BibButton.TouchUpInside += delegate { }; //labels var clabel = new UILabel(new CGRect(50, 116, 80, 20)); clabel.TextColor = UIColor.White; clabel.Text = "Camara"; CameraMenu.Add(clabel); var blabel = new UILabel(new CGRect(190, 116, 80, 20)); blabel.TextColor = UIColor.White; blabel.Text = "Biblioteca"; CameraMenu.Add(blabel); var down_square = new UIView(new CGRect(0, 146, 320, 40)); down_square.BackgroundColor = UIColor.FromRGBA(0.0f, 0.0f, 0.0f, 0.6f); CameraMenu.Add(down_square); var lcancel = new UILabel(new CGRect(100, 10, 120, 20)); lcancel.TextColor = UIColor.White; lcancel.Text = "Cancelar"; lcancel.TextAlignment = UITextAlignment.Center; down_square.Add(lcancel); CancelCamBt = new UIButton(new CGRect(0, 0, 320, 40)); down_square.Add(CancelCamBt); CancelCamBt.TouchUpInside += delegate { if (_iscameraopen) { UIView.Animate(0.24, 0, UIViewAnimationOptions.CurveEaseIn, () => { CameraMenu.Center = new PointF((float)CameraMenu.Center.X, (float)CameraMenu.Center.Y + 250); }, null); _iscameraopen = false; } }; }
public UIDayScheduleSnapshot() { var background = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColorCompat.SecondarySystemBackgroundColor }; { var paddingContainer = new UIControl() { TranslatesAutoresizingMaskIntoConstraints = false }; { _stackViewHolidays = new UIStackView() { TranslatesAutoresizingMaskIntoConstraints = false, Axis = UILayoutConstraintAxis.Vertical, Spacing = 1 }; paddingContainer.Add(_stackViewHolidays); _stackViewHolidays.StretchWidth(paddingContainer); _timetable = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { _scheduleGapLines = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; _timetable.Add(_scheduleGapLines); _scheduleGapLines.StretchWidthAndHeight(_timetable); _scheduleTimesColumn = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; _timetable.Add(_scheduleTimesColumn); _scheduleTimesColumn.StretchHeight(_timetable); _scheduleTimesColumn.SetWidth(TIME_INDICATOR_SIZE); _scheduleTimesColumn.PinToLeft(_timetable); var verticalDivider = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColorCompat.SecondaryLabelColor }; _timetable.Add(verticalDivider); verticalDivider.StretchHeight(_timetable); verticalDivider.SetWidth(GAP_SIZE); verticalDivider.PinToLeft(_timetable, left: (int)TIME_INDICATOR_SIZE); _scheduleItemsColumn = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; _timetable.Add(_scheduleItemsColumn); _scheduleItemsColumn.StretchHeight(_timetable); _scheduleItemsColumn.StretchWidth(_timetable, left: TIME_INDICATOR_SIZE + GAP_SIZE + 8, right: 8); // Normally we would have used constraints to lay these out horizontally, but for some reason constraints // are acting up and the horizontal constraints weren't working correctly, so just pinning things to the left // and applying correct padding // Maybe it was because I originally forgot TranslatesAutoresizing on the verticalDivider... that would explain it } paddingContainer.Add(_timetable); _timetable.StretchWidth(paddingContainer); _holidaysItemsSourceAdapter = new BareUIStackViewItemsSourceAdapter <UIMainCalendarItemView>(_stackViewHolidays); paddingContainer.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[holidays][timetable]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "holidays", _stackViewHolidays, "timetable", _timetable)); } background.Add(paddingContainer); paddingContainer.StretchWidthAndHeight(background); } this.Add(background); background.StretchWidthAndHeight(this, top: 16, bottom: 16); }
private void initSocialButtons() { ConectarField = new UILabel(new CGRect(100 + DeviceWidth, 244, 120, 20)); ConectarField.Text = "Conectar con"; ConectarField.TextAlignment = UITextAlignment.Center; ConectarField.TextColor = UIColor.Yellow; ConectarField.Font = UIFont.FromName("HelveticaNeue", 18); View.Add(ConectarField); //social views FacebookView = getRoundImageView(30 + DeviceWidth, 285, "MLResources/Icons/icon_face.png", "Facebook"); View.Add(FacebookView); TwitterView = getRoundImageView(30 + DeviceWidth, 345, "MLResources/Icons/icon_twitter.png", "Twitter"); View.Add(TwitterView); LinkedView = getRoundImageView(30 + DeviceWidth, 402, "MLResources/Icons/icon_in.png", "LinkedIn"); View.Add(LinkedView); FacebookButton = new UIButton(new CGRect(0, 0, 260, 55)); FacebookView.Add(FacebookButton); FacebookButton.TouchUpInside += delegate { }; TwitterButton = new UIButton(new CGRect(0, 0, 260, 55)); TwitterView.Add(FacebookButton); TwitterButton.TouchUpInside += delegate { }; LinkedButton = new UIButton(new CGRect(0, 0, 260, 55)); LinkedView.Add(FacebookButton); LinkedButton.TouchUpInside += delegate { }; //botton buttons DownView = new UIView(new CGRect(0, 488 + 100, 320, 80)); View.Add(DownView); var leftline = new UIView(new CGRect(22, 10, 120, 1)) { BackgroundColor = UIColor.Red }; DownView.Add(leftline); var rightline = new UIView(new CGRect(178, 10, 120, 1)) { BackgroundColor = UIColor.Red }; DownView.Add(rightline); LoginButton = new UIButton(new CGRect(40, 35, 100, 30)); LoginButton.SetTitle("Login", UIControlState.Normal); LoginButton.SetTitleColor(UIColor.Yellow, UIControlState.Normal); DownView.Add(LoginButton); LoginButton.TouchUpInside += delegate { loginanimate(-1.0f * DeviceWidth, true); socialanimate(-1.0f * DeviceWidth, false, true); social_state = -1; login_state = 0; }; SignupButton = new UIButton(new CGRect(180, 35, 100, 30)); SignupButton.SetTitle("Sign Up", UIControlState.Normal); SignupButton.SetTitleColor(UIColor.Yellow, UIControlState.Normal); DownView.Add(SignupButton); SignupButton.TouchUpInside += delegate { registeranimate(-1.0f * DeviceWidth, true); socialanimate(-1.0f * DeviceWidth, false, false); social_state = -1; sign_state = 0; }; }
private void render() { _scheduleGapLines.ClearAllSubviews(); _scheduleItemsColumn.ClearAllSubviews(); _scheduleTimesColumn.ClearAllSubviews(); _timetable.SetHeight(0); _timetableHeight = 0; if (Date == DateTime.MinValue || !SemesterItems.Semester.IsDateDuringThisSemester(Date)) { UpdateVisibility(); UpdateTotalHeight(); return; } if (!_arrangedItems.IsValid()) { UpdateVisibility(); UpdateTotalHeight(); return; } base.Hidden = false; float totalHeight = ((int)(_arrangedItems.EndTime - _arrangedItems.StartTime).TotalHours + 1) * HEIGHT_OF_HOUR; _timetable.SetHeight(totalHeight); _timetableHeight = totalHeight; UpdateTotalHeight(); for (TimeSpan time = _arrangedItems.StartTime; time <= _arrangedItems.EndTime; time = time.Add(TimeSpan.FromHours(1))) { string text = DateTime.Today.Add(time).ToString("h:").TrimEnd(':'); var label = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.PreferredHeadline, Lines = 1, Text = text, TextAlignment = UITextAlignment.Center, TextColor = UIColorCompat.SecondaryLabelColor }; _scheduleTimesColumn.Add(label); label.StretchWidth(_scheduleTimesColumn); label.SetHeight(HEIGHT_OF_HOUR); label.PinToTop(_scheduleTimesColumn, GetTopMarginAsPx(time, _arrangedItems.StartTime)); // Add the divider if not the first if (time != _arrangedItems.StartTime) { var gap = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColorCompat.SecondaryLabelColor }; _scheduleGapLines.Add(gap); gap.StretchWidth(_scheduleGapLines); gap.SetHeight(GAP_SIZE); gap.PinToTop(_scheduleGapLines, GetTopMarginAsPx(time, _arrangedItems.StartTime)); } } foreach (var s in _arrangedItems.ScheduleItems) { UIScheduleItemView visual = new UIScheduleItemView(s.Item); visual.TouchUpInside += new WeakEventHandler(ScheduleItem_TouchUpInside).Handler; AddVisualItem(visual, s); } // Reverse the order so that when items expand, they appear on top of the items beneath them. // Otherwise I would have to do some crazy Z-order logic. foreach (var e in _arrangedItems.EventItems.Reverse()) { UIView visual; if (e.IsCollapsedMode) { visual = new UIScheduleViewEventItemCollapsed() { Item = e }; } else { visual = new UIScheduleViewEventItemFull() { Item = e }; } AddVisualItem(visual, e); } }
public EditClassWeightCategoriesViewController() { Title = "Weight Categories"; var cancelButton = new UIBarButtonItem() { Title = "Cancel" }; cancelButton.Clicked += new WeakEventHandler <EventArgs>(CancelButton_Clicked).Handler; NavigationItem.LeftBarButtonItem = cancelButton; var saveButton = new UIBarButtonItem() { Title = "Save" }; saveButton.Clicked += new WeakEventHandler <EventArgs>(SaveButton_Clicked).Handler; NavigationItem.RightBarButtonItem = saveButton; PowerPlannerUIHelper.ConfigureForInputsStyle(this); // No save/cancel button, implicitly saves when going back or exiting StackView.AddTopSectionDivider(); var headerView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { var labelName = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = "Name", Font = UIFont.PreferredBody.Bold() }; headerView.Add(labelName); labelName.StretchHeight(headerView, top: 8, bottom: 8); var labelWeight = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = "Weight", Font = UIFont.PreferredBody.Bold() }; headerView.Add(labelWeight); labelWeight.StretchHeight(headerView, top: 8, bottom: 8); headerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[name][weight(60)]-52-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, "name", labelName, "weight", labelWeight)); } StackView.AddArrangedSubview(headerView); headerView.StretchWidth(StackView, left: 16, right: 16); StackView.AddDivider(); var weightsView = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; { _itemsSourceWeights = new BareUIViewItemsSourceAdapterAsStackPanel(weightsView, (w) => { return(new UIEditingWeightCategoryView(this) { DataContext = w }); }); } StackView.AddArrangedSubview(weightsView); weightsView.StretchWidth(StackView, left: 16); var buttonDelete = new UIButton(UIButtonType.System) { TranslatesAutoresizingMaskIntoConstraints = false }; buttonDelete.SetTitle("Add Category", UIControlState.Normal); buttonDelete.TouchUpInside += new WeakEventHandler(delegate { ViewModel.AddWeightCategory(); }).Handler; StackView.AddArrangedSubview(buttonDelete); buttonDelete.StretchWidth(StackView); buttonDelete.SetHeight(44); StackView.AddBottomSectionDivider(); }
public DetailTweetViewController(Tweet partialTweet) : base(UITableViewStyle.Grouped, null, true) { bool isMine = false; if (partialTweet.IsSearchResult) { Tweet.LoadFullTweet(partialTweet.Id, fullTweet => SetTweet(fullTweet)); } else { isMine = partialTweet.UserId == TwitterAccount.CurrentAccount.AccountId; // Hack until we figure out why DELETE is not working with OAuth // and making the server return 401 Unauthorized isMine = false; } var handlers = new EventHandler [] { Reply, Retweet, Direct, Delete }; var profileRect = new RectangleF(PadX, 0, View.Bounds.Width - PadX, 100); var detailRect = new RectangleF(PadX, 0, View.Bounds.Width - 30 - PadX * 2, 0); shortProfileView = new ShortProfileView(profileRect, partialTweet, true); profileRect.Height += 8; var triangle = new TriangleView(UIColor.White, UIColor.FromRGB(171, 171, 171)) { Frame = new RectangleF(43, shortProfileView.Bounds.Height + 1, 16, 8) }; var containerView = new UIView(profileRect); containerView.Add(shortProfileView); containerView.Add(triangle); main = new Section(containerView) { new UIViewElement(null, new DetailTweetView(detailRect, partialTweet, TapHandler, TapAndHoldHandler, this), false) { Flags = UIViewElement.CellFlags.DisableSelection } }; Section replySection = new Section(); if (partialTweet.Kind == TweetKind.Direct) { replySection.Add(new StringElement(Locale.GetText("Direct Reply"), delegate { Direct(this, EventArgs.Empty); })); } else { replySection.Add(new UIViewElement(null, new ButtonsView(isMine ? 4 : 3, buttons, handlers), true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent }); } userTimeline = TimelineRootElement.MakeTimeline(partialTweet.Screename, Locale.GetText("User's timeline"), "http://api.twitter.com/1/statuses/user_timeline.json?skip_user=true&screen_name=" + partialTweet.Screename, User.FromTweet(partialTweet)); tweet = partialTweet; if (!partialTweet.IsSearchResult) { SetTweet(partialTweet); } Root = new RootElement(partialTweet.Screename) { main, replySection, new Section() { userTimeline } }; }
private static void OnRecognizing(LongPressGestureRecognizer recognizer, UITableView tableView, ViewCell cell) { NSIndexPath indexPath = tableView.IndexPathForRowAtPoint(recognizer.LocationInView(tableView)); switch (recognizer.State) { case UIGestureRecognizerState.Began: tableView.ScrollEnabled = false; if (indexPath != null) { // Remember the source row sourceIndexPath = indexPath; destinationIndexPath = indexPath; var selectedCell = tableView.CellAt(indexPath); UIGraphics.BeginImageContext(selectedCell.ContentView.Bounds.Size); selectedCell.ContentView.Layer.RenderInContext(UIGraphics.GetCurrentContext()); UIImage img = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); UIImageView iv = new UIImageView(img); dragAndDropView = new UIView(); dragAndDropView.Frame = iv.Frame; dragAndDropView.Add(iv); //dragAndDropView.BackgroundColor = UIColor.Blue; sourceTableView = tableView; UIApplication.SharedApplication.KeyWindow.Add(dragAndDropView); dragAndDropView.Center = recognizer.LocationInView(UIApplication.SharedApplication.KeyWindow); dragAndDropView.AddGestureRecognizer(selectedCell.GestureRecognizers [0]); } break; case UIGestureRecognizerState.Changed: dragAndDropView.Center = recognizer.LocationInView(UIApplication.SharedApplication.KeyWindow); destinationIndexPath = indexPath; break; case UIGestureRecognizerState.Cancelled: case UIGestureRecognizerState.Failed: sourceIndexPath = null; cell.View.BackgroundColor = Color.Transparent; break; case UIGestureRecognizerState.Ended: if (dragAndDropView == null) { return; } dragAndDropView.RemoveFromSuperview(); dragAndDropView = null; UIView view = UIApplication.SharedApplication.KeyWindow; UIView viewHit = view.HitTest(recognizer.LocationInView(view), null); int removeLocation = (int)sourceIndexPath.Item; int insertLocation = destinationIndexPath != null ? (int)destinationIndexPath.Item : -1; UITableView destinationTableView = viewHit as UITableView; if (viewHit is UITableView) { destinationTableView = viewHit as UITableView; } else { while (!(viewHit is UITableViewCell) && viewHit != null) { viewHit = viewHit.Superview; } UIView tempView = viewHit?.Superview; while (!(tempView is UITableView) && tempView != null) { tempView = tempView.Superview; } if (tempView != null) { destinationTableView = tempView as UITableView; insertLocation = (int)destinationTableView.IndexPathForCell((UITableViewCell)viewHit).Item; } } if (destinationTableView != null) { if (DragAndDropListViewRenderer.ListMap.ContainsKey(tableView.Tag.ToString()) && DragAndDropListViewRenderer.ListMap.ContainsKey(destinationTableView.Tag.ToString())) { var sourceList = (IList)DragAndDropListViewRenderer.ListMap [tableView.Tag.ToString()].Item2; var destinationList = (IList)DragAndDropListViewRenderer.ListMap [destinationTableView.Tag.ToString()].Item2; if (!tableView.Tag.Equals(destinationTableView.Tag) || removeLocation != insertLocation) { if (sourceList.Contains(cell.BindingContext)) { sourceList.Remove(cell.BindingContext); if (insertLocation != -1) { destinationList.Insert(insertLocation, cell.BindingContext); } else { destinationList.Add(cell.BindingContext); } } tableView.ReloadData(); destinationTableView.ReloadData(); } } } tableView.ScrollEnabled = true; break; } }
private void InitializeUi() { // Holds all the views var viewHolder = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; Add(viewHolder); // Track Thumbnail _imageControl = new MvxCachedImageView { TranslatesAutoresizingMaskIntoConstraints = false, ContentMode = UIViewContentMode.ScaleAspectFill }; _imageControl.Layer.MasksToBounds = true; _imageControl.Layer.CornerRadius = _imageCornerRadius; var shadowView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false }; shadowView.Layer.ShadowOpacity = 0.6f; shadowView.Layer.ShadowColor = UIColor.Black.CGColor; shadowView.Layer.ShadowRadius = 4.0f; shadowView.Layer.ShadowOffset = new CGSize(0, 3); shadowView.AddSubview(_imageControl); viewHolder.Add(shadowView); shadowView.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 4).Active = true; shadowView.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 4).Active = true; shadowView.HeightAnchor.ConstraintEqualTo(160).Active = true; shadowView.WidthAnchor.ConstraintEqualTo(160).Active = true; _imageControl.HeightAnchor.ConstraintEqualTo(160).Active = true; _imageControl.WidthAnchor.ConstraintEqualTo(160).Active = true; _imageControl.LeftAnchor.ConstraintEqualTo(shadowView.LeftAnchor).Active = true; _imageControl.TopAnchor.ConstraintEqualTo(shadowView.TopAnchor).Active = true; // Right Footer _rightFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(12f, UIFontWeight.Semibold) }; _imageControl.Add(_rightFooter); // Position the right footer _rightFooter.RightAnchor.ConstraintEqualTo(_imageControl.RightAnchor, -8).Active = true; _rightFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -6).Active = true; // Left Footer _leftFooter = new UILabel { TextColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.FromName("FontAwesome5Pro-Light", 12) }; _imageControl.Add(_leftFooter); // Position the left footer _leftFooter.LeftAnchor.ConstraintEqualTo(_imageControl.LeftAnchor, 8).Active = true; _leftFooter.BottomAnchor.ConstraintEqualTo(_imageControl.BottomAnchor, -6).Active = true; // Title _title = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Font = UIFont.SystemFontOfSize(14f, UIFontWeight.Semibold), }; viewHolder.Add(_title); _title.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 6).Active = true; _title.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 174).Active = true; _title.WidthAnchor.ConstraintEqualTo(160).Active = true; // Subtitle _subtitle = new UILabel { TextColor = ColorHelper.Text0.ToPlatformColor(), TranslatesAutoresizingMaskIntoConstraints = false, Alpha = 0.8f, Font = UIFont.SystemFontOfSize(13f, UIFontWeight.Medium) }; viewHolder.Add(_subtitle); _subtitle.LeftAnchor.ConstraintEqualTo(viewHolder.LeftAnchor, 6).Active = true; _subtitle.TopAnchor.ConstraintEqualTo(viewHolder.TopAnchor, 194).Active = true; _subtitle.WidthAnchor.ConstraintEqualTo(160).Active = true; // The controller used for extra info _alertController = UIAlertController.Create("", "", UIAlertControllerStyle.ActionSheet); // Add the default close _alertController.AddAction(UIAlertAction.Create("Close", UIAlertActionStyle.Cancel, _ => _alertController.DismissViewController(true, null))); var gr = new UILongPressGestureRecognizer(); gr.AddTarget(() => LongPressed(gr)); AddGestureRecognizer(gr); }