public override void ViewDidLoad() { View.BackgroundColor = UIColor.White; nameLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; descriptionTextView = new UITextView () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f), Editable = false }; image = new UIImageView () { ContentMode = UIViewContentMode.ScaleAspectFit }; if (AppDelegate.IsPad) { View.AddSubview (nameLabel); View.AddSubview (descriptionTextView); View.AddSubview (image); } else { scrollView = new UIScrollView(); scrollView.AddSubview (nameLabel); scrollView.AddSubview (descriptionTextView); scrollView.AddSubview (image); Add (scrollView); } }
public override void LayoutSubviews () { // layout the stock UIAlertView control base.LayoutSubviews (); if(this.Subviews.Count() == 3) { // build out the text field _UserName = ComposeTextFieldControl (false); _Password = ComposeTextFieldControl (true); // add the text field to the alert view UIScrollView view = new UIScrollView(this.Frame); view.AddSubview(ComposeLabelControl("Username")); view.AddSubview (_UserName); view.AddSubview(ComposeLabelControl("Password")); view.AddSubview (_Password); this.AddSubview(view); } // shift the contents of the alert view around to accomodate the extra text field AdjustControlSize (); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; Title = "Main info"; var scrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height)) { ScrollEnabled = true, ContentSize = new CGSize(View.Bounds.Size.Width, View.Bounds.Size.Height), AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }; View.AddSubview(scrollView); using (var set = new BindingSet<OrderEditorViewModel>()) { UIFont font = UIFont.SystemFontOfSize(12); var label = new UILabel(new CGRect(20, 0, View.Frame.Width - 40, 25)) { Text = "Name", AutoresizingMask = UIViewAutoresizing.FlexibleWidth, Font = font }; scrollView.AddSubview(label); var textField = new UITextField(new CGRect(20, 25, View.Frame.Width - 40, 30)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth, BorderStyle = UITextBorderStyle.RoundedRect, }; set.Bind(textField) .To(() => (vm, ctx) => vm.Name) .TwoWay() .Validate(); scrollView.AddSubview(textField); label = new UILabel(new CGRect(20, 55, View.Frame.Width - 40, 25)) { Text = "Number", AutoresizingMask = UIViewAutoresizing.FlexibleWidth, Font = font }; scrollView.AddSubview(label); textField = new UITextField(new CGRect(20, 80, View.Frame.Width - 40, 30)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth, BorderStyle = UITextBorderStyle.RoundedRect }; set.Bind(textField) .To(() => (vm, ctx) => vm.Number) .TwoWay() .Validate(); scrollView.AddSubview(textField); } }
private void InitializeUseAnimationSwitch() { _useAnimationSwitch = new UISwitch(); _useAnimationSwitch.On = true; _scrollView.AddSubview(_useAnimationSwitch); _useAnimationSwitch.TranslatesAutoresizingMaskIntoConstraints = false; _useAnimationSwitch.TopAnchor.ConstraintEqualTo(_scrollView.TopAnchor, 50).Active = true; _useAnimationSwitch.CenterXAnchor.ConstraintEqualTo(_scrollView.CenterXAnchor).Active = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.White; var scrollView = new UIScrollView(new RectangleF(0, 0, View.Frame.Width, View.Frame.Height)) { ScrollEnabled = true, ContentSize = new SizeF(View.Bounds.Size.Width, View.Bounds.Size.Height), AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }; View.AddSubview(scrollView); using (var set = new BindingSet <DynamicObjectViewModel>()) { UIFont font = UIFont.SystemFontOfSize(12); var label = new UILabel(new RectangleF(20, 0, View.Frame.Width - 40, 25)) { Text = "Binding to dynamic property", AutoresizingMask = UIViewAutoresizing.FlexibleWidth, Font = font }; scrollView.AddSubview(label); var textField = new UITextField(new RectangleF(20, 25, View.Frame.Width - 40, 30)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth, BorderStyle = UITextBorderStyle.RoundedRect, }; set.Bind(textField, field => field.Text) .To("DynamicModel.Text") .TwoWay(); scrollView.AddSubview(textField); label = new UILabel(new RectangleF(20, 55, View.Frame.Width - 40, 25)) { Text = "Dynamic value", AutoresizingMask = UIViewAutoresizing.FlexibleWidth, Font = font }; scrollView.AddSubview(label); label = new UILabel(new RectangleF(20, 80, View.Frame.Width - 40, 25)) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth, TextColor = UIColor.Green }; set.Bind(label, field => field.Text).To("DynamicModel.Text"); scrollView.AddSubview(label); } }
public override void ViewDidLoad() { View.BackgroundColor = UIColor.White; nameLabel = new UILabel() { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("Helvetica-Light", AppDelegate.Font16pt), BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f) }; addressLabel = new UILabel() { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("Helvetica-LightOblique", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f) }; locationLabel = new UILabel() { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("Helvetica-Light", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f) }; descriptionTextView = new UITextView() { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName("Helvetica-Light", AppDelegate.Font10_5pt), BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f), Editable = false }; image = new UIImageView(); if (AppDelegate.IsPad) { View.AddSubview(nameLabel); View.AddSubview(addressLabel); View.AddSubview(locationLabel); View.AddSubview(descriptionTextView); View.AddSubview(image); } else { scrollView = new UIScrollView(); scrollView.AddSubview(nameLabel); scrollView.AddSubview(addressLabel); scrollView.AddSubview(locationLabel); scrollView.AddSubview(descriptionTextView); scrollView.AddSubview(image); Add(scrollView); } }
public SpeakerDetailsScreen (int speakerID) : base() { ShouldShowSessions = true; speakerId = speakerID; View.BackgroundColor = UIColor.White; if (AppDelegate.IsPad) { toolbar = new UIToolbar (new RectangleF(0,0,UIScreen.MainScreen.Bounds.Width, 40)); View.AddSubview (toolbar); y = 40; } nameLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; titleLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-LightOblique", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; companyLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; bioTextView = new UITextView () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f), ScrollEnabled = true, Editable = false }; image = new UIImageView(); scrollView = new UIScrollView(); scrollView.AddSubview (nameLabel); scrollView.AddSubview (titleLabel); scrollView.AddSubview (companyLabel); scrollView.AddSubview (bioTextView); scrollView.AddSubview (image); Add (scrollView); }
public SWTableViewCell(UITableViewCellStyle style, string reuseIdentifier, UITableView containingTable, IEnumerable <UIButton> rightUtilityButtons, UIView leftView, List <UIView> mainView) : base(style, reuseIdentifier) { scrollViewLeft = leftView; this.rightUtilityButtons = rightUtilityButtons.ToArray(); scrollViewButtonViewRight = new SWUtilityButtonView(this.rightUtilityButtons, this); containingTableView = containingTable; height = (float)containingTableView.RowHeight; scrollViewDelegate = new SWScrollViewDelegate(this); // Check if the UITableView will display Indices on the right. If that's the case, add a padding if (containingTableView.RespondsToSelector(new Selector("sectionIndexTitlesForTableView:"))) { string[] indices = containingTableView.Source.SectionIndexTitles(containingTableView); additionalRightPadding = indices == null || indices.Length == 0 ? 0 : SectionIndexWidth; } // Set up scroll view that will host our cell content cellScrollView = new UIScrollView(new RectangleF(0, 0, (float)Bounds.Width, height)); cellScrollView.ContentSize = new SizeF((float)Bounds.Width + UtilityButtonsPadding, height); cellScrollView.ContentOffset = ScrollViewContentOffset; cellScrollView.Delegate = scrollViewDelegate; cellScrollView.ShowsHorizontalScrollIndicator = false; cellScrollView.ScrollsToTop = false; var tapGestureRecognizer = new UITapGestureRecognizer(OnScrollViewPressed); cellScrollView.AddGestureRecognizer(tapGestureRecognizer); // Set up the views that will hold the utility buttons scrollViewLeft.Frame = new RectangleF(ScrollLeftViewWidth, 0, ScrollLeftViewWidth, height); cellScrollView.AddSubview(scrollViewLeft); scrollViewButtonViewRight.Frame = new RectangleF((float)Bounds.Width, 0, RightUtilityButtonsWidth, height); cellScrollView.AddSubview(scrollViewButtonViewRight); // Populate the button views with utility buttons scrollViewButtonViewRight.PopulateUtilityButtons(); // Create the content view that will live in our scroll view scrollViewContentView = new UIView(new RectangleF(ScrollLeftViewWidth, 0, (float)Bounds.Width, height)); cellScrollView.AddSubview(scrollViewContentView); this.mainView = mainView; BuildMainView(); AddSubview(cellScrollView); HideSwipedContent(false); }
public override void ViewDidLoad() { base.ViewDidLoad(); Controls.RestrictRotation(true); SQLiteBoostDB.CheckAndCreateDatabase(); this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("bg.jpg")); labelSelectedDealer = GetLabel("No Dealer Selected"); UIScrollView scrollView = new UIScrollView(new CoreGraphics.CGRect(this.View.Bounds.X, 60f, this.View.Bounds.Width, this.View.Bounds.Height)); scrollView.AddSubview(new EditGroup(GetDealershipGroup()).View); scrollView.AddSubview(new EditGroup(GetButtons()).View); nfloat ypos = 0f; foreach (UIView view in scrollView.Subviews) { view.Frame = new CoreGraphics.CGRect(view.Bounds.X + 5f, ypos + 10f, this.View.Bounds.Width - 10f, view.Bounds.Height); ypos += view.Bounds.Height + 10f; } //makes height of scroller the total ypos of groups + 60 for the top bar + 10 for margin at bottom scrollView.ContentSize = new CoreGraphics.CGSize(scrollView.Bounds.Width, ypos + 60f + 10f); this.View.AddSubview(scrollView); assetsRequireDownload = getAssetsRequired(); if (assetsRequireDownload) { showAssetsDialog(); } bool dealershipWarningShown = (bool)NSUserDefaults.StandardUserDefaults.BoolForKey("DealershipWarningShown"); if (!dealershipWarningShown) { List <Vehicle> listAllVehicles = new List <Vehicle>(); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) listAllVehicles = new VehicleDB(sqlConn).GetAllVehicles(); if (listAllVehicles.Count(v => v.DealershipID == null || v.DealershipID == 0) > 0) { Controls.OkDialog("Vehicles Without Dealership", "Boost IT has recently changed so that you must select a dealership before creating a vehicle. You have vehicles that were created without a dealership assigned to them on your device. You will not be able to upload these vehicles until you go into \"Change a Vehicle\" and select a dealer for each vehicle.\n\n Vehicles not assigned to a dealership will be marked with \"(**)\" on the \"Change a Vehicle\" page.", delegate { NSUserDefaults.StandardUserDefaults.SetBool(true, "DealershipWarningShown"); }); } } }
/// <summary> /// PickerView Must have non-empty frame /// </summary> public NativePickerContainer(UIView targetView, UIView pickerView, PickerBase owner) : base() { this.owner = owner; this.targetView = targetView; this.pickerView = pickerView; var scroll = new UIScrollView(this.View.Frame); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { scroll.AddSubview(new UIToolbar(this.View.Frame) { AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }); } scroll.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; scroll.AddSubview(this.pickerView); this.View.AddSubview(scroll); this.navigation = new UINavigationController(this); int navBarVisibilityFactor = this.owner.HideSystemButtons ? 0 : 1; this.navigation.NavigationBarHidden = this.owner.HideSystemButtons; this.navigation.View.Frame = new CGRect(0, 0, this.pickerView.Frame.Width, this.pickerView.Frame.Height + navBarVisibilityFactor * this.navigation.NavigationBar.Frame.Height); this.navigationSize = this.navigation.View.Frame.Size; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { this.popover = new UIPopoverController(this.navigation); this.popover.PopoverContentSize = this.navigation.View.Frame.Size; } else { this.fadeView.AddSubview(this.navigation.View); } this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(owner.OkButtonTitle, UIBarButtonItemStyle.Done, (s, e) => { this.Hide(true); if (this.DoneButtonAction != null) { this.DoneButtonAction(); } }); this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(owner.CancelButtonTitle, UIBarButtonItemStyle.Bordered, (s, e) => { this.Hide(true); }); }
public PopupViewControllerWithScrolling() { _scrollView = new UIScrollView() { TranslatesAutoresizingMaskIntoConstraints = false, ShowsHorizontalScrollIndicator = false }; base.ContentView.AddSubview(_scrollView); _scrollView.StretchWidthAndHeight(base.ContentView); // This is here simply to allow assigning a background to the stack view _stackViewContainer = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; _scrollView.AddSubview(_stackViewContainer); _stackViewContainer.ConfigureForVerticalScrolling(_scrollView, top: AdditionalTopPadding, bottom: 16, left: LeftPadding, right: RightPadding); StackView = new UIStackView() { TranslatesAutoresizingMaskIntoConstraints = false, Axis = UILayoutConstraintAxis.Vertical }; _stackViewContainer.AddSubview(StackView); StackView.StretchWidthAndHeight(_stackViewContainer); EnableKeyboardScrollOffsetHandling(_scrollView, topOffset: 0); }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = AppDelegate.its.getTranslatedText ("Help"); Background back = new Background (); this.View.AddSubview (back.View); this.View.SendSubviewToBack (back.View); if (AppDelegate.Variant == "LITE") { adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, 66)) { AdUnitID = AppDelegate.AdmobID, RootViewController = this }; adView.DidReceiveAd += (sender, args) => { if (!viewOnScreen) View.AddSubview (adView); viewOnScreen = true; }; adView.LoadRequest (GADRequest.Request); } HelpScreenInner innerViewController = new HelpScreenInner (); UIScrollView innerScroll = new UIScrollView (View.Bounds); innerScroll.ContentSize = innerViewController.GetContentSize (); innerScroll.AddSubview (innerViewController.View); innerScroll.UserInteractionEnabled = true; View.AddSubview (innerScroll); UIBarButtonItem YouTube = new UIBarButtonItem ("YouTube", UIBarButtonItemStyle.Plain, null); YouTube.Clicked += (object sender, System.EventArgs e) => UIApplication.SharedApplication.OpenUrl (new MonoTouch.Foundation.NSUrl ("https://www.youtube.com/watch?v=aq1Ml2O8ado")); this.NavigationItem.SetRightBarButtonItem (YouTube,true); }
public override void ViewDidLoad() { base.ViewDidLoad(); // set the background color of the view to white this.View.BackgroundColor = UIColor.White; this.Title = "Scroll View"; // create our scroll view scrollView = new UIScrollView( new CGRect(0, 0, View.Frame.Width , View.Frame.Height - NavigationController.NavigationBar.Frame.Height)); View.AddSubview(scrollView); // create our image view imageView = new UIImageView(UIImage.FromFile("halloween.jpg")); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview(imageView); // set allow zooming scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); }; // Create a new Tap Gesture Recognizer UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) { NumberOfTapsRequired = 2 // double tap }; scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped }
public override void ViewDidLoad() { base.ViewDidLoad (); // set the background color of the view to white this.View.BackgroundColor = UIColor.White; this.Title = "Scroll View"; // create our scroll view scrollView = new UIScrollView ( new RectangleF (0, 0, View.Frame.Width , View.Frame.Height - NavigationController.NavigationBar.Frame.Height)); View.AddSubview (scrollView); // create our image view imageView = new UIImageView (UIImage.FromFile ("halloween.jpg")); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview (imageView); // set allow zooming scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; }; }
public override void LayoutSubviews() { if (calendarIsLoaded) { return; } _scrollView = new UIScrollView() { ContentSize = new SizeF(320, 260), ScrollEnabled = false, Frame = new RectangleF(0, 16 + headerHeight, 320, this.Frame.Height - 16), BackgroundColor = _styleDescriptor.BackgroundColor }; //_shadow = new UIImageView(UIImage.FromBundle("Images/Calendar/shadow.png")); //LoadButtons(); LoadNavArrows(); SetNavigationArrows(false); LoadInitialGrids(); BackgroundColor = UIColor.Clear; AddSubview(_scrollView); //AddSubview(_shadow); _scrollView.AddSubview(_monthGridView); calendarIsLoaded = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. UIScrollView scrollView = new UIScrollView(); scrollView.Frame = new RectangleF(0, 0, 320, 568); scrollView.ContentSize = new SizeF(320, 2000); //滚动范围,一直拉到了2000高度 scrollView.Scrolled += delegate { Console.WriteLine("开始滚动"); }; scrollView.DecelerationEnded += delegate { Console.WriteLine("滚动结束"); }; float y = 10; for (float i = 1; i < 21; i++) { UILabel label = new UILabel(); label.Frame = new RectangleF(0, y, 320, 50); label.BackgroundColor = UIColor.Cyan; label.Text = String.Format("{0}", i); scrollView.AddSubview(label); y += 100; } scrollView.BackgroundColor = UIColor.Orange; this.View.AddSubview(scrollView); }
public override void ViewDidLoad() { base.ViewDidLoad(); _stackView = new UIStackView { TranslatesAutoresizingMaskIntoConstraints = false, Axis = UILayoutConstraintAxis.Vertical, Alignment = UIStackViewAlignment.Fill, Distribution = UIStackViewDistribution.EqualSpacing, Spacing = 0 }; var scroll = new UIScrollView { TranslatesAutoresizingMaskIntoConstraints = false }; Add(scroll); scroll.AddSubview(_stackView); scroll.FullSizeOf(View); _stackView.FullSizeOf(scroll); _stackView.WidthAnchor.ConstraintEqualTo(scroll.WidthAnchor).Active = true; _tree = GetTree(); _tree.ForEach(node => _stackView.AddArrangedSubview(new NodeView(node, ToggleNode))); }
void InitializeSubviews() { _scrollView = new UIScrollView(); _scrollView.TranslatesAutoresizingMaskIntoConstraints = false; _scrollView.BackgroundColor = UIColor.Green; _contentView = new UIView(); _contentView.TranslatesAutoresizingMaskIntoConstraints = false; _contentView.BackgroundColor = UIColor.Red; _label = new UILabel(); _label.TranslatesAutoresizingMaskIntoConstraints = false; _label.Text = "Text"; _label.BackgroundColor = UIColor.Blue; _label1 = new UILabel(); _label1.TranslatesAutoresizingMaskIntoConstraints = false; _label1.Text = "Text1"; _label1.TextColor = UIColor.White; _label1.BackgroundColor = UIColor.Black; _label2 = new UILabel(); _label2.TranslatesAutoresizingMaskIntoConstraints = false; _label2.Text = "Text2"; _label2.BackgroundColor = UIColor.Yellow; _contentView.AddSubviews(new UIView[] { _label, _label1, _label2 }); _scrollView.AddSubview(_contentView); View.AddSubview(_scrollView); }
public override void ViewDidLoad() { base.ViewDidLoad(); // set the background color of the view to white this.View.BackgroundColor = UIColor.White; this.Title = "Scroll View"; // create our scroll view scrollView = new UIScrollView( new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height - this.NavigationController.NavigationBar.Frame.Height)); this.View.AddSubview(scrollView); // create our image view imageView = new UIImageView(UIImage.FromFile("Images/halloween.jpg")); scrollView.ContentSize = imageView.Image.Size; scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.AddSubview(imageView); scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); }; }
public override void ViewDidLoad () { base.ViewDidLoad (); // set the background color of the view to white View.BackgroundColor = UIColor.White; Title = "Scroll View"; imageView = new UIImageView (UIImage.FromFile ("Images/halloween.jpg")); // create our scroll view var frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height); scrollView = new UIScrollView (frame) { ContentSize = imageView.Image.Size, MaximumZoomScale = 3f, MinimumZoomScale = .1f }; scrollView.AddSubview (imageView); View.AddSubview (scrollView); scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; }; }
/// <summary> /// Updates title bar of DataFormViewController - Contact Image and ConatctName updates. /// </summary> internal void UpdateView() { if (dataForm.DataObject == null) { return; } scrollView.AddSubview(moreFields); dataForm.Frame = new CGRect(10, 0, this.View.Frame.Width - 10, this.View.Frame.Height - (160 + 30)); var contactInfo = dataForm.DataObject as ContactInfo; if (contactInfo.ContactImage == null) { image.Image = UIImage.FromBundle("ContactName1.png"); var frame = image.Frame; frame.X = (dataForm.Frame.Width / 2) - 40; image.Frame = frame; } else { image.Image = contactInfo.ContactImage; var frame = image.Frame; frame.X = 10; frame.Width = 80; frame.Height = 80; image.Frame = frame; } label.Text = contactInfo.ContactName; }
/// <summary> /// Initialize views and add to DataFormController. /// </summary> private void InitializeViews() { scrollView = new UIScrollView(); scrollView.Frame = new CGRect(0, 160, this.View.Frame.Width, this.View.Frame.Height - 160); uIView = new UIView(new CGRect(0, 0, this.View.Frame.Width, 160)); this.View.AddSubview(uIView); this.View.AddSubview(scrollView); uIView.BackgroundColor = UIColor.FromRGB(242.0f / 255.0f, 242.0f / 255.0f, 242.0f / 255.0f); image = new UIImageView(new CGRect(10, 70, 80, 80)); uIView.AddSubview(image); label = new UILabel(new CGRect(100, 70, this.View.Frame.Width - 80, 80)); label.Font.WithSize(12); uIView.AddSubview(label); editButton = new UIBarButtonItem(); editButton.Title = "Edit"; editButton.Clicked += EditButton_Clicked; dataForm.CommitMode = CommitMode.Explicit; dataForm.ValidationMode = ValidationMode.LostFocus; dataForm.AutoGeneratingDataFormItem += DataForm_AutoGeneratingDataFormItem; dataForm.Frame = new CGRect(10, 0, this.View.Frame.Width - 10, this.View.Frame.Height - (160 + 30)); scrollView.AddSubview(dataForm); this.View.BackgroundColor = UIColor.White; moreFields = new UIButton(new CGRect(10, this.scrollView.Frame.Height - 30, dataForm.Frame.Width, 30)); moreFields.SetTitle("More Fields", UIControlState.Normal); moreFields.SetTitleColor(this.View.TintColor, UIControlState.Normal); moreFields.TouchDown += MoreFields_TouchDown; }
public override void LayoutSubviews() { AdjustBackgroundColor(); if (calendarIsLoaded) { return; } _scrollView = new UIScrollView(new CGRect(0, HeaderViewSize.Height, MainViewSize.Width, MainViewSize.Height - HeaderViewSize.Height)) { ContentSize = new CGSize(MainViewSize.Width, MainViewSize.Height), ScrollEnabled = false, Frame = new CGRect(0, HeaderViewSize.Height, MainViewSize.Width, MainViewSize.Height), BackgroundColor = MonthBackgroundColor, }; LoadButtons(); LoadInitialGrids(); AddSubview(_scrollView); _scrollView.AddSubview(_monthGridView); calendarIsLoaded = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); EdgesForExtendedLayout = UIRectEdge.None; UIScrollView scrollView = new UIScrollView(); scrollView.TranslatesAutoresizingMaskIntoConstraints = false; View.AddSubview(scrollView); TextContentLabel = new UILabel(); TextContentLabel.Lines = 0; TextContentLabel.TranslatesAutoresizingMaskIntoConstraints = false; scrollView.AddSubview(TextContentLabel); var attr = new NSAttributedStringDocumentAttributes(); var nsError = new NSError(); attr.DocumentType = NSDocumentType.HTML; TextContentLabel.AttributedText = new NSAttributedString(TextToView, attr, ref nsError); var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { scrollView, TextContentLabel }, new NSObject[] { new NSString("scrollView"), new NSString("TextContentLabel") }); scrollView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[TextContentLabel(scrollView)]|", 0, null, viewsDictionary)); scrollView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[TextContentLabel]|", 0, null, viewsDictionary)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[scrollView]-|", 0, null, viewsDictionary)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[scrollView]-|", 0, null, viewsDictionary)); }
public BareMvvmUIViewControllerWithScrolling() { ScrollView = new UIScrollView() { TranslatesAutoresizingMaskIntoConstraints = false, ShowsHorizontalScrollIndicator = false }; this.View.AddSubview(ScrollView); ScrollView.StretchWidthAndHeight(this.View); // This is here simply to allow assigning a background to the stack view StackViewContainer = new UIView() { TranslatesAutoresizingMaskIntoConstraints = false }; ScrollView.AddSubview(StackViewContainer); StackViewContainer.ConfigureForVerticalScrolling(ScrollView, top: TopPadding, bottom: 16, left: LeftPadding, right: RightPadding); StackView = new UIStackView() { TranslatesAutoresizingMaskIntoConstraints = false, Axis = UILayoutConstraintAxis.Vertical }; StackViewContainer.AddSubview(StackView); StackView.StretchWidthAndHeight(StackViewContainer); }
public override void ViewDidLoad () { base.ViewDidLoad (); // set the background color of the view to white this.View.BackgroundColor = UIColor.White; this.Title = "Scroll View"; // create our scroll view scrollView = new UIScrollView ( new CGRect (0, 0, View.Frame.Width , View.Frame.Height - NavigationController.NavigationBar.Frame.Height)); View.AddSubview (scrollView); // create our image view imageView = new UIImageView (UIImage.FromFile ("halloween.jpg")); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview (imageView); // set allow zooming scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; }; // Create a new Tap Gesture Recognizer UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) { NumberOfTapsRequired = 2 // double tap }; scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped }
public override void ViewDidLoad() { base.ViewDidLoad(); _canvasView = new UIView { BackgroundColor = CanvasBackgroundColor, Bounds = new CGRect(CGPoint.Empty, CanvasSize), }; _scrollView = new UIScrollView() { ContentSize = CanvasSize, ViewForZoomingInScrollView = sv => _canvasView, BackgroundColor = ScrollViewBackgroundColor, }; _scrollView.AddSubview(_canvasView); View.AddSubview(_scrollView); AddGestures(); AddInitialElements(); }
private void FinishedDownloadingImage(string path) { if (File.Exists(path)) { using (var pool = new NSAutoreleasePool()) { pool.BeginInvokeOnMainThread(() => { var drugImageView = new UIImageView(UIImage.FromFile(path)); drugImageView.Frame = new RectangleF(0, 0, 448, 320); _DrugScrollView.AddSubview(drugImageView); }); } } else { using (var pool = new NSAutoreleasePool()) { pool.BeginInvokeOnMainThread(() => { var alert = new UIAlertView("", "No Image Found", null, "OK"); alert.AlertViewStyle = UIAlertViewStyle.Default; alert.Dismissed += delegate { // do something, go back maybe. }; alert.Show(); }); } } }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); UIApplication.SharedApplication.SetStatusBarHidden(true, true); var scrollView = new UIScrollView(window.Bounds); window.AddSubview(scrollView); var view = new HypnosisView() { Frame = window.Bounds }; scrollView.AddSubview(view); scrollView.ContentSize = window.Bounds.Size; scrollView.MinimumZoomScale = 1.0f; scrollView.MaximumZoomScale = 5.0f; scrollView.Delegate = new HSAnonScrollViewerDelegate(sv => { return view; }); window.BackgroundColor = UIColor.White; // make the window visible window.MakeKeyAndVisible (); return true; }
public override void ViewDidLoad() { base.ViewDidLoad (); // set the background color of the view to white this.View.BackgroundColor = UIColor.White; this.Title = "Mecut Dosya"; // create our scroll view scrollView = new UIScrollView ( new RectangleF (0, 0, View.Frame.Width , View.Frame.Height - NavigationController.NavigationBar.Frame.Height)); View.AddSubview (scrollView); string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string localFilename = "original.jpg"; string localPath = Path.Combine(documentsPath, localFilename); // create our image view imageView = new UIImageView (UIImage.FromFile (localPath)); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview (imageView); // set allow zooming scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; }; // configure a double-tap gesture recognizer UITapGestureRecognizer doubletap = new UITapGestureRecognizer(); doubletap.NumberOfTapsRequired = 2; doubletap.AddTarget (this, new MonoTouch.ObjCRuntime.Selector("DoubleTapSelector")); scrollView.AddGestureRecognizer(doubletap); }
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 NoteView(RectangleF rectangle, UIInterfaceOrientation orientation) : base(rectangle) { this.BackgroundColor = UIColor.Clear; this.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; this.orientation = orientation; // pullTab pullTab = new UIImageView(UIImage.FromBundle("Assets/Buttons/pull_tab.png")); pullTab.Frame = new RectangleF(0, rectangle.Height / 2 - 25, ARROW_WIDTH, ARROW_HEIGHT); this.AddSubview(pullTab); // barView barView = new UIImageView(); barView.Image = UIImage.FromBundle("Assets/Backgrounds/vertical_bar.png").CreateResizableImage(new UIEdgeInsets(10, 0, 10, 0)); barView.Frame = new RectangleF(pullTab.Frame.Right, 0, barView.Image.Size.Width, rectangle.Height); this.AddSubview(barView); // scrollView scrollView = new UIScrollView(); scrollView.Frame = new RectangleF(barView.Frame.Right, 0, rectangle.Width - barView.Frame.Right, rectangle.Height); scrollView.ContentSize = new SizeF(scrollView.Frame.Width, scrollView.Frame.Height); scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; scrollView.BackgroundColor = eBriefingAppearance.Color(44, 44, 44); this.AddSubview(scrollView); // textView textView = new CustomTextView(); textView.Frame = new RectangleF(0, 0, scrollView.Frame.Width, scrollView.Frame.Height); textView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; textView.BackgroundColor = eBriefingAppearance.Color(44, 44, 44); textView.TextColor = UIColor.White; textView.Font = UIFont.SystemFontOfSize(17f); textView.SpellCheckingType = UITextSpellCheckingType.No; textView.AutocorrectionType = UITextAutocorrectionType.Yes; scrollView.AddSubview(textView); // placeholder placeholder = new UILabel(); placeholder.Frame = new RectangleF(barView.Frame.Right + 10, textView.Center.Y, textView.Frame.Width - 20, 42); placeholder.Font = UIFont.BoldSystemFontOfSize(17f); placeholder.TextAlignment = UITextAlignment.Center; placeholder.BackgroundColor = UIColor.Clear; placeholder.TextColor = UIColor.White; placeholder.Lines = 0; placeholder.LineBreakMode = UILineBreakMode.WordWrap; placeholder.Text = "Tap to enter notes for the current page"; placeholder.SizeToFit(); placeholder.Alpha = 0f; this.AddSubview(placeholder); RegisterTextViewEvents(); // Register tableView Keyboard Notification for auto scroll autoScroll = new KeyboardAutoScroll(); autoScroll.RegisterForKeyboardNotifications(textView, KeyboardAutoScroll.ScrollType.TEXTVIEW); leftLimitX = rectangle.X - rectangle.Width; rightLimitX = rectangle.X - ARROW_WIDTH; }
public override void ViewDidLoad() { base.ViewDidLoad(); var margin = NavigationController.NavigationBar.Frame.Height + UIApplication.SharedApplication.StatusBarFrame.Height; var imageScrollView = new UIScrollView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - margin)); View.AddSubview(imageScrollView); var imageView = new UIImageView(new CGRect(0, 0, imageScrollView.Frame.Width, imageScrollView.Frame.Height)); //if (ImageForPreview != null) //{ //imageView.Image = ImageForPreview; imageScrollView.MinimumZoomScale = 1f; imageScrollView.MaximumZoomScale = 6.0f; imageScrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); }; //} //else //{ View.BackgroundColor = UIColor.White; imageView.Image = UIImage.FromBundle("ic_photo_holder"); //} ImageService.Instance.LoadUrl(ImageUrl, Constants.ImageCacheDuration) .Retry(2) .Into(imageView); imageView.ContentMode = UIViewContentMode.ScaleAspectFit; imageScrollView.ContentSize = imageView.Image.Size; imageScrollView.AddSubview(imageView); imageScrollView.ContentSize = new CGSize(imageScrollView.Frame.Width, imageScrollView.Frame.Height); if (TabBarController != null) { TabBarController.TabBar.Hidden = true; } SetBackButton(); }
public override void LayoutSubviews() { AdjustBackgroundColor(); if (calendarIsLoaded) { return; } _scrollView = new UIScrollView(new RectangleF(0, 44, 320, 460 - 44)) { ContentSize = new SizeF(320, 260), ScrollEnabled = false, Frame = new RectangleF(0, 44, 320, 460 - 44), BackgroundColor = UIColor.White }; LoadButtons(); LoadInitialGrids(); AddSubview(_scrollView); _scrollView.AddSubview(_monthGridView); calendarIsLoaded = true; }
public override void LoadView() { base.LoadView(); this.View.Layer.BackgroundColor = ColorScheme.Clouds.CGColor; SearchButton = new UIButton(); holderView = new UIView(this.View.Frame); SearchTableView = new UITableView(new CGRect(), UITableViewStyle.Grouped); scrollView = new UIScrollView(this.View.Frame); SearchCityLabel = new UILabel { TextAlignment = UITextAlignment.Center }; SearchCityLabel.AttributedText = new NSAttributedString(String.Format("Search {0} for:", Location.SiteName), Constants.LabelAttributes); ads = new ADBannerView(); SearchButton.Layer.BackgroundColor = ColorScheme.MidnightBlue.CGColor; SearchButton.Layer.CornerRadius = 10; SearchButton.ClipsToBounds = true; SearchButton.SetAttributedTitle(new NSAttributedString("Search", Constants.ButtonAttributes), UIControlState.Normal); SearchTableView.Layer.BackgroundColor = ColorScheme.Clouds.CGColor; holderView.AddSubviews(new UIView[] { SearchButton, SearchCityLabel, SearchTableView, ads }); scrollView.AddSubview(holderView); this.View.AddSubview(scrollView); AddLayoutConstraints(); saveButton = new UIBarButtonItem( UIImage.FromFile("save.png"), UIBarButtonItemStyle.Plain, SaveButtonClicked); NavigationItem.RightBarButtonItem = saveButton; }
public override void LayoutSubviews() { if (calendarIsLoaded) { return; } _scrollView = new UIScrollView(new RectangleF(0, 44, 320, 460 - 44)) { ContentSize = new SizeF(320, 260), ScrollEnabled = false, Frame = new RectangleF(0, 44, 320, 460 - 44), BackgroundColor = UIColor.FromRGBA(222 / 255f, 222 / 255f, 225 / 255f, 1f) }; _shadow = new UIImageView(UIImage.FromFile("images/calendar/shadow.png")); LoadButtons(); LoadInitialGrids(); BackgroundColor = UIColor.Clear; AddSubview(_scrollView); AddSubview(_shadow); _scrollView.AddSubview(_monthGridView); calendarIsLoaded = true; }
void StyleToolbar() { _toolbar = new UIToolbar(_toolbarScroll.Frame); _toolbar.BackgroundColor = UIColor.Clear; _toolbarScroll.AddSubview(_toolbar); _toolbarScroll.AutoresizingMask = _toolbar.AutoresizingMask; }
private void AddView(UIStackView view) { if (_constraints != null) { _scrollView.RemoveConstraints(_constraints); } if (_scrollView.Subviews.Length > 0) { _scrollView.Subviews.FirstOrDefault().RemoveFromSuperview(); } _scrollView.AddSubview(view); _constraints = new NSLayoutConstraint[] { NSLayoutConstraint.Create(view, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(view, NSLayoutAttribute.Width, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Width, 1, 0), NSLayoutConstraint.Create(view, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Trailing, 1, 0), NSLayoutConstraint.Create(view, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Top, 1, 0), NSLayoutConstraint.Create(view, NSLayoutAttribute.Bottom, NSLayoutRelation.LessThanOrEqual, _scrollView, NSLayoutAttribute.Bottom, 1, 0) }; _scrollView.AddConstraints(_constraints); ScaleView(); }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public override void ViewDidLoad() { camImage.time = DateTime.MinValue; bool last = (selectedCamTime == DateTime.MinValue); DataManager.SheduleGetCamImageRequest(Application.selectedMachine.camBridgeMac, Application.selectedMachine.camNum, selectedCamTime, DateTime.Now, last, DataUpdateCallback); scrollView = new UIScrollView(); scrollView.Frame = new CoreGraphics.CGRect(0, TimeLabel.Frame.Bottom, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Width * imageProportion); scrollView.ContentSize = new CGSize(scrollView.Frame.Width, scrollView.Frame.Height); View.AddSubview(scrollView); imageView = new UIImageView(); scrollView.AddSubview(imageView); panGesture = new UIPanGestureRecognizer(HandlePanAction); View.AddGestureRecognizer(panGesture); if (selectedCamTime != DateTime.MinValue) { DateTime nsRef = new DateTime(2001, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); CamTimePicker.SetDate(NSDate.FromTimeIntervalSinceReferenceDate((selectedCamTime.ToUniversalTime() - nsRef).TotalSeconds), false); } CamTimePicker.ValueChanged += CamTimePicker_ValueChanged; SetLayout(); }
public override void ViewDidLoad() { base.ViewDidLoad(); nfloat h = 50.0f; nfloat w = 50.0f; nfloat padding = 10.0f; nint n = 25; scrollView = new UIScrollView { Frame = new CGRect(0, 100, View.Frame.Width, h + 2 * padding), ContentSize = new CGSize((w + padding) * n, h), BackgroundColor = UIColor.White, AutoresizingMask = UIViewAutoresizing.FlexibleWidth }; for (int i = 0; i < n; i++) { var button = UIButton.FromType(UIButtonType.RoundedRect); button.SetTitle(i.ToString(), UIControlState.Normal); button.Frame = new CGRect(padding * (i + 1) + (i * w), padding, w, h); scrollView.AddSubview(button); buttons.Add(button); } View.AddSubview(scrollView); }
public override void ViewDidLoad() { base.ViewDidLoad (); float h = 50.0f; float w = 50.0f; float padding = 10.0f; int n = 25; _scrollView = new UIScrollView { Frame = new RectangleF (0, 0, View.Frame.Width, h + 2 * padding), ContentSize = new SizeF ((w + padding) * n, h), BackgroundColor = UIColor.DarkGray, AutoresizingMask = UIViewAutoresizing.FlexibleWidth }; for (int i=0; i<n; i++) { var button = UIButton.FromType (UIButtonType.RoundedRect); button.SetTitle (i.ToString (), UIControlState.Normal); button.Frame = new RectangleF (padding * (i + 1) + (i * w), padding, w, h); _scrollView.AddSubview (button); _buttons.Add (button); } View.AddSubview (_scrollView); }
/// <summary> /// Adds the image. /// </summary> /// <param name="rect">The rect.</param> /// <param name="position">The position.</param> /// <param name="im">The im.</param> private void AddImage(CGRect rect, nint position, string im) { var img = new UIImage(); var isRemote = Helpers.IsValidUrl(im); if (isRemote) { //dont await , fire and forget LoadImageAsync(position, im); } else { img = UIImage.FromFile(im); } var imgView = new UIImageView(img) { AutoresizingMask = UIViewAutoresizing.All, ContentMode = UIViewContentMode.ScaleToFill }; if (FadeImages) { imgView.Alpha = 0; } //if first image is local, fade it in if (position == 0 && !isRemote) { FadeImageViewIn(imgView); } imgView.Frame = new CGRect(rect.Width * position, rect.Top, rect.Width, rect.Height); _scroller.AddSubview(imgView); }
public override void ViewDidLoad() { base.ViewDidLoad (); scrollView = new UIScrollView ( new RectangleF (0, 0, View.Frame.Width, View.Frame.Height)); View.AddSubview (scrollView); imageView = new UIImageView (UIImage.FromBundle ("heinz-map.png")); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview (imageView); scrollView.MaximumZoomScale = 0.7f; scrollView.MinimumZoomScale = 0.4f; scrollView.ContentOffset = new PointF (0, 500); scrollView.ZoomScale = 5f; scrollView.ViewForZoomingInScrollView += (UIScrollView svm) => { return imageView; }; UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) { NumberOfTapsRequired = 2 // double tap }; scrollView.AddGestureRecognizer(doubletap); }
internal SliderView(UIView View, Unit pressureUnit, Unit temperatureUnit, Sensor temperatureSensor, PTChartViewController.SensorEntryMode sensorEntry) { pUnit = pressureUnit; tUnit = temperatureUnit; sliderLabel = new UILabel(new CGRect(.025 * View.Bounds.Width, 290, .95 * View.Bounds.Width, 20)); sliderLabel.AdjustsFontSizeToFitWidth = true; sliderLabel.TextAlignment = UITextAlignment.Center; sliderLabel.Text = Util.Strings.Fluid.SLIDERHEADING; ptScroller = new UIScrollView(new CGRect(.025 * View.Bounds.Width, 320, .95 * View.Bounds.Width, 128)); ptScroller.ShowsHorizontalScrollIndicator = false; ptScroller.ContentSize = new CGSize(2188.8, ptScroller.Bounds.Height); ptScroller.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; ptScroller.Layer.CornerRadius = 5; ptScroller.Layer.BorderWidth = 1f; ptScroller.BackgroundColor = UIColor.White; ptView = new PTSlideView(ptScroller, pressureUnit, temperatureUnit, temperatureSensor); ptView.BackgroundColor = UIColor.White; entryMode = sensorEntry; ptScroller.AddSubview(ptView); RedrawMeasurements(); }
public override void ViewDidLoad() { base.ViewDidLoad(); _stackView = new UIStackView { TranslatesAutoresizingMaskIntoConstraints = false, Axis = UILayoutConstraintAxis.Vertical, Alignment = UIStackViewAlignment.Fill, Distribution = UIStackViewDistribution.EqualSpacing, Spacing = 1 }; var scroll = new UIScrollView(); Add(scroll); scroll.AddSubview(_stackView); scroll.FullSizeOf(View); scroll.EnableAutoLayout(); _stackView.FullSizeOf(scroll); _stackView.WidthAnchor .ConstraintEqualTo(scroll.WidthAnchor) .Active = true; for (var i = 0; i < 25; i++) { _stackView.AddArrangedSubview( GetButton($"Category {i + 1}", i)); _stackView.AddArrangedSubview( GetContent($"Child of category {i + 1}", i + 100)); } }
public SlidingCell(string resuseIdentifier) : base(UITableViewCellStyle.Default, resuseIdentifier) { scrollView = new UIScrollView(); scrollView.ShowsHorizontalScrollIndicator = false; scrollView.Delegate = new SlidingCellScrollDelegate(this); tapGesture = new UITapGestureRecognizer (); tapGesture.AddTarget (() => { if (scrollView.ContentOffset != PointF.Empty) { scrollView.SetContentOffset(PointF.Empty, false); return; } var table = this.Superview.Superview as UITableView; var indexPath = table.IndexPathForCell (this); table.Source.RowSelected (table, indexPath); }); scrollView.AddGestureRecognizer (tapGesture); ContentView.AddSubview(scrollView); scrollViewButtonView = new UIView(); scrollView.AddSubview(scrollViewButtonView); moreButton = UIButton.FromType(UIButtonType.Custom); moreButton.BackgroundColor = UIColor.FromRGBA(0.78f, 0.78f, 0.8f, 1.0f); moreButton.SetTitle("More", UIControlState.Normal); moreButton.SetTitleColor(UIColor.White, UIControlState.Normal); scrollViewButtonView.AddSubview(moreButton); deleteButton = UIButton.FromType(UIButtonType.Custom); deleteButton.BackgroundColor = UIColor.FromRGBA(1.0f, 0.231f, 0.188f, 1.0f); deleteButton.SetTitle("Delete", UIControlState.Normal); deleteButton.SetTitleColor(UIColor.White, UIControlState.Normal); scrollViewButtonView.AddSubview(deleteButton); scrollViewContentView = new UIView(); scrollViewContentView.BackgroundColor = UIColor.White; scrollView.AddSubview(scrollViewContentView); scrollViewLabel = new UILabel(); scrollViewContentView.AddSubview(scrollViewLabel); statusView = new UIImageView (); scrollView.AddSubview(statusView); }
public override void ViewDidLoad() { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; _images = new List<string>(){ "add_info.png", "save_info.png", "resume_info.png", "done" }; _scroll = new UIScrollView { Frame = View.Frame, PagingEnabled = true, ContentSize = new SizeF (_numPages * _pageWidth + _padding + 2 * _padding * (_numPages), View.Frame.Height), DirectionalLockEnabled = true }; View.AddSubview (_scroll); int count = 0; foreach (string picture in _images) { UIImageView aImageView = new UIImageView(new RectangleF (count * _pageWidth + (2 * _padding * count) , 0, View.Frame.Width, View.Frame.Height)){ Image = UIImage.FromFile(picture) }; count ++; _scroll.AddSubview(aImageView); } UIView endView = new UIView (); UIButton doneBtn = new UIButton (UIButtonType.RoundedRect){ Frame = new RectangleF ((View.Frame.Width / 2) - 100, View.Frame.Height / 2, 200, 100) }; doneBtn.SetTitle ("Done", UIControlState.Normal); doneBtn.Font = UIFont.FromName("Helvetica-Bold", 24); endView.Add (doneBtn); endView.BackgroundColor = UIColor.White; endView.Frame = new RectangleF ( 3 * +_pageWidth + (2 * _padding * 3), 0, View.Frame.Width, View.Frame.Height); _scroll.AddSubview (endView); doneBtn.TouchUpInside += delegate { this.DismissViewController(true, null); }; }
public override void ViewDidLoad () { View.BackgroundColor = UIColor.White; nameLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; addressLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-LightOblique", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; locationLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10pt), TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; descriptionTextView = new UITextView () { TextAlignment = UITextAlignment.Left, Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt), BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f), Editable = false }; image = new UIImageView(); if (AppDelegate.IsPad) { View.AddSubview (nameLabel); View.AddSubview (addressLabel); View.AddSubview (locationLabel); View.AddSubview (descriptionTextView); View.AddSubview (image); } else { scrollView = new UIScrollView(); scrollView.AddSubview (nameLabel); scrollView.AddSubview (addressLabel); scrollView.AddSubview (locationLabel); scrollView.AddSubview (descriptionTextView); scrollView.AddSubview (image); Add (scrollView); } }
public FieldImage(string farmName,int farmID,FlyoutNavigationController fnc,SelectField sf) : base(UITableViewStyle.Grouped, null) { Root = new RootElement (null) {}; this.Pushing = true; var section = new Section () {}; var totalRainGuage = new StringElement ("Total Raid Guage(mm): " + DBConnection.getRain (farmID),()=>{}); var rainGuage=new EntryElement ("New Rain Guage(mm): ",null," "); rainGuage.KeyboardType = UIKeyboardType.NumbersAndPunctuation; var update=new StringElement("Add",()=>{ try{ DBConnection.updateRain(farmID,Int32.Parse(rainGuage.Value)); } catch(Exception e){ new UIAlertView ("Error", "Wrong input format!", null, "Continue").Show (); return; } UIAlertView alert = new UIAlertView (); alert.Title = "Success"; alert.Message = "Your Data Has Been Saved"; alert.AddButton("OK"); alert.Show(); }); var showDetail=new StringElement("Show Rain Guage Detail",()=>{ RainDetail rd=new RainDetail(farmID,farmName); sf.NavigationController.PushViewController(rd,true); }); section.Add (totalRainGuage); section.Add (rainGuage); section.Add (update); section.Add (showDetail); Root.Add (section); var section2 = new Section () { }; var farmImg=UIImage.FromFile ("img/"+farmName+".jpg"); if(farmImg==null) farmImg=UIImage.FromFile ("Icon.png"); var imageView = new UIImageView (farmImg); if(farmImg==null) farmImg=UIImage.FromFile ("Icon.png"); var scrollView=new UIScrollView ( new RectangleF(0,0,fnc.View.Frame.Width-20,250) ); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview (imageView); scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; }; var imageElement=new UIViewElement(null,scrollView,false); section2.Add(imageElement); Root.Add (section2); }
public override void LayoutSubviews() { //ContentView contentScrollView = new UIScrollView(); contentScrollView.Frame = new CoreGraphics.CGRect(0, tabbarHeight, Bounds.Width, Bounds.Height - tabbarHeight - 98); contentScrollView.BackgroundColor = ContentBackgroundColor; contentScrollView.PagingEnabled = true; //tabbar tabbarBackground.BackgroundColor = TabbarBackgroundColor; tabbarBackground.Frame = new CoreGraphics.CGRect(0, 0, Bounds.Width, tabbarHeight); nfloat tabbuttonWidth = 0; foreach (var viewController in ViewControllers) { var index = ViewControllers.IndexOf(viewController); var button = new UIButton(UIButtonType.RoundedRect); button.Tag = index; button.SetTitle(viewController.Title, UIControlState.Normal); button.Font = Helpers.Style.Fonts.ScrollTabbarTitle; if(index == 0) button.SetTitleColor(SelectedTabTextColor, UIControlState.Normal); else button.SetTitleColor(TabTextColor, UIControlState.Normal); tabbuttonWidth = Bounds.Width / ViewControllers.Count +1; button.Frame = new CoreGraphics.CGRect(tabbuttonWidth * index, 2, tabbuttonWidth, tabbarHeight - 4); button.TouchUpInside += delegate { CurrentIndex = index; TabItemSelected(index); ResignFirstResponder(); }; tabbarBackground.AddSubview(button); viewController.View.Frame = new CGRect(Bounds.Width * index, 0, Bounds.Width, contentScrollView.Frame.Height); contentScrollView.AddSubview(viewController.View); } contentScrollView.ContentSize = new CGSize(Bounds.Width * ViewControllers.Count, 400); contentScrollView.Scrolled += ContentScrolled; //Underline selectedTabUnderlineView = new UIView(); selectedTabUnderlineView.BackgroundColor = SelectedTabUnderlineColor; selectedTabUnderlineView.Frame = new CGRect(0, tabbarHeight - 4, tabbuttonWidth, 4); //Add views AddSubview(contentScrollView); AddSubview(tabbarBackground); AddSubview(selectedTabUnderlineView); }
public override void ViewDidLoad() { //Create a scrollview object var scrollView = new UIScrollView(new RectangleF (0, 0, 320, 600)); scrollView.BackgroundColor = UIColor.Magenta; //set the content size bigger so that it will bounce scrollView.ContentSize = new SizeF(320, 650); View.AddSubview(scrollView); _refresh = new UIRefreshControl(); _refresh.AttributedTitle = new NSAttributedString("Pull to refresh"); _refresh.AddTarget(RefreshEventHandler,UIControlEvent.ValueChanged); scrollView.AddSubview (_refresh); var contentView = new UIView(new RectangleF(0, 0, 320, 600)); contentView.BackgroundColor = UIColor.Yellow; scrollView.AddSubview(contentView); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.Title = "Cub Scout Promise"; this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIImage.FromBundle("icons/399-list1"), UIBarButtonItemStyle.Plain, FlyoutNavigationHandler), true); this.View.BackgroundColor = UIColor.LightGray; UIScrollView myScroll = new UIScrollView(new RectangleF(0,0,this.View.Bounds.Width,this.View.Bounds.Height)); myScroll.UserInteractionEnabled = true; myScroll.ScrollsToTop = true; View.AddSubview(myScroll); UIImageView myImage = new UIImageView(new RectangleF((this.View.Bounds.Width/2)-50,10,100,100)); myImage.Image = UIImage.FromBundle("CubScouts100"); myScroll.AddSubview(myImage); UILabel lblPromise = new UILabel(); lblPromise.Frame = new RectangleF(10,120,this.View.Bounds.Width-20,20); lblPromise.Font = UIFont.BoldSystemFontOfSize(20); lblPromise.TextColor = UIColor.FromRGB (0,60,114); lblPromise.TextAlignment = UITextAlignment.Center; lblPromise.Text = "The Cub Scout Promise"; lblPromise.BackgroundColor = UIColor.Clear; myScroll.AddSubview(lblPromise); UILabel lblText = new UILabel(new RectangleF(10,130,this.View.Bounds.Width-20,200)); lblText.Font = UIFont.SystemFontOfSize(18); lblText.Lines = 6; lblText.TextColor = UIColor.FromRGB(0,60,114); lblText.BackgroundColor = UIColor.Clear; lblText.TextAlignment = UITextAlignment.Center; lblText.Text = "I, (Say your name), promise " + Environment.NewLine + "to DO MY BEST" + Environment.NewLine + "to do my DUTY to GOD" + Environment.NewLine + "and my Country" + Environment.NewLine + "to HELP other people, and" + Environment.NewLine + "to OBEY the LAW of the Pack."; myScroll.AddSubview(lblText); }
public ZoomImageView () { BackgroundColor = UIColor.White; scrollView = new UIScrollView (RectangleF.Empty) { WeakDelegate = this }; AddSubview (scrollView); imageView = new UIImageView (RectangleF.Empty); scrollView.AddSubview (imageView); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.Title = "Law of the Pack"; this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIImage.FromBundle("icons/399-list1"), UIBarButtonItemStyle.Plain, FlyoutNavigationHandler), true); this.View.BackgroundColor = UIColor.FromRGB(0,60,114); UIScrollView myScroll = new UIScrollView(new RectangleF(0,0,this.View.Bounds.Width,this.View.Bounds.Height)); myScroll.UserInteractionEnabled = true; myScroll.ScrollsToTop = true; View.AddSubview(myScroll); UIImageView myImage = new UIImageView(new RectangleF((this.View.Bounds.Width/2)-50,10,100,100)); myImage.Image = UIImage.FromBundle("CubScouts100"); myScroll.AddSubview(myImage); UILabel lblPromise = new UILabel(); lblPromise.Frame = new RectangleF(10,120,this.View.Bounds.Width-20,20); lblPromise.Font = UIFont.BoldSystemFontOfSize(20); lblPromise.TextColor = UIColor.FromRGB (253,220,8); lblPromise.TextAlignment = UITextAlignment.Center; lblPromise.Text = "The Law of the Pack"; lblPromise.BackgroundColor = UIColor.Clear; myScroll.AddSubview(lblPromise); UILabel lblText = new UILabel(new RectangleF(10,130,this.View.Bounds.Width-20,200)); lblText.Font = UIFont.SystemFontOfSize(18); lblText.Lines = 6; lblText.TextColor = UIColor.FromRGB(253,220,8); lblText.BackgroundColor = UIColor.Clear; lblText.TextAlignment = UITextAlignment.Center; lblText.Text = "The Cub Scout follows Akela." + Environment.NewLine + "The Cub Scout helps the pack go." + Environment.NewLine + "The pack helps the Cub Scout grow." + Environment.NewLine + "The Cub Scout gives goodwill."; myScroll.AddSubview(lblText); }
public override void ViewDidLoad() { View.BackgroundColor = UIColor.White; PHAsset asset = _imageCache.GetAsset(_image.LocalIdentifier); UIImage image = GetImage(asset); _imageView = new UIImageView(image) { MultipleTouchEnabled = true, UserInteractionEnabled = true, ContentMode = UIViewContentMode.ScaleAspectFit, Frame = new CGRect(new CGPoint(0, 0), image.Size), AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; _scrollView = new UIScrollView { // Delegate = new ScrollViewDelegate(this), Frame = View.Frame, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; _scrollView.ContentSize = image.Size; _scrollView.ViewForZoomingInScrollView += ScrollView_ViewForZoomingInScrollView; _scrollView.DidZoom += ScrollView_DidZoom; _scrollView.AddSubview(_imageView); View.AddSubview(_scrollView); // UpdateImage(asset); var doubleTapRecognizer = new UITapGestureRecognizer(ScrollViewDoubleTapped) { NumberOfTapsRequired = 2, NumberOfTouchesRequired = 1 }; _scrollView.AddGestureRecognizer(doubleTapRecognizer); CGRect scrollViewFrame = _scrollView.Frame; nfloat scaleWidth = scrollViewFrame.Size.Width / _scrollView.ContentSize.Width; nfloat scaleHeight = scrollViewFrame.Size.Height / _scrollView.ContentSize.Height; double minScale = Math.Min(scaleWidth, scaleHeight); _scrollView.MinimumZoomScale = (nfloat)minScale; _scrollView.MaximumZoomScale = 1; _scrollView.ZoomScale = (nfloat)minScale; //CenterScrollViewContents(); }
public override void ViewDidLoad() { base.ViewDidLoad (); scrollView = new UIScrollView (new RectangleF (0, 64, View.Bounds.Width, 400)); scrollView.ContentSize= new SizeF(320, 1000); View.AddSubview (scrollView); int y = 0; for (int i = 0; i < 16; i++) { UIView view = new UIView (new RectangleF(0, y, 320, 50)); view.BackgroundColor = UIColor.Green; scrollView.AddSubview (view); UIButton btn = UIButton.FromType (UIButtonType.RoundedRect); btn.Frame = new RectangleF (0,y,320,50); btn.SetTitle ("go to item list", UIControlState.Normal); scrollView.AddSubview (btn); btn.TouchUpInside += (sender, e) => { this.NavigationController.PushViewController(categoryItemVC,true); } ; UIView lineView = new UIView (new RectangleF(0,y + 52 , 320, 2)); lineView.BackgroundColor = UIColor.Blue; scrollView.AddSubview (lineView); y = y + 54; } itemBtn.TouchUpInside += (sender, e) => { }; // Perform any additional setup after loading the view, typically from a nib. }
public override void ViewDidLoad() { base.ViewDidLoad (); RectangleF myBounds = UIScreen.MainScreen.Bounds; scrollView = new UIScrollView (myBounds); var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var gallerydirectory = Path.Combine (documentsDirectory, "insurancePhotos"); string imagefilename = photo.ImageFileName; string path = Path.Combine (gallerydirectory, imagefilename); UIImage image = UIImage.FromFile (path); var CanvasSize = image.Size; //RectangleF Canvas = new RectangleF (new PointF (0, 0), CanvasSize); // string thumbfilename = AppDelegate.dao.GetThumbfilenameForIndex (index); // string path = Path.Combine (gallerydirectory, thumbfilename); // Console.WriteLine ("path:" + path); // UIImage currentImage = UIImage.FromFile (path); // SizeF dim = currentImage.Size; //create new view if none is availble fr recycling // if (iv == null) { iv = new UIImageView(new RectangleF(0,0, CanvasSize.Width,CanvasSize.Height)){ ContentMode = UIViewContentMode.ScaleAspectFill }; // } iv.Image = image; scrollView.ContentSize = image.Size; // blend = new UIView (Canvas); // blend.Frame = Canvas; // blend.Opaque = true; // blend.BackgroundColor = UIColor.Clear; // blend.AddSubview(iv); // blend.AddSubview(tgv); scrollView.AddSubview (iv); this.View = scrollView; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => iv; scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .3f; scrollView.SetZoomScale (0.3f, true); }
public override void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.Black; _pages = new List<UIView> (); _scroll = new UIScrollView { Frame = View.Frame, PagingEnabled = true, ContentSize = new SizeF ( _numPages * _pageWidth + _padding + 2 * _padding * (_numPages - 1), View.Frame.Height) }; View.AddSubview (_scroll); for (int i = 0; i < _numPages; i++) { UIView v = new UIView (); v.Add( new UILabel{ Frame = new RectangleF (100, 50, 100, 25), Text = String.Format("Page {0}", i+1)} ); _pages.Add (v); v.BackgroundColor = UIColor.Gray; v.Frame = new RectangleF ( i * + _pageWidth + _padding + (2 * _padding * i), 0, _pageWidth, _pageHeight); _scroll.AddSubview (v); } _scroll.Scrolled += delegate { _pager.CurrentPage = (int)Math.Round(_scroll.ContentOffset.X/_pageWidth); }; _pager = new UIPageControl(); _pager.Pages = _numPages; _pager.Frame = new RectangleF(0, 420, View.Frame.Width, 50); View.AddSubview(_pager); }
public override void ViewDidLoad() { base.ViewDidLoad (); messageEntry = new UITextField (); messageEntry.BackgroundColor = UIColor.White; messageEntry.AutocapitalizationType = UITextAutocapitalizationType.None; messageEntry.ReturnKeyType = UIReturnKeyType.Send; messageEntry.BorderStyle = UITextBorderStyle.RoundedRect; messageEntry.ShouldReturn += delegate { if (XmppSession.Current != null && XmppSession.Current.Running) { if (XmppSession.Current.Send (new Message (Message.MessageType.Text, Common.XmppProfile.Current.Username, Common.XmppProfile.Current.Buddy, DateTime.Now, null, messageEntry.Text))) { //do it in red? } messagesList.TriggerRefresh (); messageEntry.Text = ""; } return true; }; //messageEntry = new EntryElement ("Type:", "", ""); //messageEntry.Changed += (sender, e) => currentEntryHeight = messageEntry.GetCell (messageDialog.TableView).Bounds.Height; //messageEntry.EntryEnded += (sender, data) => { // if (XmppSession.RunningSession != null && XmppSession.RunningSession.Running) // XmppSession.RunningSession.Send (XmppProfile.Current.Buddy, messageEntry.Value); //}; //var root = new RootElement ("Entry"); //var messageSection = new Section (); //messageSection.Add (messageEntry); //root.Add (messageSection); messagesList = new MessagesList (); //messageDialog = new DialogViewController (UITableViewStyle.Plain, root); View = new UIScrollView (); View.BackgroundColor = UIColor.White; AddChildViewController (messagesList); //AddChildViewController (messageDialog); View.AddSubview (messagesList.View); //View.AddSubview (messageDialog.View); View.AddSubview (messageEntry); RegisterForKeyboardNotifications(); }