public override void ViewDidLoad() { base.ViewDidLoad (); _container = new UIView (); View.AddSubview (_container); _container.Frame = _container.Superview.Bounds; _container.BackgroundColor = UIColor.Gray; _imageView = new UIImageView (); _container.AddSubview (_imageView); _navigationBar = new UINavigationBar (); _navigationBar.Frame = new RectangleF (0f, 0f, 320f, 55f); _navigationBar.BarStyle = UIBarStyle.Default; UINavigationItem navItems = new UINavigationItem { LeftBarButtonItem = new UIBarButtonItem("Меню", UIBarButtonItemStyle.Plain, OnMenuButtonPressed) }; _navigationBar.Items = new UINavigationItem[] { navItems }; _container.AddSubview(_navigationBar); _sideBarMediator = new SideBarMediator(this, _container, _sideBar, 260f); SetImage(UIImage.FromFile("wishlist.png")); }
public override void ViewDidLoad() { base.ViewDidLoad (); _thread = new Thread(ThreadEntry); // Container for the controls _containerView = new UIView(); _containerView.Frame = new RectangleF(0,-20,320,480); // The background loading image _imageView = new UIImageView(); _imageView.Image = UIImage.FromFile("Default.png"); _imageView.Frame = new RectangleF(0,0,320,480); _containerView.AddSubview(_imageView); // The pulser _activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); _activityView.Frame = new RectangleF(115,280,20,20); _containerView.AddSubview(_activityView); _activityView.StartAnimating(); // Label saying wait _label = new UILabel(); _label.Frame = new RectangleF(140,280,250,20); _label.Font = UIFont.SystemFontOfSize(14f); _label.BackgroundColor = UIColor.Clear; _label.TextColor = UIColor.White; _label.ShadowColor = UIColor.Black; _label.Text = "Loading..."; _containerView.AddSubview(_label); View.AddSubview(_containerView); }
public static void ShowPanel(string title, UIView view, Action<Dictionary<string, object>> editingEndedBlock) { MKEntryPanel panel = GetPanel (); panel.closeBlock = editingEndedBlock; panel.titleLabel.Text = title; panel.titleLabel.BackgroundColor = UIColor.Clear; panel.entryField.Font = UIFont.FromName ("DINPro-Medium", 16); panel.entryField.LeftView = new UIView (new RectangleF(0, 0, 5, 31)); panel.entryField.LeftViewMode = UITextFieldViewMode.Always; panel.entryField.Background = CashflowTheme.SharedTheme.TextBackground.CreateResizableImage (new UIEdgeInsets(5, 10, 5, 10)); panel.valueField.Font = UIFont.FromName ("DINPro-Medium", 16); panel.valueField.RightView = new UIView (new RectangleF(0, 0, 5, 31)); panel.valueField.RightViewMode = UITextFieldViewMode.Always; panel.valueField.Background = CashflowTheme.SharedTheme.TextBackground.CreateResizableImage (new UIEdgeInsets(5, 10, 5, 10)); panel.valueField.TextAlignment = UITextAlignment.Right; panel.entryField.BecomeFirstResponder (); panel.dimView = new UIControl (UIScreen.MainScreen.Bounds); CATransition transition = CATransition.CreateAnimation (); transition.Duration = kAnimationDuration; transition.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseInEaseOut); transition.Type = CATransition.TransitionFade.ToString (); panel.dimView.Layer.AddAnimation (transition, null); panel.dimView.BackgroundColor = UIColor.Black; panel.dimView.Alpha = 0.8f; panel.dimView.TouchDown += (sender, e) => panel.CancelTapped (); view.AddSubview (panel.dimView); view.AddSubview (panel); }
private UIView CreateAccessory() { RectangleF app = UIScreen.MainScreen.ApplicationFrame; const float btnWidth = 40; const float btnHeight = 40; const float margin = 5; _accessory = new UIView(new RectangleF(0, 0, 1, btnHeight)); _accessory.BackgroundColor = UIColor.White; _accessory.ClipsToBounds = true; _accessory.Layer.BorderWidth = 1/UIScreen.MainScreen.Scale; _accessory.Layer.BorderColor = UIColor.LightGray.CGColor; _back = new UIButton(UIButtonType.System); _back.Frame = new RectangleF(app.Width - btnWidth - margin - btnWidth - margin - btnWidth, 0, btnWidth, btnHeight); _back.SetTitle("<", UIControlState.Normal); _back.TouchUpInside += HandleBack; _accessory.AddSubview(_back); _next = new UIButton(UIButtonType.System); _next.Frame = new RectangleF(app.Width - btnWidth - margin - btnWidth, 0, btnWidth, btnHeight); _next.SetTitle(">", UIControlState.Normal); _next.TouchUpInside += HandleNext; _accessory.AddSubview(_next); _cancel = new UIButton(UIButtonType.System); _cancel.Frame = new RectangleF(app.Width - btnWidth, 0, btnWidth, btnHeight); _cancel.SetTitle("x", UIControlState.Normal); _cancel.TouchUpInside += HandleCancel; _accessory.AddSubview(_cancel); return _accessory; }
public override void ViewDidLoad() { base.ViewDidLoad (); UIView header = new UIView(new System.Drawing.RectangleF(0, 0, 0, 184f)); UIImageView imageView = new UIImageView(new System.Drawing.RectangleF(0, 40f, 100f, 100f)); imageView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; imageView.Image = UIImage.FromBundle("avatar.jpg"); imageView.Layer.MasksToBounds = true; imageView.Layer.CornerRadius = 50f; imageView.Layer.BorderColor = UIColor.White.CGColor; imageView.Layer.BorderWidth = 3f; imageView.Layer.RasterizationScale = UIScreen.MainScreen.Scale; imageView.Layer.ShouldRasterize = true; imageView.ClipsToBounds = true; UILabel label = new UILabel(new System.Drawing.RectangleF(0, 150f, 0, 24f)){ Text = "Roman Efimov", Font = UIFont.SystemFontOfSize(21f), BackgroundColor = UIColor.Clear, TextColor = UIColor.FromRGBA(62/255f, 68/255f, 75/255f, 1f) }; label.SizeToFit(); label.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; header.AddSubview(imageView); header.AddSubview(label); TableView.SeparatorColor = UIColor.FromRGBA(150/255f, 161/255f, 177/255f, 1f); TableView.Source = new DEMOTableSource(this); TableView.Opaque = false; TableView.BackgroundColor = UIColor.Clear; TableView.TableHeaderView = header; }
public override void ViewDidLoad() { base.ViewDidLoad (); UIView view = new UIView(new RectangleF(0,0,320,396)) { BackgroundColor = UIColor.GroupTableViewBackgroundColor }; textName.Placeholder = "your note name"; textName.BorderStyle = UITextBorderStyle.RoundedRect; view.AddSubview(textName); textBody.Placeholder = "your note body"; textBody.BorderStyle = UITextBorderStyle.RoundedRect; view.AddSubview(textBody); this.View.AddSubview(view); if (_isUpdateMode()) { this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem("Update", UIBarButtonItemStyle.Bordered, _updateNote), false); SetToolbarItems(new UIBarButtonItem[]{ new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null), new UIBarButtonItem(UIBarButtonSystemItem.Trash, _deleteNote) }, false); } else this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Save, _saveNote), false); }
//最開始執行的程式 public SampleMain(UIView pContainer) { mContainer = pContainer; mLabel = new UILabel (); mLabel.Frame = new RectangleF (10, 10, 300, 100); mIncButton = new UIButton (UIButtonType.RoundedRect); mIncButton.Frame = new RectangleF (10, 110, 100, 80); mDecButton = new UIButton (UIButtonType.RoundedRect); mDecButton.Frame = new RectangleF (120, 110, 100, 80); mContainer.AddSubview (mLabel); mContainer.AddSubview (mIncButton); mContainer.AddSubview (mDecButton); // Simple MVC Start! mModel = new Model ();//要實體化model後才能夠在裡面存東西 mTextView = new TextViews (mLabel);//把會因為model改變的Label丟進LabelView裡面 mTextView.Model = mModel;//當然還要告訴view說model是誰 mController = new Controllers (mModel);//control當然也要知道model是誰,所以把model丟進去 mController.AddIncButton (mIncButton);//把會在mvc中用到的控制項作設定 mController.AddDecButton (mDecButton); Console.WriteLine ("MVC Start!"); // Simple MVC End! }
/// <summary> /// /// </summary> public UIViewDatePicker (UIView owner) { // save our uiview owner this.owner = owner; // configure the title label titleLabel.BackgroundColor = UIColor.Clear; titleLabel.TextColor = UIColor.LightTextColor; titleLabel.Font = UIFont.BoldSystemFontOfSize (18); // configure the done button doneButton.SetTitle ("done", UIControlState.Normal); //doneButton.TouchUpInside += (s, e) => { actionSheet.DismissWithClickedButtonIndex (0, true); }; doneButton.TouchUpInside += async (sender, e) => { Hide(true); }; // create + configure the action sheet datePickerView = new UIView () { }; //actionSheet.Clicked += (s, e) => { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); }; // add our controls to the action sheet datePickerView.AddSubview (datePicker); datePickerView.AddSubview (titleLabel); datePickerView.AddSubview (doneButton); }
public static UIView BuildHeaderView(string caption) { UIView view = new UIView(new RectangleF(0,0,320,23)); UIImageView background = new UIImageView(Resources.SectionHeaderBackground); background.Frame = view.Frame; UILabel label = new UILabel(); label.BackgroundColor = UIColor.Clear; label.Opaque = false; label.TextColor = UIColor.FromRGB(119,119,119); //label.HighlightedTextColor = UIColor.White; label.Font = UIFont.BoldSystemFontOfSize(13.5f); //UIFont.FromName("Helvetica Neue Bold", 13.5f); label.Frame = new RectangleF(8,0,200,23); label.Text = caption; //var layer = label.Layer; label.ShadowColor = UIColor.FromRGBA(255,255,255,128); //layer.ShadowRadius = 5f; label.ShadowOffset = new SizeF(0, 1); //layer.ShadowOpacity = 1.0f; view.AddSubview(background); view.AddSubview(label); return view; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { App_Window = new UIWindow(UIScreen.MainScreen.Bounds); var vc = new UIViewController(); var view = new UIView(); var button = UIButton.FromType(UIButtonType.RoundedRect); button.Frame = new RectangleF(0, 0, 100, 40); button.SetTitle("Do It", UIControlState.Normal); button.TouchDown += delegate { Test_JSON(); }; view.AddSubview(button); Browser = new UIWebView(); Browser.Frame = new RectangleF(0, 50, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height-50); view.AddSubview(Browser); vc.View = view; App_Window.RootViewController = vc; App_Window.MakeKeyAndVisible(); return true; }
public DisabledView(OverlayDetails details) : base (details) { var bounds = UIScreen.MainScreen.ApplicationFrame; SetFrame (); container = new UIView (); container.Frame = new CoreGraphics.CGRect (0, 0, bounds.Width, 65); var label1 = new UILabel (); label1.Frame = new CoreGraphics.CGRect (0, 10, bounds.Width, 20); label1.TextAlignment = UITextAlignment.Center; label1.Text = "Something bad happened."; container.AddSubview (label1); var label2 = new UILabel (); label2.Frame = new CoreGraphics.CGRect (0, 35, bounds.Width, 20); label2.TextAlignment = UITextAlignment.Center; label2.Text = "Try your request again."; container.AddSubview (label2); // derive the center x and y nfloat centerX = Frame.Width / 2; nfloat centerY = Frame.Height / 2; container.Frame = new CGRect ( centerX - (container.Frame.Width / 2) , centerY - (container.Frame.Height /2), container.Frame.Width , container.Frame.Height); AddSubview (container); }
//Recipe 2-1 Adding Nested Subviews public override void LoadView() { //Create the main view RectangleF appRect = UIScreen.MainScreen.ApplicationFrame; contentView = new UIView(appRect); contentView.BackgroundColor = UIColor.Green; //Provide support for autorotation and resizing contentView.AutosizesSubviews = true; contentView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View = contentView; // reset the origin point for subviews. The new origin is 0, 0 appRect.Location = new PointF(0.0f, 0.0f); //Add the subviews, each stepped by 32 pixels on each side var subview = new UIView(RectangleF.Inflate(appRect, -32.0f, -32.0f)); subview.BackgroundColor = UIColor.Clear; contentView.AddSubview(subview); subview = new UIView(RectangleF.Inflate(appRect, -64.0f, -64.0f)); subview.BackgroundColor = UIColor.DarkGray; contentView.AddSubview(subview); subview = new UIView(RectangleF.Inflate(appRect, -96.0f, -96.0f)); subview.BackgroundColor = UIColor.Black; contentView.AddSubview(subview); }
public Task SaveAndLaunchFile(Stream stream, string fileType) { if (OriginView == null) return Task.FromResult(true); var data = NSData.FromStream(stream); var width = 824; var height = 668; var popoverView = new UIView(new RectangleF(0, 0, width, height)); popoverView.BackgroundColor = UIColor.White; var webView = new UIWebView(); webView.Frame = new RectangleF(0, 45, width, height - 45); var b = new UIButton(UIButtonType.RoundedRect); b.SetTitle("Done", UIControlState.Normal); b.Frame = new RectangleF(10,10, 60, 25); b.TouchUpInside += (o, e) => _popoverController.Dismiss(true); popoverView.AddSubview(b); popoverView.AddSubview(webView); var bundlePath = NSBundle.MainBundle.BundlePath; System.Diagnostics.Debug.WriteLine(bundlePath); webView.LoadData(data, "application/pdf", "utf-8", NSUrl.FromString("http://google.com")); var popoverContent = new UIViewController(); popoverContent.View = popoverView; _popoverController = new UIPopoverController(popoverContent); _popoverController.PopoverContentSize = new SizeF(width, height); _popoverController.PresentFromRect(new RectangleF(OriginView.Frame.Width/2, 50, 1, 1), OriginView, UIPopoverArrowDirection.Any, true); _popoverController.DidDismiss += (o, e) => _popoverController = null; return Task.FromResult(true); }
public override void LoadView() { View = new UIView(); View.BackgroundColor = UIColor.LightGray; RectangleF f = new RectangleF(10,10,300, 44); UsernameTextField = new UITextField(f) { Placeholder = "Username", BorderStyle = UITextBorderStyle.RoundedRect, AutocapitalizationType = UITextAutocapitalizationType.None, AutocorrectionType = UITextAutocorrectionType.No }; View.AddSubview(UsernameTextField); f.Offset(new PointF(0, f.Height + 10)); PasswordTextField = new UITextField(f) { Placeholder = "Password", BorderStyle = UITextBorderStyle.RoundedRect, SecureTextEntry = true }; View.AddSubview(PasswordTextField); f.Offset(new PointF(0, f.Height + 10)); UIButton button = UIButton.FromType(UIButtonType.RoundedRect); button.SetTitle("Login", UIControlState.Normal); button.Frame = f; button.TouchUpInside += LoginHandler; View.AddSubview(button); }
public override UIView GetView( UIPickerView pickerView, nint row, nint component, UIView view ) { nfloat width = pickerView.RowSizeForComponent(component).Width; nfloat height = pickerView.RowSizeForComponent(component).Height; var pickerCustomView = new UIView { Frame = new CGRect(0, 0, width - 10, height) }; var pickerImageView = new UIImageView { Frame = new CGRect(20, height/4, height/2, height/2) }; var pickerViewLabel = new UILabel { Frame = new CGRect(20 + height, 0, width - 10, height) }; pickerCustomView.AddSubview(pickerImageView); pickerCustomView.AddSubview(pickerViewLabel); Category category = CategoryHelper.AllCategories[(int) row]; pickerImageView.Image = new UIImage(category.IconSource); pickerViewLabel.BackgroundColor = UIColor.Clear; pickerViewLabel.Text = category.Name; pickerViewLabel.TextColor = category.Color.ToUIColor(); return pickerCustomView; }
public override UIView GetViewForHeader(UITableView tableView, nint section) { if (section == 0) { var view = new UIView (new CGRect (0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 80)); view.BackgroundColor = UIColor.FromRGB(13, 146, 198); var containerView = new UIView (new CGRect (0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 90)); containerView.AddSubview (view); var foodImageView = new UIButton (UIButtonType.Custom); foodImageView.SetImage (UIImage.FromFile ("food.png"), UIControlState.Normal); foodImageView.SetTitle ("Food", UIControlState.Normal); foodImageView.SetTitleColor (UIColor.White, UIControlState.Normal); foodImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted); foodImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0); foodImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0); foodImageView.TitleLabel.TextAlignment = UITextAlignment.Center; foodImageView.Frame = new CGRect (10, 10, 50, 60); containerView.AddSubview (foodImageView); var firmImageView = new UIButton (UIButtonType.Custom); firmImageView.SetImage (UIImage.FromFile ("firm.png"), UIControlState.Normal); firmImageView.SetTitle ("Firm", UIControlState.Normal); firmImageView.SetTitleColor (UIColor.White, UIControlState.Normal); firmImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted); firmImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0); firmImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0); firmImageView.TitleLabel.TextAlignment = UITextAlignment.Center; firmImageView.Frame = new CGRect (90, 10, 50, 60); containerView.AddSubview (firmImageView); var hotelImageView = new UIButton (UIButtonType.Custom); hotelImageView.SetImage (UIImage.FromFile ("hotel.png"), UIControlState.Normal); hotelImageView.SetTitle ("Hotel", UIControlState.Normal); hotelImageView.SetTitleColor (UIColor.White, UIControlState.Normal); hotelImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted); hotelImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0); hotelImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0); hotelImageView.TitleLabel.TextAlignment = UITextAlignment.Center; hotelImageView.Frame = new CGRect (170, 10, 50, 60); containerView.AddSubview (hotelImageView); var voiceImageView = new UIButton (UIButtonType.Custom); voiceImageView.SetImage (UIImage.FromFile ("voice.png"), UIControlState.Normal); voiceImageView.SetTitle ("Voice", UIControlState.Normal); voiceImageView.SetTitleColor (UIColor.White, UIControlState.Normal); voiceImageView.SetTitleColor (UIColor.Gray, UIControlState.Highlighted); voiceImageView.ImageEdgeInsets = new UIEdgeInsets (-25, 5, 0, 0); voiceImageView.TitleEdgeInsets = new UIEdgeInsets (30, -36, 0, 0); voiceImageView.TitleLabel.TextAlignment = UITextAlignment.Center; voiceImageView.Frame = new CGRect (250, 10, 50, 60); containerView.AddSubview (voiceImageView); return containerView; } return base.GetViewForHeader (tableView, section); }
public override void LoadView () { UIView baseView = new UIView (); baseView.BackgroundColor = UIColor.FromWhiteAlpha (0f, .15f); UIView view = new UIView (new RectangleF (-100f, -50f, 240f, 120f)) { AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleRightMargin, BackgroundColor = UIColor.FromPatternImage (UIImage.FromBundle ("barBackground")) }; baseView.AddSubview (view); UIButton cancelButton = UIButton.FromType (UIButtonType.System); cancelButton.TouchUpInside += close; cancelButton.TranslatesAutoresizingMaskIntoConstraints = false; cancelButton.SetTitle ("Cancel", UIControlState.Normal); view.AddSubview (cancelButton); UIButton postButton = UIButton.FromType (UIButtonType.System); postButton.TouchUpInside += post; postButton.TranslatesAutoresizingMaskIntoConstraints = false; postButton.SetTitle ("Post", UIControlState.Normal); view.AddSubview (postButton); messageTextView = new UITextView () { BackgroundColor = UIColor.Clear, TranslatesAutoresizingMaskIntoConstraints = false }; view.AddSubview (messageTextView); NSDictionary views = NSDictionary.FromObjectsAndKeys ( new NSObject[] { postButton, cancelButton, messageTextView }, new NSString[] { new NSString ("postButton"), new NSString ("cancelButton"), new NSString ("messageTextView") } ); baseView.AddConstraints (NSLayoutConstraint.FromVisualFormat ( "|-8-[messageTextView]-8-|", (NSLayoutFormatOptions)0, null, views) ); baseView.AddConstraints (NSLayoutConstraint.FromVisualFormat ( "|-8-[cancelButton]->=20-[postButton]-8-|", (NSLayoutFormatOptions)0, null, views) ); baseView.AddConstraints (NSLayoutConstraint.FromVisualFormat ( "V:|-8-[messageTextView]-[cancelButton]-8-|", (NSLayoutFormatOptions)0, null, views) ); baseView.AddConstraints (NSLayoutConstraint.FromVisualFormat ( "V:|-8-[messageTextView]-[postButton]-8-|", (NSLayoutFormatOptions)0, null, views) ); View = baseView; }
public ChatBubbleCell (bool isLeft, bool isAttaPresent, bool delivered) : base (UITableViewCellStyle.Default, isLeft ? KeyLeft : KeyRight){ var rect = new RectangleF (0, 0, 1, 1); this.isLeft = isLeft; view = new UIView (rect); if(delivered){ imageView = new UIImageView (isLeft ? left : right); }else imageView = new UIImageView (sendfalied); view.AddSubview (imageView); font = UIFont.PreferredBody; infoFont = UIFont.PreferredCaption1; label = new UILabel (rect) { LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Font = font, TextColor = (isLeft ? UIColor.Black : UIColor.White), BackgroundColor = UIColor.Clear }; view.AddSubview (label); senderLabel = new UILabel (rect) { Lines = 1, TextAlignment = (isLeft ? UITextAlignment.Left : UITextAlignment.Right), Font = infoFont, TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear }; view.AddSubview (senderLabel); icon = UIImage.FromFile("Images/lock_30.png"); var imgRect = new RectangleF (0, 0, 15, 15); imgView = new UIImageView(icon); imageView.Frame = imgRect; view.AddSubview (imgView); undelivered = new UIButton (UIButtonType.DetailDisclosure); this.undelivered.TouchDown += (sender, e) => new UIAlertView("Error", "Error sending message", null, "OK", null).Show(); undelivered.TintColor = UIColor.Red; undelivered.Hidden = true; view.AddSubview (undelivered); ContentView.Add (view); canDelete = true; }
public override void ViewDidLoad() { base.ViewDidLoad (); this.View.AddSubview (tableView); headerView = new UIView (new RectangleF (0, -kRefreshViewHeight, this.View.Frame.Width, kRefreshViewHeight)); headerView.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor; tableView.AddSubview (headerView); var transform = CATransform3D.Identity; transform.m34 = -1/500.0f; headerView.Layer.SublayerTransform = transform; // add the perspective topView = new UIView (new RectangleF (0, -kRefreshViewHeight / 4, headerView.Bounds.Size.Width, kRefreshViewHeight / 2.0f)); topView.BackgroundColor = new UIColor (0.886f, 0.906f, 0.929f, 1); topView.Layer.AnchorPoint = new PointF (0.5f, 0.0f); headerView.AddSubview (topView); topLabel = new UILabel (topView.Bounds); topLabel.BackgroundColor = UIColor.Clear; topLabel.TextAlignment = UITextAlignment.Center; topLabel.Text = "Pull down to refresh"; topLabel.TextColor = new UIColor (0.395f, 0.427f, 0.510f, 1); topLabel.ShadowColor = UIColor.FromWhiteAlpha (1, 0.7f); topLabel.ShadowOffset = new SizeF (0, 1); topView.AddSubview (topLabel); bottomView = new UIView (new RectangleF (0, kRefreshViewHeight * 3 / 4, headerView.Bounds.Size.Width, kRefreshViewHeight / 2)); bottomView.BackgroundColor = new UIColor (0.836f, 0.856f, 0.879f, 1); bottomView.Layer.AnchorPoint = new PointF (0.5f, 1.0f); headerView.AddSubview (bottomView); bottomLabel = new UILabel (bottomView.Bounds); bottomLabel.BackgroundColor = UIColor.Clear; bottomLabel.Text = "Last updated: 1/11/13 8:41 PM"; bottomLabel.TextAlignment = UITextAlignment.Center; bottomLabel.TextColor = UIColor.FromRGBA (0.395f, 0.427f, 0.510f, 1); bottomLabel.ShadowColor = UIColor.FromWhiteAlpha (1.0f, 0.7f); bottomLabel.ShadowOffset = new SizeF (0, 1); bottomView.AddSubview (bottomLabel); // Just so it's not white above the refresh view. var aboveView = new UIView (new RectangleF (0, -this.View.Bounds.Size.Height, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - kRefreshViewHeight)); aboveView.BackgroundColor = UIColor.FromRGB (0.886f, 0.906f, 0.929f); aboveView.Tag = 123; this.tableView.AddSubview (aboveView); refreshing = false; this.TableView.Scrolled += HandleTableViewhandleScrolled; this.TableView.DraggingEnded += HandleTableViewhandleDraggingEnded; }
public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; this.Title = "Contact Us"; var contacts = new List<ContactUsInfo> () { new ContactUsInfo{ ContactName = "Immediate Assistance", ContactNumber = "8007435274", ContactHours = "M-F 8am - 9pm ET", ContactDescription = "After entering in your Social Security number and PIN, press '1' for account information, then '0' to speak with a representative." }, new ContactUsInfo{ ContactName = "Retired or Terminated?", ContactNumber = "8007435274", ContactHours = "M-F 8am - 6pm ET", ContactDescription = "After entering in your Social Security number and PIN, press '2' to speak with a representative." } }; var divider = new UIView(new CGRect (0 , 60f, View.Frame.Width , 1f)) { Alpha = 0.5f, BackgroundColor = UIColor.Clear.FromHexString(RSColors.RS_LIGHT_GRAY) }; var scrollFrame = new CGRect (0, 61f, View.Frame.Width, View.Frame.Height); ContactView = new UIView (scrollFrame); var TableViewFrame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height *7/8); var ContactTableView = new UITableView (TableViewFrame); var TableViewSource = new ContactUsTableViewSource (this); TableViewSource.Data = contacts; ContactTableView.TableFooterView = new UIView (new CGRect (0, 0, 0, 0)); ContactTableView.Source = TableViewSource; ContactView.AddSubview (divider); ContactView.AddSubview (ContactTableView); View.AddSubview (divider); View.AddSubview (ContactView); }
public void Show(string text) { // figure out parent UIView parentView = null; if ((UIApplication.SharedApplication().keyWindow.rootViewController != null) && (UIApplication.SharedApplication().keyWindow.rootViewController.view != null)) parentView = UIApplication.SharedApplication().keyWindow.rootViewController.view; else parentView = UIApplication.SharedApplication().keyWindow; var frame = parentView.bounds; // create view if (_activityView == null) { _activityView = new UIView(frame); _activityView.alpha = 0.8f; _activityView.backgroundColor = UIColor.BlackColor(); _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); _activityIndicator.hidesWhenStopped = false; _activityView.AddSubview(_activityIndicator); _activityLabel = new UILabel(frame); _activityLabel.textAlignment = NSTextAlignment.Center; _activityLabel.backgroundColor = UIColor.ClearColor(); _activityLabel.textColor = UIColor.WhiteColor(); _activityLabel.numberOfLines = 2; _activityView.AddSubview(_activityLabel); } // re-set frames _activityView.frame = frame; var indiFrame = _activityIndicator.frame; indiFrame.x = frame.width / 2 - indiFrame.width / 2; indiFrame.y = frame.height / 2 - indiFrame.height / 2; _activityIndicator.frame = indiFrame; var labelFrame = new Rect(0, indiFrame.yMax, frame.width, indiFrame.height * 2); _activityLabel.frame = labelFrame; _activityLabel.text = text; // add it to parent if (_activityView.superview == null) { _activityIndicator.StartAnimating(); parentView.AddSubview(_activityView); } }
public CollapsibleSection(string caption, bool isCollapsed) : base(caption) { this.isCollapsed = isCollapsed; imageView = new UIImageView(new RectangleF(300,0,20,20)); imageView.Image = isCollapsed ? UIImage.FromBundle("chevrondown.png") : UIImage.FromBundle("chevronup.png"); HeaderView = new UIView(new RectangleF(0,0,200,20)); titleLabel = new UILabel(new RectangleF(5,0,200,20)); titleLabel.BackgroundColor = UIColor.Clear; titleLabel.Text = caption; HeaderView.AddSubview(titleLabel); HeaderView.BackgroundColor = UIColor.LightGray; HeaderView.AddSubview(imageView); HeaderView.AddGestureRecognizer(new UITapGestureRecognizer(x => SectionTapped() )); }
public BubbleVisualization () { SFMap maps = new SFMap (); view = new UIView (); view.Frame=new CGRect(0,0,300,400); busyindicator = new SFBusyIndicator (); busyindicator.ViewBoxWidth=75; busyindicator.ViewBoxHeight=75; busyindicator.Foreground= UIColor.FromRGB (0x77, 0x97, 0x72); /*#779772*/ busyindicator.AnimationType=SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSlicedCircle; view.AddSubview (busyindicator); label = new UILabel (); label.TextAlignment = UITextAlignment.Center; label.Text = "Top Population Countries With Bubbles"; label.Font = UIFont.SystemFontOfSize (18); label.Frame=new CGRect(0,0,300,40); label.TextColor = UIColor.Black; view.AddSubview (label); NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (0.3), delegate { maps.Frame = new CGRect(Frame.Location.X,60,Frame.Size.Width-6,Frame.Size.Height-60); view.AddSubview (maps); }); SFShapeFileLayer layer = new SFShapeFileLayer (); layer.Uri = (NSString)NSBundle.MainBundle.PathForResource ("world1", "shp"); layer.DataSource = GetDataSource(); SFBubbleMarkerSetting marker = new SFBubbleMarkerSetting (); marker.MaxSize = 75; marker.MinSize = 55; marker.ValuePath = (NSString)"Population"; SFShapeSetting shapeSettings = new SFShapeSetting (); shapeSettings.valuePath = (NSString)"Country"; shapeSettings.Fill = UIColor.FromRGB (0xA9,0xD9,0xF7); shapeSettings.StrokeColor = UIColor.White; layer.ShapeSettings = shapeSettings; layer.ShowMapItems = true; layer.BubbleMarkerSetting = marker; maps.Layers.Add (layer); AddSubview (view); maps.Delegate = new MapsBubbleDelegate (this); control = this; }
public ADVPopoverProgressBar(RectangleF frame, ADVProgressBarColor barColor): base(frame) { bgImageView = new UIImageView(new RectangleF(0, 0, frame.Width, 24)); bgImageView.Image = UIImage.FromFile("progress-track.png"); this.AddSubview(bgImageView); progressFillImage = UIImage.FromFile("progress-fill.png").CreateResizableImage(new UIEdgeInsets(0, 20, 0, 40)); progressImageView = new UIImageView(new RectangleF(-2, 0, 0, 32)); this.AddSubview(progressImageView); percentView = new UIView(new RectangleF(5, 4, PERCENT_VIEW_WIDTH, 15)); percentView.Hidden = true; UILabel percentLabel = new UILabel(new RectangleF(0, 0, PERCENT_VIEW_WIDTH, 14)); percentLabel.Tag = 1; percentLabel.Text = "0%"; percentLabel.BackgroundColor = UIColor.Clear; percentLabel.TextColor = UIColor.Black; percentLabel.Font = UIFont.BoldSystemFontOfSize(11); percentLabel.TextAlignment = UITextAlignment.Center; percentLabel.AdjustsFontSizeToFitWidth = true; percentView.AddSubview(percentLabel); this.AddSubview(percentView); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new UIViewController(); var view = new UIView (UIScreen.MainScreen.Bounds); view.BackgroundColor = UIColor.White; controller.View = view; controller.NavigationItem.Title = "SignalR Client"; var textView = new UITextView(new CGRect(0, 0, 320, view.Frame.Height - 0)); view.AddSubview (textView); navController = new UINavigationController (controller); window.RootViewController = navController; window.MakeKeyAndVisible(); if (SIGNALR_DEMO_SERVER == "http://YOUR-SERVER-INSTANCE-HERE") { textView.Text = "You need to configure the app to point to your own SignalR Demo service. Please see the Getting Started Guide for more information!"; return true; } var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView); var client = new CommonClient(traceWriter); client.RunAsync(SIGNALR_DEMO_SERVER); return true; }
public PdfViewController (NSUrl url) : base() { Url = url; View = new UIView (); View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; View.AutosizesSubviews = true; PdfDocument = CGPDFDocument.FromUrl (Url.ToString ()); // For demo purposes, show first page only. PdfPage = PdfDocument.GetPage (1); PdfPageRect = PdfPage.GetBoxRect (CGPDFBox.Crop); // Setup tiled layer. TiledLayer = new CATiledLayer (); TiledLayer.Delegate = new TiledLayerDelegate (this); TiledLayer.TileSize = new SizeF (1024f, 1024f); TiledLayer.LevelsOfDetail = 5; TiledLayer.LevelsOfDetailBias = 5; TiledLayer.Frame = PdfPageRect; ContentView = new UIView (PdfPageRect); ContentView.Layer.AddSublayer (TiledLayer); // Prepare scroll view. ScrollView = new UIScrollView (View.Frame); ScrollView.AutoresizingMask = View.AutoresizingMask; ScrollView.Delegate = new ScrollViewDelegate (this); ScrollView.ContentSize = PdfPageRect.Size; ScrollView.MaximumZoomScale = 10f; ScrollView.MinimumZoomScale = 1f; ScrollView.ScrollEnabled = true; ScrollView.AddSubview (ContentView); View.AddSubview (ScrollView); }
public override void ViewDidLoad () { loadingBg = new UIView (this.View.Frame) { BackgroundColor = UIColor.Black, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge) { AutoresizingMask = UIViewAutoresizing.FlexibleMargins }; loadingView.Frame = new CGRect ((this.View.Frame.Width - loadingView.Frame.Width) / 2, (this.View.Frame.Height - loadingView.Frame.Height) / 2, loadingView.Frame.Width, loadingView.Frame.Height); loadingBg.AddSubview (loadingView); View.AddSubview (loadingBg); loadingView.StartAnimating (); scannerView = new AVCaptureScannerView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay; scannerView.CustomOverlayView = this.Scanner.CustomOverlay; scannerView.TopText = this.Scanner.TopText; scannerView.BottomText = this.Scanner.BottomText; scannerView.CancelButtonText = this.Scanner.CancelButtonText; scannerView.FlashButtonText = this.Scanner.FlashButtonText; scannerView.OnCancelButtonPressed += () => { Scanner.Cancel (); }; this.View.AddSubview(scannerView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; }
public override void ViewDidLoad() { base.ViewDidLoad (); // _refreshTable = new RefreshTableView(this.View.Bounds); // _refreshTable.RefreshRequested += delegate(object sender, EventArgs e) { // Console.WriteLine("Refresh Requested"); // NSTimer.CreateScheduledTimer(new TimeSpan(0, 0, 2), // delegate { _refreshTable.RefreshConcluded(); }); // }; // _refreshTable.Source = new DemoTableSource(_refreshTable); // this.View.AddSubview(_refreshTable); UIView view = new UIView(new RectangleF(0, 40, this.View.Bounds.Width, 100)); view.BackgroundColor = UIColor.Red; _refreshScroll = new FGRefreshScrollView(view.Bounds); _refreshScroll.RefreshRequested += delegate(object sender, EventArgs e) { Console.WriteLine("Refresh Requested"); NSTimer.CreateScheduledTimer(new TimeSpan(0, 0, 2), delegate { _refreshScroll.RefreshConcluded(); }); }; _refreshScroll.Delegate = new DemoScrollDelegate(_refreshScroll); _refreshScroll.ContentSize = new SizeF(view.Bounds.Width + 1, view.Bounds.Height); view.AddSubview(_refreshScroll); this.View.AddSubview(view); }
public BubbleCell (bool isLeft) : base (UITableViewCellStyle.Default, isLeft ? KeyLeft : KeyRight) { var rect = new RectangleF (0, 0, 1, 1); this.isLeft = isLeft; view = new UIView (rect); imageView = new UIImageView (isLeft ? left : right); view.AddSubview (imageView); label = new UILabel (rect) { LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Font = font, BackgroundColor = UIColor.Clear }; view.AddSubview (label); ContentView.Add (view); }
public override void ViewDidLoad() { base.ViewDidLoad(); var view = new UIView { BackgroundColor = UIColor.White }; var label = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, Text = "No Conversation Selected", TextColor = UIColor.FromWhiteAlpha(0.0f, 0.4f), Font = UIFont.PreferredHeadline }; view.AddSubview(label); view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterX, 1.0f, 0.0f)); view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, view, NSLayoutAttribute.CenterY, 1.0f, 0.0f)); View = view; }
public void AddItem(SatelliteMenuButtonItem menuItem) { _menuItems.Add(menuItem); var button = new UIButton(new CGRect(0, 0, menuItem.ItemImage.CGImage.Width / UIScreen.MainScreen.Scale, menuItem.ItemImage.CGImage.Height / UIScreen.MainScreen.Scale)); button.SetBackgroundImage(menuItem.ItemImage, UIControlState.Normal); menuItem.ImageChanged = delegate { button.SetBackgroundImage(menuItem.ItemImage, UIControlState.Normal); }; button.TouchUpInside += HandleTouchUpInsideButton; _buttonItems.Add(button); _parentView?.AddSubview(button); button.Center = Center; }
public static OnboardingContentViewItem ItemOnView(UIView view) { var item = new OnboardingContentViewItem(CoreGraphics.CGRect.Empty); item.BackgroundColor = UIColor.Clear; item.TranslatesAutoresizingMaskIntoConstraints = false; view.AddSubview(item); //Add constraints item.ConstraintOps((obj) => { obj.Attribute = NSLayoutAttribute.Height; obj.Constant = 10000; obj.Relation = NSLayoutRelation.LessThanOrEqual; }); (view, item).ConstraintOps((obj) => obj.Attribute = NSLayoutAttribute.Leading); (view, item).ConstraintOps((obj) => obj.Attribute = NSLayoutAttribute.Trailing); (view, item).ConstraintOps((obj) => obj.Attribute = NSLayoutAttribute.CenterX); (view, item).ConstraintOps((obj) => obj.Attribute = NSLayoutAttribute.CenterY); return(item); }
protected override void OnAttached() { view = Control ?? Container; view.UserInteractionEnabled = true; layer = new UIView { Alpha = 0, Opaque = false, UserInteractionEnabled = false }; view.AddSubview(layer); layer.TranslatesAutoresizingMaskIntoConstraints = false; layer.TopAnchor.ConstraintEqualTo(view.TopAnchor).Active = true; layer.LeftAnchor.ConstraintEqualTo(view.LeftAnchor).Active = true; layer.BottomAnchor.ConstraintEqualTo(view.BottomAnchor).Active = true; layer.RightAnchor.ConstraintEqualTo(view.RightAnchor).Active = true; view.BringSubviewToFront(layer); touchEvents = new TouchEvents(); touchRecognizer = new TouchEventsGestureRecognizer(touchEvents); touchRecognizer.Delegate = new ShouldRecognizeSimultaneouslyRecognizerDelegate(); view.AddGestureRecognizer(touchRecognizer); touchEvents.TouchBegin += OnTouchBegin; touchEvents.TouchEnd += OnTouchEnd; touchEvents.TouchCancel += OnTouchEnd; UpdateEffectColor(); }
public override void ViewDidLoad() { loadingBg = new UIView(this.View.Frame) { BackgroundColor = UIColor.Black, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }; loadingView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { AutoresizingMask = UIViewAutoresizing.FlexibleMargins }; loadingView.Frame = new CGRect((this.View.Frame.Width - loadingView.Frame.Width) / 2, (this.View.Frame.Height - loadingView.Frame.Height) / 2, loadingView.Frame.Width, loadingView.Frame.Height); loadingBg.AddSubview(loadingView); View.AddSubview(loadingBg); loadingView.StartAnimating(); scannerView = new ZXingScannerView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height)); scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay; scannerView.CustomOverlayView = this.Scanner.CustomOverlay; scannerView.TopText = this.Scanner.TopText; scannerView.BottomText = this.Scanner.BottomText; scannerView.CancelButtonText = this.Scanner.CancelButtonText; scannerView.FlashButtonText = this.Scanner.FlashButtonText; scannerView.OnCancelButtonPressed += delegate { Scanner.Cancel(); }; //this.View.AddSubview(scannerView); this.View.InsertSubviewBelow(scannerView, loadingView); this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; }
void MakeButtons(int num) { float maxWidth = this.View.Bounds.Width - 2 * frame; float maxHeight = this.View.Bounds.Height; // Set size buttonView.Bounds = new RectangleF(0, 0, maxWidth, 45 * num); // Delete buttons while (buttons.Count > num) { buttons[buttons.Count - 1].RemoveFromSuperview(); buttons.RemoveAt(buttons.Count - 1); } // Create new buttons while (buttons.Count < num) { int pos = buttons.Count; UIButton button = UIButton.FromType(UIButtonType.RoundedRect); button.Tag = pos; button.Bounds = new RectangleF(0, 0, maxWidth, 35); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin; button.SetTitleColor(Colors.ButtonText, UIControlState.Normal); button.SetBackgroundImage(Images.BlueButton, UIControlState.Normal); button.SetBackgroundImage(Images.BlueButtonHighlight, UIControlState.Highlighted); button.TouchUpInside += OnTouchUpInside; buttons.Add(button); buttonView.AddSubview(button); } for (int i = 0; i < buttons.Count; i++) { buttons[i].Frame = new RectangleF(0, i * 45, maxWidth, 35); } }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _resultTextView = new UITextView { TextColor = ApplicationTheme.ForegroundColor, Text = "Tap a shape to see its relationship with the others.", Editable = false, ScrollEnabled = false, }; _stackView = new UIStackView(new UIView[] { _myMapView, _resultTextView }); _stackView.Distribution = UIStackViewDistribution.FillEqually; _stackView.TranslatesAutoresizingMaskIntoConstraints = false; _stackView.Axis = UILayoutConstraintAxis.Vertical; // Add the views. View.AddSubview(_stackView); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _stackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _stackView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _stackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _stackView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); var controller = new UIViewController(); var view = new UIView(UIScreen.MainScreen.Bounds); view.BackgroundColor = UIColor.White; controller.View = view; controller.NavigationItem.Title = "SignalR Client"; var textView = new UITextView(new RectangleF(0, 0, 320, view.Frame.Height - 0)); view.AddSubview(textView); navController = new UINavigationController(controller); window.RootViewController = navController; window.MakeKeyAndVisible(); if (SIGNALR_DEMO_SERVER == "http://YOUR-SERVER-INSTANCE-HERE") { textView.Text = "You need to configure the app to point to your own SignalR Demo service. Please see the Getting Started Guide for more information!"; return(true); } var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView); var client = new CommonClient(traceWriter); client.RunAsync(SIGNALR_DEMO_SERVER); return(true); }
public static void AddChildViewControllerAndView( [NotNull] this UIViewController parentViewController, [CanBeNull] UIViewController childViewController, [NotNull] UIView parentView) { if (parentViewController == null) { throw new ArgumentNullException(nameof(parentViewController)); } if (parentView == null) { throw new ArgumentNullException(nameof(parentView)); } if (childViewController != null) { parentViewController.AddChildViewController(childViewController); childViewController.View.NotNull().Frame = parentView.Bounds; parentView.AddSubview(childViewController.View); parentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); parentView.AddConstraints(childViewController.View.FullSizeOf(parentView)); childViewController.DidMoveToParentViewController(parentViewController); } }
public ShadowContainerView(UIView childView) { TranslatesAutoresizingMaskIntoConstraints = false; Layer.ShadowColor = UIColor.Black.CGColor; Layer.ShadowRadius = 1; Layer.ShadowOpacity = 0.5f; Layer.ShadowOffset = new CoreGraphics.CGSize(0, 0); var innerContainer = new UIView { ClipsToBounds = true }; innerContainer.Layer.CornerRadius = ApplicationTheme.CornerRadius; innerContainer.TranslatesAutoresizingMaskIntoConstraints = false; AddSubview(innerContainer); innerContainer.AddSubview(childView); childView.TranslatesAutoresizingMaskIntoConstraints = false; childView.Layer.CornerRadius = ApplicationTheme.CornerRadius; childView.ClipsToBounds = true; NSLayoutConstraint.ActivateConstraints(new[] { childView.LeadingAnchor.ConstraintEqualTo(innerContainer.LeadingAnchor), childView.TrailingAnchor.ConstraintEqualTo(innerContainer.TrailingAnchor), childView.TopAnchor.ConstraintEqualTo(innerContainer.TopAnchor), childView.BottomAnchor.ConstraintEqualTo(innerContainer.BottomAnchor), innerContainer.LeadingAnchor.ConstraintEqualTo(LeadingAnchor), innerContainer.TrailingAnchor.ConstraintEqualTo(TrailingAnchor), innerContainer.BottomAnchor.ConstraintEqualTo(BottomAnchor), innerContainer.TopAnchor.ConstraintEqualTo(TopAnchor) }); }
void OnDidSelectAnnotationView(object sender, MKAnnotationViewEventArgs e) { try { var customView = e.View as CustomMKPinAnnotationView; customPinView = new UIView(); if (customView.Id == "Xamarin") { customPinView.Frame = new CGRect(0, 0, 200, 84); var image = new UIImageView(new CGRect(0, 0, 200, 84)); //image.Image = UIImage.FromFile ("cat1.png"); customPinView.AddSubview(image); customPinView.Center = new CGPoint(0, -(e.View.Frame.Height + 75)); e.View.AddSubview(customPinView); } bar_id = Convert.ToInt32(customPin.Details); bar_id = Convert.ToInt32(customView.Url); formsMap.PinTapped.Execute(formsMap.PinTapped); } catch (Exception ex) { } }
private UIView CreateSnapshot(UIView view, bool afterUpdates, float offset, bool left) { CGSize size = view.Frame.Size; UIView containerView = view.Superview; float foldWidth = (float)(size.Width * 0.5f / Folds); UIView snapshotView; if (!afterUpdates) { // create a regular snapshot var snapshotRegion = new CGRect(offset, 0f, foldWidth, size.Height); snapshotView = view.ResizableSnapshotView(snapshotRegion, afterUpdates, UIEdgeInsets.Zero); } else { // for the to- view for some reason the snapshot takes a while to create. Here we place the snapshot within // another view, with the same bckground color, so that it is less noticeable when the snapshot initially renders snapshotView = new UIView(new CGRect(0f, 0f, foldWidth, size.Height)); snapshotView.BackgroundColor = view.BackgroundColor; var snapshotRegion = new CGRect(offset, 0f, foldWidth, size.Height); UIView snapshotView2 = view.ResizableSnapshotView(snapshotRegion, afterUpdates, UIEdgeInsets.Zero); snapshotView.AddSubview(snapshotView2); } // create a shadow UIView snapshotWithShadowView = AddShadowToView(snapshotView, left); // add to the container containerView.AddSubview(snapshotWithShadowView); // set the anchor to the left or right edge of the view snapshotWithShadowView.Layer.AnchorPoint = new CGPoint(left ? 0f : 1f, 0.5f); return(snapshotWithShadowView); }
/// <summary> /// Genera el objeto de drop down list /// </summary> /// <param name="field">Campo a donde se le agregará la selección</param> /// <param name="View">Vista en donde se pondrá el objeto</param> /// <param name="parent"></param> public UIDropdownList(UITextField field, UIView View, string parent = "") { List <string> data = new List <string>(); PickerItemsController items = new PickerItemsController(); field.Text = ""; switch (field.Placeholder) { case "País": data = items.GetPaises(); break; case "Estado": data = items.GetEstados(parent); break; case "Municipio": data = items.GetMunicipios(parent); break; case "Colonia": data = items.GetColonias(parent); break; case "Giro": data = items.GetGiros(); break; case "Genero": data = items.GetGeneros(); break; case "Sucursal": data = items.GetSucursales(); break; } View.AddSubview(new STLDropDownList(data, field)); }
public override void ViewDidLoad() { loadingBg = new UIView(this.View.Frame) { BackgroundColor = UIColor.Black, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; loadingView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { AutoresizingMask = UIViewAutoresizing.FlexibleMargins }; loadingView.Frame = new CGRect((View.Frame.Width - loadingView.Frame.Width) / 2, (View.Frame.Height - loadingView.Frame.Height) / 2, loadingView.Frame.Width, loadingView.Frame.Height); loadingBg.AddSubview(loadingView); View.AddSubview(loadingBg); loadingView.StartAnimating(); scannerView = new AVCaptureScannerView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, UseCustomOverlayView = Scanner.UseCustomOverlay, CustomOverlayView = Scanner.CustomOverlay, TopText = Scanner.TopText, BottomText = Scanner.BottomText, CancelButtonText = Scanner.CancelButtonText, FlashButtonText = Scanner.FlashButtonText }; scannerView.OnCancelButtonPressed += () => Scanner.Cancel(); View.AddSubview(scannerView); View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; }
/// <summary> /// Initializes a new instance of the <see cref="T:AiForms.Renderers.iOS.EntryCellView"/> class. /// </summary> /// <param name="formsCell">Forms cell.</param> public EntryCellView(Cell formsCell) : base(formsCell) { ValueField = new UITextField() { BorderStyle = UITextBorderStyle.None }; ValueField.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; ValueField.ReturnKeyType = UIReturnKeyType.Done; ValueField.EditingChanged += _textField_EditingChanged; ValueField.EditingDidBegin += ValueField_EditingDidBegin; ValueField.EditingDidEnd += ValueField_EditingDidEnd; ValueField.ShouldReturn = OnShouldReturn; _EntryCell.Focused += EntryCell_Focused; _FieldWrapper = new UIView(); _FieldWrapper.AutosizesSubviews = true; _FieldWrapper.SetContentHuggingPriority(100f, UILayoutConstraintAxis.Horizontal); _FieldWrapper.SetContentCompressionResistancePriority(100f, UILayoutConstraintAxis.Horizontal); _FieldWrapper.AddSubview(ValueField); ContentStack.AddArrangedSubview(_FieldWrapper); }
private void InitShowDialog() { CoverView = new UIView(FixView.Bounds); CoverView.BackgroundColor = UIColor.FromRGB(64, 64, 64).ColorWithAlpha(0.95f); CoverView.AddGestureRecognizer(new UITapGestureRecognizer(() => { ShowData(); })); DialogView = new UIView(new CGRect(10, (FixView.Bounds.Height - 400) / 2, FixView.Bounds.Width - 20, 400)); DialogView.Layer.CornerRadius = 9; DialogView.Layer.BackgroundColor = UIColor.White.CGColor; tableView = new UITableView(); tableView.RowHeight = UITableView.AutomaticDimension; tableView.EstimatedRowHeight = 50f; tableView.AutoresizingMask = UIViewAutoresizing.All; tableView.Frame = new CGRect(10, 10, DialogView.Frame.Width - 20, DialogView.Frame.Height - 20); tableView.SeparatorColor = UIColor.Clear; tableView.BackgroundColor = UIColor.Clear; galleryDirectorySource = new GalleryDirectorySource(galleryDirectories, this); tableView.Source = galleryDirectorySource; DialogView.AddSubview(tableView); CoverView.AddSubview(DialogView); }
protected override void LayoutContent(UIView container, ContentSet content, LayoutSet layout) { _message = new UITextView(); _message.Frame = new RectangleF(layout.margin, layout.offset + 2, layout.contentWidth, 40); _message.Editable = false; _message.Text = D.PLAESE_WAIT_DATA_IS_LOADED; _message.TextColor = LogonController.GRAY; _message.BackgroundColor = UIColor.Clear; _message.TextAlignment = UITextAlignment.Center; _message.Font = UIFont.FromName("Arial", 12); container.AddSubview(_message); UIView indicatorContainer = new UIView(); indicatorContainer.Frame = new RectangleF(layout.margin, _message.Frame.Bottom + 2, layout.contentWidth, 20); indicatorContainer.BackgroundColor = UIColor.White; indicatorContainer.Layer.BorderColor = LogonController.GRAY.CGColor; indicatorContainer.Layer.BorderWidth = 1; indicatorContainer.Layer.CornerRadius = layout.cornerRadius; indicatorContainer.Layer.MasksToBounds = true; indicatorContainer.ClipsToBounds = true; _indicator = new UIProgressView(); _indicator.Frame = new RectangleF(10, 8, indicatorContainer.Frame.Width - 20, indicatorContainer.Frame.Height - 15); _indicator.TintColor = BaseColor; indicatorContainer.AddSubview(_indicator); container.AddSubview(indicatorContainer); _progress = new UILabel(); _progress.Frame = new RectangleF(layout.margin, indicatorContainer.Frame.Bottom + 2, layout.contentWidth, 40); _progress.BackgroundColor = UIColor.Clear; _progress.TextColor = LogonController.GRAY; _progress.Text = ""; _progress.TextAlignment = UITextAlignment.Center; container.AddSubview(_progress); }
public void AddToView(UIView v) { v.AddSubview(Background); v.AddSubview(TitleView); v.AddSubview(ImageView); v.AddSubview(DescView); v.AddSubview(StudentsView); Back.Render(v); nfloat ScrollHeight = 0f; for (int i = 0; i < Messages.Count; i++) { Messages[i].SetY((int)ScrollHeight); Messages[i].AddToView(MessageScroll); ScrollHeight += 256; } MessageScroll.ContentSize = new CGSize(C.X_MAX, ScrollHeight + 128); v.AddSubview(MessageScroll); }
public override void LayoutSubviews() { foreach (var view in this.Subviews) { view.Frame = new CGRect(Frame.X, 0, Frame.Width, Frame.Height); } CreateOptionView(); scheduleEditor.Editor.Frame = new CGRect(0, 0, this.Frame.Size.Width, this.Frame.Size.Height); scheduleEditor.scrollView.Frame = new CGRect(scheduleEditor.Editor.Frame.X + 10, scheduleEditor.Editor.Frame.Y + 10, scheduleEditor.Editor.Frame.Size.Width - 10, scheduleEditor.Editor.Frame.Size.Height); scheduleEditor.EditorFrameUpdate(); UIImageView image1 = new UIImageView(); UIImageView image2 = new UIImageView(); UIImageView image3 = new UIImageView(); moveToDate = new UIButton(); editorView = new UIButton(); monthText = new UILabel(); headerView = new UIView(); headerView.BackgroundColor = UIColor.FromRGB(214, 214, 214); NSDate today = new NSDate(); NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents components = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); NSDate startDate = calendar.DateFromComponents(components); NSDateFormatter dateFormat = new NSDateFormatter(); dateFormat.DateFormat = "MMMM YYYY"; string monthName = dateFormat.ToString(startDate); monthText.Text = monthName; monthText.TextColor = UIColor.Black; monthText.TextAlignment = UITextAlignment.Left; moveToDate.AddSubview(image2); headerButton.AddSubview(image1); editorView.AddSubview(image3); string[] tableItems = new string[] { "Day", "Week", "WorkWeek", "Month" }; tableView = new UITableView(); tableView.Frame = new CGRect(0, 0, this.Frame.Size.Width / 2, 60.0f * 4); tableView.Hidden = true; tableView.Source = new ScheduleTableSource(tableItems); string deviceType = UIDevice.CurrentDevice.Model; if (deviceType == "iPhone" || deviceType == "iPod touch") { image1.Frame = new CGRect(0, 0, 60, 60); image1.Image = UIImage.FromFile("black-09.png"); image2.Frame = new CGRect(0, 0, 60, 60); image2.Image = UIImage.FromFile("black-11.png"); image3.Frame = new CGRect(0, 0, 60, 60); image3.Image = UIImage.FromFile("black-10.png"); headerView.Frame = new CGRect(0, 0, this.Frame.Size.Width, 50); moveToDate.Frame = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50); editorView.Frame = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50); headerButton.Frame = new CGRect(-10, -10, this.Frame.Size.Width / 8, 50); monthText.Frame = new CGRect(this.Frame.Size.Width / 8, -10, this.Frame.Size.Width / 2, 60); schedule.Frame = new CGRect(0, 50, this.Frame.Size.Width, this.Frame.Size.Height - 50); } else { schedule.DayViewSettings.WorkStartHour = 7; schedule.DayViewSettings.WorkEndHour = 18; schedule.WeekViewSettings.WorkStartHour = 7; schedule.WeekViewSettings.WorkEndHour = 18; schedule.WorkWeekViewSettings.WorkStartHour = 7; schedule.WorkWeekViewSettings.WorkEndHour = 18; image1.Frame = new CGRect(0, 0, 80, 80); image1.Image = UIImage.FromFile("black-09.png"); image2.Frame = new CGRect(0, 0, 80, 80); image2.Image = UIImage.FromFile("black-11.png"); image3.Frame = new CGRect(0, 0, 80, 80); image3.Image = UIImage.FromFile("black-10.png"); headerView.Frame = new CGRect(0, 0, this.Frame.Size.Width, 60); moveToDate.Frame = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2) + (this.Frame.Size.Width / 8), -10, this.Frame.Size.Width / 8, 50); editorView.Frame = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50); headerButton.Frame = new CGRect(0, -10, this.Frame.Size.Width / 8, 50); monthText.Frame = new CGRect(this.Frame.Size.Width / 8, 5, this.Frame.Size.Width / 2, 50); schedule.Frame = new CGRect(0, 60, this.Frame.Size.Width, this.Frame.Size.Height - 60); } moveToDate.TouchUpInside += MoveToDate_TouchUpInside; headerButton.TouchUpInside += HeaderButton_TouchUpInside; editorView.TouchUpInside += EditorView_TouchUpInside; headerView.AddSubview(moveToDate); headerView.AddSubview(editorView); headerView.AddSubview(monthText); headerView.AddSubview(headerButton); this.AddSubview(schedule); this.AddSubview(headerView); this.AddSubview(scheduleEditor.Editor); this.AddSubview(tableView); base.LayoutSubviews(); }
public PrayerCard(Rock.Client.PrayerRequest prayer, CGRect bounds) { //setup the actual "card" outline View = PlatformView.Create( ); View.Bounds = new System.Drawing.RectangleF((float)bounds.X, (float)bounds.Y, (float)bounds.Width, (float)bounds.Height); View.BackgroundColor = ControlStylingConfig.BG_Layer_Color; View.BorderColor = ControlStylingConfig.BG_Layer_BorderColor; View.CornerRadius = ControlStylingConfig.Button_CornerRadius; View.BorderWidth = ControlStylingConfig.BG_Layer_BorderWidth; // ensure we clip children ((UIView)View.PlatformNativeObject).ClipsToBounds = true; // setup the prayer request text field PrayerText = new PrayerTextView( ); PrayerText.Editable = false; PrayerText.BackgroundColor = UIColor.Clear; PrayerText.Layer.AnchorPoint = new CGPoint(0, 0); PrayerText.DelaysContentTouches = false; // don't allow delaying touch, we need to forward it PrayerText.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor); PrayerText.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); PrayerText.TextContainerInset = UIEdgeInsets.Zero; PrayerText.TextContainer.LineFragmentPadding = 0; // setup the bottom prayer button, and its fill-in circle PrayerActionButton = UIButton.FromType(UIButtonType.Custom); PrayerActionButton.Layer.AnchorPoint = new CGPoint(0, 0); PrayerActionButton.SetTitle(PrayerStrings.Prayer_Before, UIControlState.Normal); PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal); PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(Rock.Mobile.Graphics.Util.ScaleRGBAColor(ControlStylingConfig.TextField_PlaceholderTextColor, 2, false)), UIControlState.Highlighted); PrayerActionButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); PrayerActionButton.SizeToFit( ); PrayerActionCircle = new UIView( ); PrayerActionCircle.Bounds = new CGRect(0, 0, 100, 100); PrayerActionCircle.Layer.CornerRadius = PrayerActionCircle.Bounds.Width / 2; PrayerActionCircle.Layer.BorderWidth = 1; PrayerActionCircle.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor).CGColor; PrayerActionCircle.Layer.AnchorPoint = new CGPoint(0, 0); PrayerActionButton.TouchUpInside += (object sender, EventArgs e) => { TogglePrayed(true); }; // setup the name field NameLayer = new UIView( ); NameLayer.Layer.AnchorPoint = new CGPoint(0, 0); NameLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor; NameLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor); Name = new UILabel( ); Name.Layer.AnchorPoint = new CGPoint(0, 0); Name.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor); Name.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize); Name.BackgroundColor = UIColor.Clear; Name.LineBreakMode = UILineBreakMode.TailTruncation; // setup the date field DateLayer = new UIView( ); DateLayer.Layer.AnchorPoint = new CGPoint(0, 0); DateLayer.Layer.BorderWidth = 1; DateLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor; DateLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor); Date = new UILabel( ); Date.Layer.AnchorPoint = new CGPoint(0, 0); Date.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor); Date.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize); Date.BackgroundColor = UIColor.Clear; // setup the category field CategoryLayer = new UIView( ); CategoryLayer.Layer.AnchorPoint = new CGPoint(0, 0); CategoryLayer.Layer.BorderWidth = 1; CategoryLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor; CategoryLayer.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor); Category = new UILabel( ); Category.Layer.AnchorPoint = new CGPoint(0, 0); Category.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor); Category.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize); Category.BackgroundColor = UIColor.Clear; Category.LineBreakMode = UILineBreakMode.TailTruncation; Category.AdjustsFontSizeToFitWidth = false; // add the controls UIView nativeView = View.PlatformNativeObject as UIView; nativeView.AddSubview(NameLayer); nativeView.AddSubview(Name); nativeView.AddSubview(CategoryLayer); nativeView.AddSubview(Category); nativeView.AddSubview(DateLayer); nativeView.AddSubview(Date); nativeView.AddSubview(PrayerText); nativeView.AddSubview(PrayerActionCircle); nativeView.AddSubview(PrayerActionButton); PrayerText.Parent = nativeView; SetPrayer(prayer); }
public override void Draw(CGRect rect) { var color = Color.CGColor.Components; UIGraphics.BeginImageContext(new CGSize(30, 20)); var ctx = UIGraphics.GetCurrentContext(); ctx.SetFillColor(color[0], color[1], color[2], 1); ctx.SetShadow(CGSize.Empty, 7f, UIColor.Black.CGColor); ctx.AddLines(new[] { new CGPoint(15, 5), new CGPoint(25, 25), new CGPoint(5, 25) }); ctx.ClosePath(); ctx.FillPath(); var viewImage = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); var imgframe = new CGRect(ShowOnRect.X + (ShowOnRect.Width - 30) / 2, ShowOnRect.Height / 2 + ShowOnRect.Y, 30, 13); var img = new UIImageView(viewImage); AddSubview(img); img.TranslatesAutoresizingMaskIntoConstraints = false; var dict = new NSDictionary("img", img); img.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat($@"H:|-{imgframe.X.ToString(CultureInfo.InvariantCulture)}-[img({imgframe.Width.ToString(CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); img.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat($@"V:|-{imgframe.Y.ToString(CultureInfo.InvariantCulture)}-[img({imgframe.Height.ToString(CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); var font = UIFont.FromName(FontName, FontSize); var message = new NSAttributedString(Message, font); var size = message.GetBoundingRect(new CGSize(FieldFrame.Width - PaddingInErrorPopUp * 2, 1000), NSStringDrawingOptions.UsesLineFragmentOrigin, null).Size; size = new CGSize((nfloat)Math.Ceiling(size.Width), (nfloat)Math.Ceiling(size.Height)); var view = new UIView(CGRect.Empty); InsertSubviewBelow(view, img); view.BackgroundColor = Color; view.Layer.CornerRadius = 5f; view.Layer.ShadowColor = UIColor.Black.CGColor; view.Layer.ShadowRadius = 5f; view.Layer.Opacity = 1f; view.Layer.ShadowOffset = CGSize.Empty; view.TranslatesAutoresizingMaskIntoConstraints = false; dict = new NSDictionary("view", view); view.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( $@"H:|-{(FieldFrame.X + (FieldFrame.Width - (size.Width + PaddingInErrorPopUp*2))).ToString(CultureInfo.InvariantCulture)}-[view({(size.Width + PaddingInErrorPopUp*2) .ToString(CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); view.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( $@"V:|-{(imgframe.Y + imgframe.Height).ToString(CultureInfo.InvariantCulture)}-[view({(size.Height + PaddingInErrorPopUp*2).ToString( CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); var lbl = new UILabel(CGRect.Empty) { Font = font, Lines = 0, BackgroundColor = UIColor.Clear, Text = Message, TextColor = FontColor }; view.AddSubview(lbl); lbl.TranslatesAutoresizingMaskIntoConstraints = false; dict = new NSDictionary("lbl", lbl); lbl.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( $@"H:|-{PaddingInErrorPopUp.ToString(CultureInfo.InvariantCulture)}-[lbl({size.Width.ToString(CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); lbl.Superview.AddConstraints( NSLayoutConstraint.FromVisualFormat( $@"V:|-{PaddingInErrorPopUp.ToString(CultureInfo.InvariantCulture)}-[lbl({size.Height.ToString(CultureInfo.InvariantCulture)})]", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, dict)); }
public void loadOptionView() { subView = new UIScrollView(); subView.ContentSize = new CGSize(Frame.Width, 400); //autoReverse autoReverse = new UILabel(); autoReverse.TextColor = UIColor.Black; autoReverse.BackgroundColor = UIColor.Clear; autoReverse.Text = @"Auto Reverse"; autoReverse.TextAlignment = UITextAlignment.Left; autoReverse.Font = UIFont.FromName("Helvetica", 14f); contentView.AddSubview(autoReverse); //autoSwitch autoSwitch = new UISwitch(); autoSwitch.ValueChanged += autoReverseToggleChanged; autoSwitch.On = false; autoSwitch.OnTintColor = UIColor.FromRGB(50, 150, 221); contentView.AddSubview(autoSwitch); //spinLabel spinLabel = new UILabel(); spinLabel.TextColor = UIColor.Black; spinLabel.BackgroundColor = UIColor.Clear; spinLabel.Text = @"Spin Alignment"; spinLabel.TextAlignment = UITextAlignment.Left; spinLabel.Font = UIFont.FromName("Helvetica", 14f); contentView.AddSubview(spinLabel); //spinAlignmentButton spinAlignmentButton = new UIButton(); spinAlignmentButton.SetTitle("Right", UIControlState.Normal); spinAlignmentButton.Font = UIFont.FromName("Helvetica", 14f); spinAlignmentButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; spinAlignmentButton.BackgroundColor = UIColor.Clear; spinAlignmentButton.SetTitleColor(UIColor.Black, UIControlState.Normal); spinAlignmentButton.Hidden = false; spinAlignmentButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; spinAlignmentButton.Layer.BorderWidth = 4; spinAlignmentButton.Layer.CornerRadius = 8; spinAlignmentButton.TouchUpInside += ShowSpinPicker; contentView.AddSubview(spinAlignmentButton); //minimumLabel minimumLabel = new UILabel(); minimumLabel.Text = "Minimum"; minimumLabel.TextColor = UIColor.Black; minimumLabel.TextAlignment = UITextAlignment.Left; minimumLabel.Font = UIFont.FromName("Helvetica", 14f); //maximumLabel maximumLabel = new UILabel(); maximumLabel.Text = "Maximum"; maximumLabel.TextColor = UIColor.Black; maximumLabel.TextAlignment = UITextAlignment.Left; maximumLabel.Font = UIFont.FromName("Helvetica", 14f); contentView.AddSubview(minimumLabel); contentView.AddSubview(maximumLabel); //minimumText minimumText = new UITextView(); minimumText.TextAlignment = UITextAlignment.Center; minimumText.Layer.BorderColor = UIColor.Black.CGColor; minimumText.BackgroundColor = UIColor.FromRGB(246, 246, 246); minimumText.KeyboardType = UIKeyboardType.NumberPad; minimumText.Text = "0"; minimumText.Font = UIFont.FromName("Helvetica", 14f); minimumText.Changed += (object sender, EventArgs e) => { if (minimumText.Text.Length > 0) { adultNumericUpDown.Minimum = nfloat.Parse(minimumText.Text); infantsNumericUpDown.Minimum = nfloat.Parse(minimumText.Text); } }; contentView.AddSubview(minimumText); //maximumText maximumText = new UITextView(); maximumText.TextAlignment = UITextAlignment.Center; maximumText.Layer.BorderColor = UIColor.Black.CGColor; maximumText.BackgroundColor = UIColor.FromRGB(246, 246, 246); maximumText.KeyboardType = UIKeyboardType.NumberPad; maximumText.Text = "100"; maximumText.Font = UIFont.FromName("Helvetica", 14f); maximumText.Changed += (object sender, EventArgs e) => { if (maximumText.Text.Length > 0) { adultNumericUpDown.Maximum = nfloat.Parse(maximumText.Text); infantsNumericUpDown.Maximum = nfloat.Parse(maximumText.Text); } }; contentView.AddSubview(maximumText); //spinPicker PickerModel culturePickermodel = new PickerModel(this.cultureList); culturePickermodel.PickerChanged += (sender, e) => { this.cultureSelectedType = e.SelectedValue; spinAlignmentButton.SetTitle(cultureSelectedType, UIControlState.Normal); if (cultureSelectedType == "Right") { adultNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Right; infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Right; adultNumericUpDown.TextAlignment = UITextAlignment.Left; infantsNumericUpDown.TextAlignment = UITextAlignment.Left; } else if (cultureSelectedType == "Left") { adultNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Left; infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Left; adultNumericUpDown.TextAlignment = UITextAlignment.Right; infantsNumericUpDown.TextAlignment = UITextAlignment.Right; } else if (cultureSelectedType == "Both") { adultNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Both; infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Both; adultNumericUpDown.TextAlignment = UITextAlignment.Center; infantsNumericUpDown.TextAlignment = UITextAlignment.Center; } }; spinPicker = new UIPickerView(); spinPicker.ShowSelectionIndicator = true; spinPicker.Hidden = true; spinPicker.Model = culturePickermodel; spinPicker.BackgroundColor = UIColor.Gray; contentView.AddSubview(spinPicker); //cultureDoneButton cultureDoneButton = new UIButton(); cultureDoneButton.SetTitle("Done\t", UIControlState.Normal); cultureDoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; cultureDoneButton.BackgroundColor = UIColor.FromRGB(240, 240, 240); cultureDoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal); cultureDoneButton.Hidden = true; cultureDoneButton.Font = UIFont.FromName("Helvetica", 14f); cultureDoneButton.TouchUpInside += HideSpinPicker; contentView.AddSubview(cultureDoneButton); //propertyLabel propertyLabel = new UILabel(); propertyLabel.Text = "OPTIONS"; subView.AddSubview(propertyLabel); subView.BackgroundColor = UIColor.FromRGB(230, 230, 230); contentView.BackgroundColor = UIColor.FromRGB(240, 240, 240); subView.AddSubview(contentView); this.AddSubview(subView); //ShowPropertyButton showPropertyButton = new UIButton(); showPropertyButton.Hidden = true; showPropertyButton.SetTitle(" OPTIONS\t", UIControlState.Normal); showPropertyButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; showPropertyButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); showPropertyButton.SetTitleColor(UIColor.Black, UIControlState.Normal); showPropertyButton.TouchUpInside += (object sender, EventArgs e) => { subView.Hidden = false; showPropertyButton.Hidden = true; }; this.AddSubview(showPropertyButton); //closeButton closeButton = new UIButton(); closeButton.SetTitle("X\t", UIControlState.Normal); closeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; closeButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal); closeButton.TouchUpInside += (object sender, EventArgs e) => { subView.Hidden = true; showPropertyButton.Hidden = false;; }; subView.AddSubview(closeButton); //Adding Gesture UITapGestureRecognizer tapgesture = new UITapGestureRecognizer(() => { subView.Hidden = true; showPropertyButton.Hidden = false; } ); propertyLabel.UserInteractionEnabled = true; propertyLabel.AddGestureRecognizer(tapgesture); }
public static TView AddTo <TView>(this TView origin, UIView target) where TView : UIView { target.AddSubview(origin); return(origin); }
public RadioButton_Mobile() { View = new UIView(); //Main statck layer.BorderWidth = 1.5f; layer.CornerRadius = 10; layer.BorderColor = UIColor.FromRGB(205, 205, 205).CGColor; Layer.AddSublayer(layer); //inner layer innerLayer.BorderWidth = 1.5f; innerLayer.CornerRadius = 10; innerLayer.BorderColor = UIColor.FromRGB(205, 205, 205).CGColor; mainStackView.Layer.AddSublayer(innerLayer); descriptor = new UIFontDescriptor().CreateWithFamily(amntLabl.Font.FamilyName); traits = traits | UIFontDescriptorSymbolicTraits.Bold; descriptor = descriptor.CreateWithTraits(traits); //heading hedinglbl.Text = "Complete your Payment"; hedinglbl.TextColor = UIColor.FromRGB(85, 85, 85); hedinglbl.Font = UIFont.FromDescriptor(descriptor, 20); mainStackView.AddSubview(hedinglbl); //payable payamountlabl.Text = "Total payable amount"; payamountlabl.TextColor = UIColor.Black; mainStackView.AddSubview(payamountlabl); //amount amntLabl.Text = "$120"; amntLabl.TextColor = UIColor.FromRGB(0, 125, 230); amntLabl.Font = UIFont.FromDescriptor(descriptor, 18); mainStackView.AddSubview(amntLabl); //amount selcetPaylbl.Text = "Select your payment mode"; mainStackView.AddSubview(selcetPaylbl); //RadioGroup sfr.Axis = UILayoutConstraintAxis.Vertical; sfr.Spacing = 20; netBanking.SetTitle("Net banking", UIControlState.Normal); netBanking.StateChanged += paymentMode_StateChanged; sfr.AddArrangedSubview(netBanking); debitCard.SetTitle("Debit card", UIControlState.Normal); debitCard.StateChanged += paymentMode_StateChanged; sfr.AddArrangedSubview(debitCard); creditCard.SetTitle("Credit card", UIControlState.Normal); creditCard.StateChanged += paymentMode_StateChanged; sfr.AddArrangedSubview(creditCard); mainStackView.AddSubview(sfr); View.AddSubview(mainStackView); button.SetTitle("Pay Now", UIControlState.Normal); button.SetTitleColor(UIColor.LightGray, UIControlState.Disabled); button.SetTitleColor(UIColor.White, UIControlState.Normal); button.TouchDown += Button_Clicked; button.BackgroundColor = UIColor.FromRGB(0, 125, 230); button.Enabled = false; alertView.Message = "Payment Successfull !"; alertView.AddButton("OK"); View.AddSubview(button); AddSubview(View); }
public override void ViewDidLoad() { base.ViewDidLoad(); var bounds = View.Bounds; var backgroundColor = new UIColor(0.859f, 0.866f, 0.929f, 1); View.BackgroundColor = backgroundColor; // // Add the bubble chat interface // discussionHost = new UIView(new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height - entryHeight)) { AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth, AutosizesSubviews = true, UserInteractionEnabled = true }; View.AddSubview(discussionHost); discussion = new DialogViewController(UITableViewStyle.Plain, root, true); discussionHost.AddSubview(discussion.View); discussion.View.BackgroundColor = backgroundColor; // // Add styled entry // chatBar = new UIImageView(new RectangleF(0, bounds.Height - entryHeight, bounds.Width, entryHeight)) { ClearsContextBeforeDrawing = false, AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth, Image = UIImage.FromFile("ChatBar.png").StretchableImage(18, 20), UserInteractionEnabled = true }; View.AddSubview(chatBar); entry = new UITextView(new RectangleF(10, 9, 234, 22)) { ContentSize = new SizeF(234, 22), AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, ScrollEnabled = false, ScrollIndicatorInsets = new UIEdgeInsets(5, 0, 4, -2), ClearsContextBeforeDrawing = false, Font = UIFont.SystemFontOfSize(messageFontSize), DataDetectorTypes = UIDataDetectorType.All, BackgroundColor = UIColor.Clear, }; // Fix a scrolling glitch entry.ShouldChangeText = (textView, range, text) => { entry.ContentInset = new UIEdgeInsets(0, 0, 3, 0); return(true); }; previousContentHeight = entry.ContentSize.Height; chatBar.AddSubview(entry); // // The send button // sendButton = UIButton.FromType(UIButtonType.Custom); sendButton.ClearsContextBeforeDrawing = false; sendButton.Frame = new RectangleF(chatBar.Frame.Width - 70, 8, 64, 26); sendButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin; var sendBackground = UIImage.FromFile("SendButton.png"); sendButton.SetBackgroundImage(sendBackground, UIControlState.Normal); sendButton.SetBackgroundImage(sendBackground, UIControlState.Disabled); sendButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(16); sendButton.TitleLabel.ShadowOffset = new SizeF(0, -1); sendButton.SetTitle("Send", UIControlState.Normal); sendButton.SetTitleShadowColor(new UIColor(0.325f, 0.463f, 0.675f, 1), UIControlState.Normal); sendButton.AddTarget(SendMessage, UIControlEvent.TouchUpInside); DisableSend(); chatBar.AddSubview(sendButton); // // Listen to keyboard notifications to animate // showObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, PlaceKeyboard); hideObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, PlaceKeyboard); ScrollToBottom(false); // Track changes in the entry to resize the view accordingly entry.Changed += HandleEntryChanged; }
/// <summary> /// Initializes a new instance of the <see cref="T:SampleBrowser.LoadMoreSample"/> class. /// </summary> public LoadMoreSample() { carouselScrollview = new UIScrollView(); alertWindow = new UIAlertView(); alertWindow.AddButton("OK"); carouselViewModel = new CarouselViewModel(); LoadMoreLayout = new UIView(); LoadMoreLayout.BackgroundColor = UIColor.FromRGB(249, 249, 249); carouselScrollview.BackgroundColor = UIColor.FromRGB(249, 249, 249); applicationLabel = new UILabel(); applicationLabel.Text = "Application"; applicationLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); applicationLabel.Font = UIFont.FromName("Helvetica", 18f); applicationCarousel = new SFCarousel(); applicationCarousel.ItemWidth = 150; applicationCarousel.ItemHeight = 150; applicationCarousel.AllowLoadMore = true; applicationCarousel.LoadMoreItemsCount = 4; UILabel loadmore2 = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; loadmore2.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); UIView loadView2 = new UIView(); loadView2.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView2.AddSubview(loadmore2); applicationCarousel.LoadMoreView = loadView2; applicationCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; applicationCarousel.ItemsSource = carouselViewModel.ApplicationCollection; applicationCarousel.ItemSpacing = 15; applicationCarousel.DrawView += DrawAdapterView; foodLabel = new UILabel(); foodLabel.Text = "Food"; foodLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); foodLabel.Font = UIFont.FromName("Helvetica", 18f); foodCarousel = new SFCarousel(); foodCarousel.ItemWidth = 150; foodCarousel.ItemHeight = 150; foodCarousel.AllowLoadMore = true; foodCarousel.LoadMoreItemsCount = 4; UILabel loadmore = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; UIView loadView = new UIView(); loadmore.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); loadView.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView.AddSubview(loadmore); foodCarousel.LoadMoreView = loadView; foodCarousel.ItemSpacing = 15; foodCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; foodCarousel.ItemsSource = carouselViewModel.TransportCollection; foodCarousel.DrawView += DrawFoodAdapterView; LoadMoreLayout.AddSubview(applicationLabel); LoadMoreLayout.AddSubview(applicationCarousel); LoadMoreLayout.AddSubview(foodLabel); LoadMoreLayout.AddSubview(foodCarousel); bankingLabel = new UILabel(); bankingLabel.Text = "Banking"; bankingLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941")); bankingLabel.Font = UIFont.FromName("Helvetica", 18f); bankCarousel = new SFCarousel(); bankCarousel.ItemWidth = 150; bankCarousel.ItemHeight = 150; bankCarousel.AllowLoadMore = true; bankCarousel.LoadMoreItemsCount = 4; UILabel loadmore1 = new UILabel() { TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center }; UIView loadView1 = new UIView(); loadmore1.Frame = new CoreGraphics.CGRect(12, 61, 150, 17); loadView1.BackgroundColor = UIColor.FromRGB(255, 255, 255); loadView1.AddSubview(loadmore1); bankCarousel.LoadMoreView = loadView1; bankCarousel.ItemSpacing = 15; bankCarousel.ViewMode = SFCarouselViewMode.SFCarouselViewModeLinear; bankCarousel.ItemsSource = carouselViewModel.OfficeCollection; bankCarousel.DrawView += DrawBankAdapterView; LoadMoreLayout.AddSubview(applicationLabel); LoadMoreLayout.AddSubview(applicationCarousel); LoadMoreLayout.AddSubview(foodLabel); LoadMoreLayout.AddSubview(foodCarousel); LoadMoreLayout.AddSubview(bankingLabel); LoadMoreLayout.AddSubview(bankCarousel); carouselScrollview.AddSubview(LoadMoreLayout); this.AddSubview(carouselScrollview); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); presentController = GetVisibleViewController(); sfImageEditor = new SfImageEditor(new CGRect(View.Frame.Location.X, 60, View.Frame.Size.Width, View.Frame.Size.Height - 60)); sfImageEditor.ToolBarSettings.ToolbarItems.Clear(); sfImageEditor.ToolBarSettings.ToolbarItems.Add(new FooterToolbarItem() { Text = "Banner Types", SubItems = new System.Collections.Generic.List <ToolbarItem>() { new ToolbarItem() { Text = "Facebook Post" }, new ToolbarItem() { Text = "Facebook Cover" }, new ToolbarItem() { Text = "Twitter Cover" }, new ToolbarItem() { Text = "Twitter Post" }, new ToolbarItem() { Text = "YouTubeChannel Cover" } } }); sfImageEditor.ToolBarSettings.ToolbarItems.Add(new CustomHeader() { HeaderName = "Share", Icon = UIImage.FromBundle("Images/ImageEditor/share.png") }); sfImageEditor.ToolBarSettings.ToolbarItemSelected += ToolbarItemSelected; sfImageEditor.ImageSaved += ImageEditor_ImageSaved; sfImageEditor.Image = _image; this.View.AddSubview(sfImageEditor); CropSelectionMenu = new UIView(new CGRect(0, 60, View.Frame.Width, 50)); CropSelectionMenu.BackgroundColor = UIColor.White; UIButton okButton = new UIButton(new CGRect(0, 0, View.Frame.Width / 2, 50)); okButton.SetTitle("OK", UIControlState.Normal); okButton.SetTitleColor(UIColor.Black, UIControlState.Normal); okButton.TouchDown += (sender, e) => { sfImageEditor.Crop(); CropSelectionMenu.Hidden = true; }; CropSelectionMenu.AddSubview(okButton); UIButton cancelButton = new UIButton(new CGRect(View.Frame.Width / 2, 0, View.Frame.Width / 2, 50)); cancelButton.SetTitle("Cancel", UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Black, UIControlState.Normal); cancelButton.TouchDown += (sender, e) => { sfImageEditor.ToggleCropping(); CropSelectionMenu.Hidden = true; }; CropSelectionMenu.Hidden = true; CropSelectionMenu.AddSubview(cancelButton); View.AddSubview(CropSelectionMenu); }
void getRotatorItem() { SFRotatorItem item1 = new SFRotatorItem(); UIView view1 = new UIView(); UIImageView image1 = new UIImageView(); image1.Frame = view1.Frame; image1.Image = UIImage.FromFile("movie1.png"); item1.View = view1; view1.AddSubview(image1); SFRotatorItem item2 = new SFRotatorItem(); UIView view2 = new UIView(); UIImageView image2 = new UIImageView(); image2.Frame = view2.Frame; image2.Image = UIImage.FromFile("movie2.png"); item2.View = view2; view2.AddSubview(image2); SFRotatorItem item3 = new SFRotatorItem(); UIView view3 = new UIView(); UIImageView image3 = new UIImageView(); image3.Frame = view3.Frame; image3.Image = UIImage.FromFile("movie3.png"); item3.View = view3; view3.AddSubview(image3); SFRotatorItem item4 = new SFRotatorItem(); UIView view4 = new UIView(); UIImageView image4 = new UIImageView(); image4.Frame = view4.Frame; image4.Image = UIImage.FromFile("movie4.png"); item4.View = view4; view4.AddSubview(image4); SFRotatorItem item5 = new SFRotatorItem(); UIView view5 = new UIView(); UIImageView image5 = new UIImageView(); image5.Frame = view5.Frame; image5.Image = UIImage.FromFile("movie5.png"); item5.View = view5; view5.AddSubview(image5); SFRotatorItem item6 = new SFRotatorItem(); UIView view6 = new UIView(); UIImageView image6 = new UIImageView(); image6.Frame = view6.Frame; image6.Image = UIImage.FromFile("movie6.png"); item6.View = view6; view6.AddSubview(image6); SFRotatorItem item7 = new SFRotatorItem(); UIView view7 = new UIView(); UIImageView image7 = new UIImageView(); image7.Frame = view7.Frame; image7.Image = UIImage.FromFile("movie7.png"); item7.View = view7; view7.AddSubview(image7); image1.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image2.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image3.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image4.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image5.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image6.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; image7.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; array.Add(item1); array.Add(item2); array.Add(item3); array.Add(item4); array.Add(item5); //array.Add (item6); //array.Add (item7); }
void getPropertiesInitialization() { navigationModePicker = new UIPickerView(); navigationDirectionPicker = new UIPickerView(); tabStripPicker = new UIPickerView(); PickerModel navigationModeModel = new PickerModel(navigationModeList); navigationModePicker.Model = navigationModeModel; PickerModel navigationDirectionModel = new PickerModel(navigationDirectionList); navigationDirectionPicker.Model = navigationDirectionModel; PickerModel tabStripModel = new PickerModel(tabStripPositionList); tabStripPicker.Model = tabStripModel; //navigationModeLabel navigationModeLabel = new UILabel(); navigationModeLabel.Text = "NavigationStrip Mode"; navigationModeLabel.Font = UIFont.FromName("Helvetica", 14f); navigationModeLabel.TextColor = UIColor.Black; navigationModeLabel.TextAlignment = UITextAlignment.Left; navigationDirectionLabel = new UILabel(); navigationDirectionLabel.Text = "Navigation Direction"; navigationDirectionLabel.Font = UIFont.FromName("Helvetica", 14f); navigationDirectionLabel.TextColor = UIColor.Black; navigationDirectionLabel.TextAlignment = UITextAlignment.Left; tabStripLabel = new UILabel(); tabStripLabel.Text = "NavigationStrip Position"; tabStripLabel.Font = UIFont.FromName("Helvetica", 14f); tabStripLabel.TextColor = UIColor.Black; tabStripLabel.TextAlignment = UITextAlignment.Left; //navigationModeButton navigationModeButton = new UIButton(); navigationModeButton.SetTitle("Dots", UIControlState.Normal); navigationModeButton.Font = UIFont.FromName("Helvetica", 14f); navigationModeButton.SetTitleColor(UIColor.Black, UIControlState.Normal); navigationModeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; navigationModeButton.Layer.CornerRadius = 8; navigationModeButton.Layer.BorderWidth = 2; navigationModeButton.TouchUpInside += ShownavigationModePicker; navigationModeButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //navigationDirectionButton navigationDirectionButton = new UIButton(); navigationDirectionButton.SetTitle("Horizontal", UIControlState.Normal); navigationDirectionButton.Font = UIFont.FromName("Helvetica", 14f); navigationDirectionButton.SetTitleColor(UIColor.Black, UIControlState.Normal); navigationDirectionButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; navigationDirectionButton.Layer.CornerRadius = 8; navigationDirectionButton.Layer.BorderWidth = 2; navigationDirectionButton.TouchUpInside += ShownavigationDirectionPicker; navigationDirectionButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //tabStripButton tabStripButton = new UIButton(); tabStripButton.SetTitle("Bottom", UIControlState.Normal); tabStripButton.Font = UIFont.FromName("Helvetica", 14f); tabStripButton.SetTitleColor(UIColor.Black, UIControlState.Normal); tabStripButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; tabStripButton.Layer.CornerRadius = 8; tabStripButton.Layer.BorderWidth = 2; tabStripButton.TouchUpInside += ShowtabStripPicker; tabStripButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //doneButton doneButton = new UIButton(); doneButton.SetTitle("Done\t", UIControlState.Normal); doneButton.Font = UIFont.FromName("Helvetica", 14f); doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal); doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; doneButton.TouchUpInside += HidePicker; doneButton.Hidden = true; doneButton.BackgroundColor = UIColor.FromRGB(240, 240, 240); //picker navigationModeModel.PickerChanged += navigationModeSelectedIndexChanged; navigationDirectionModel.PickerChanged += navigationDirectionSelectedIndexChanged; tabStripModel.PickerChanged += tabStripSelectedIndexChanged; navigationModePicker.ShowSelectionIndicator = true; navigationModePicker.Hidden = true; navigationModePicker.BackgroundColor = UIColor.Gray; navigationDirectionPicker.BackgroundColor = UIColor.Gray; navigationDirectionPicker.ShowSelectionIndicator = true; navigationDirectionPicker.Hidden = true; tabStripPicker.BackgroundColor = UIColor.Gray; tabStripPicker.ShowSelectionIndicator = true; tabStripPicker.Hidden = true; //autoPlayLabel autoPlayLabel = new UILabel(); autoPlayLabel.TextColor = UIColor.Black; autoPlayLabel.BackgroundColor = UIColor.Clear; autoPlayLabel.Text = @"Enable AutoPlay"; autoPlayLabel.TextAlignment = UITextAlignment.Left; autoPlayLabel.Font = UIFont.FromName("Helvetica", 14f); //allowSwitch autoPlaySwitch = new UISwitch(); autoPlaySwitch.ValueChanged += autoPlayToggleChanged; autoPlaySwitch.On = false; autoPlaySwitch.OnTintColor = UIColor.FromRGB(50, 150, 221); controlView.AddSubview(rotator); this.AddSubview(controlView); sub_View = new UIView(); propertiesLabel = new UILabel(); closeButton = new UIButton(); showPropertyButton = new UIButton(); //adding to content view contentView.AddSubview(navigationModeLabel); contentView.AddSubview(navigationModeButton); contentView.AddSubview(navigationDirectionLabel); contentView.AddSubview(navigationDirectionButton); contentView.AddSubview(tabStripLabel); contentView.AddSubview(tabStripButton); contentView.AddSubview(autoPlayLabel); contentView.AddSubview(autoPlaySwitch); contentView.AddSubview(doneButton); contentView.AddSubview(navigationModePicker); contentView.AddSubview(tabStripPicker); contentView.AddSubview(navigationDirectionPicker); contentView.BackgroundColor = UIColor.FromRGB(240, 240, 240); //adding to sub_view sub_View.AddSubview(contentView); sub_View.AddSubview(closeButton); sub_View.AddSubview(propertiesLabel); sub_View.BackgroundColor = UIColor.FromRGB(230, 230, 230); this.AddSubview(sub_View); propertiesLabel.Text = "OPTIONS"; //showPropertyButton showPropertyButton.Hidden = true; showPropertyButton.SetTitle("OPTIONS\t", UIControlState.Normal); showPropertyButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; showPropertyButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); showPropertyButton.SetTitleColor(UIColor.Black, UIControlState.Normal); showPropertyButton.TouchUpInside += (object sender, EventArgs e) => { sub_View.Hidden = false; showPropertyButton.Hidden = true; }; this.AddSubview(showPropertyButton); //CloseButton closeButton.SetTitle("X\t", UIControlState.Normal); closeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; closeButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal); closeButton.TouchUpInside += (object sender, EventArgs e) => { sub_View.Hidden = true; showPropertyButton.Hidden = false; }; //AddingGesture UITapGestureRecognizer tapgesture = new UITapGestureRecognizer(() => { sub_View.Hidden = true; showPropertyButton.Hidden = false; } ); propertiesLabel.UserInteractionEnabled = true; propertiesLabel.AddGestureRecognizer(tapgesture); }
public void loadOptionView() { //PrecisionButton precisionButton = new UIButton(); precisionButton.SetTitle("Standard", UIControlState.Normal); precisionButton.Font = UIFont.FromName("Helvetica", 14f); precisionButton.SetTitleColor(UIColor.Black, UIControlState.Normal); precisionButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; precisionButton.Layer.CornerRadius = 8; precisionButton.Layer.BorderWidth = 2; precisionButton.TouchUpInside += ShowPicker1; precisionButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //TooltipButton toolTipButton = new UIButton(); toolTipButton.SetTitle("None", UIControlState.Normal); toolTipButton.Font = UIFont.FromName("Helvetica", 14f); toolTipButton.SetTitleColor(UIColor.Black, UIControlState.Normal); toolTipButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; toolTipButton.Layer.CornerRadius = 8; toolTipButton.Layer.BorderWidth = 2; toolTipButton.TouchUpInside += ShowPicker2; toolTipButton.Layer.BorderColor = UIColor.FromRGB(246, 246, 246).CGColor; //DoneButton doneButton.SetTitle("Done\t", UIControlState.Normal); doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal); doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right; doneButton.Font = UIFont.FromName("Helvetica", 14f); doneButton.TouchUpInside += HidePicker; doneButton.Hidden = true; doneButton.BackgroundColor = UIColor.FromRGB(240, 240, 240); //Picker precisionPicker = new UIPickerView(); toolTipPicker = new UIPickerView(); model = new PickerModel(precisionList); precisionPicker.Model = model; model1 = new PickerModel(toottipplace); toolTipPicker.Model = model1; model.PickerChanged += SelectedIndexChanged; model1.PickerChanged += SelectedIndexChanged1; precisionPicker.ShowSelectionIndicator = true; precisionPicker.Hidden = true; toolTipPicker.Hidden = true; precisionPicker.BackgroundColor = UIColor.Gray; toolTipPicker.BackgroundColor = UIColor.Gray; toolTipPicker.ShowSelectionIndicator = true; //ItemCountTextField itemCountTextfield = new UITextView(); itemCountTextfield.TextAlignment = UITextAlignment.Center; itemCountTextfield.Layer.BorderColor = UIColor.Black.CGColor; itemCountTextfield.BackgroundColor = UIColor.FromRGB(246, 246, 246); itemCountTextfield.KeyboardType = UIKeyboardType.NumberPad; itemCountTextfield.Text = "5"; itemCountTextfield.Font = UIFont.FromName("Helvetica", 14f); itemCountTextfield.Changed += (object sender, EventArgs e) => { if (itemCountTextfield.Text.Length > 0) { rating1.ItemCount = int.Parse(itemCountTextfield.Text); } else { rating1.ItemCount = 5; } UpdateText(); }; //adding to controlView controlView.AddSubview(rating1); controlView.AddSubview(rating2); controlView.AddSubview(movieRateLabel); controlView.AddSubview(walkLabel); controlView.AddSubview(timeLabel); controlView.AddSubview(descriptionLabel); controlView.AddSubview(rateLabel); controlView.AddSubview(valueLabel); controlView.AddSubview(image1); controlView.AddSubview(itemCountTextfield); this.AddSubview(controlView); //Adding to content view contentView.AddSubview(precisionLabel); contentView.AddSubview(toolTipLabel); contentView.AddSubview(precisionButton); contentView.AddSubview(itemCountLabel); contentView.AddSubview(toolTipButton); contentView.AddSubview(precisionPicker); contentView.AddSubview(toolTipPicker); contentView.AddSubview(doneButton); contentView.AddSubview(itemCountTextfield); contentView.BackgroundColor = UIColor.FromRGB(240, 240, 240); //PropertyLabel propertiesLabel = new UILabel(); propertiesLabel.Text = " OPTIONS"; //ShowpropertyButton showPropertyButton = new UIButton(); showPropertyButton.Hidden = true; showPropertyButton.SetTitle("OPTIONS\t", UIControlState.Normal); showPropertyButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; showPropertyButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); showPropertyButton.SetTitleColor(UIColor.Black, UIControlState.Normal); showPropertyButton.TouchUpInside += (object sender, EventArgs e) => { subView.Hidden = false; showPropertyButton.Hidden = true; }; this.AddSubview(showPropertyButton); //CloseButton closeButton = new UIButton(); closeButton.SetTitle("X\t", UIControlState.Normal); closeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left; closeButton.BackgroundColor = UIColor.FromRGB(230, 230, 230); closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal); closeButton.TouchUpInside += (object sender, EventArgs e) => { subView.Hidden = true; showPropertyButton.Hidden = false; }; //AddingGesture UITapGestureRecognizer tapgesture = new UITapGestureRecognizer(() => { subView.Hidden = true; showPropertyButton.Hidden = false; } ); propertiesLabel.UserInteractionEnabled = true; propertiesLabel.AddGestureRecognizer(tapgesture); //Adding to subvieww subView = new UIScrollView(); subView.ContentSize = new CGSize(Frame.Width, 350); subView.AddSubview(contentView); subView.AddSubview(propertiesLabel); subView.AddSubview(closeButton); subView.BackgroundColor = UIColor.FromRGB(230, 230, 230); this.AddSubview(subView); }
public override void ViewDidLoad() { base.ViewDidLoad(); //Google Cast button var castButton = new UICastButton(new CGRect(0, 0, 24, 24)); NavigationItem.RightBarButtonItem = new UIBarButtonItem(castButton); //NSNotificationCenter.DefaultCenter.AddObserver(this, castDidChangeState(), CastContext.CastStateDidChangeNotification, CastContext.SharedInstance); sessionManager = CastContext.SharedInstance.SessionManager; CastContext.SharedInstance.SessionManager.AddListener(this); NSNotificationCenter aNotificationCenter = NSNotificationCenter.DefaultCenter; aNotificationCenter.AddObserver(this, new ObjCRuntime.Selector("castDidChangeState:"), CastContext.CastStateDidChangeNotification, CastContext.SharedInstance); videoController = new UIView(); videoController.BackgroundColor = UIColor.Red; videoController.Frame = new CGRect(0, 100, 375, 207.5); //table = new UITableView(); // defaults to Plain style //table.Frame = new CGRect(0, 335, View.Frame.Width, View.Frame.Height - 215); //string[] tableItems = new string[] { "Basic Video", "DRM Video" }; //table.Source = new TableSource(tableItems, this); //playbackController Setup playbackController = sDKManager.CreatePlaybackController(); playbackController.SetAutoPlay(true); playbackController.SetAutoAdvance(true); playbackController.Delegate = new BCPlaybackControllerDelegate(); BCOVGoogleCastManager googleCastManager = new BCOVGoogleCastManager(); googleCastManager.Delegate = new BCGoogleCastManagerDelegate(playbackController); playbackController.AddSessionConsumer(googleCastManager); //playerView Setup var options = new BCOVPUIPlayerViewOptions() { PresentingViewController = this }; var playerView = new BCOVPUIPlayerView(playbackController, options, BCOVPUIBasicControlView.BasicControlViewWithVODLayout()); playerView.Frame = new CGRect(0, 0, 375, 207.5); playbackService.FindVideoWithVideoID(videoID: videoId, parameters: new NSDictionary(), completionHandler: (arg0, arg1, arg2) => { if (arg0 != null) { playbackController.SetVideos(NSArray.FromObjects(arg0)); } else { Debug.WriteLine($"View Controller Debug - Error retrieving video : {arg2.LocalizedDescription} "); } }); playerView.PlaybackController = playbackController; videoController.AddSubview(playerView); View.AddSubview(videoController); //View.AddSubview(table); }