Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9161949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:05:40+00:00 2026-06-17T14:05:40+00:00

I have created a viewcontroller and have added some labels and a button to

  • 0

I have created a viewcontroller and have added some labels and a button to the view using the interface builder.

I am trying to add a rounded white border to the view so I am building a view via code using

//http://spazzarama.com/2011/01/08/monotouch-uiview-with-curved-border-and-shadow/
public class WhiteRectangle:UIView
{
    // Constructor used when view is defined in InterfaceBuilder
    public WhiteRectangle (IntPtr handle) : base(handle)
    {
        this.CreateCurveAndShadow();
    }

    // Constructor to use when creating in code
    public WhiteRectangle (System.Drawing.RectangleF frame) : base(frame)
    {
        this.CreateCurveAndShadow();
    }

    private void CreateCurveAndShadow()
    {
        // MasksToBounds == false allows the shadow to appear outside the UIView frame
        this.Layer.MasksToBounds = false;
        this.Layer.CornerRadius = 10;
        this.Layer.ShadowColor = UIColor.DarkGray.CGColor;
        this.Layer.ShadowOpacity = 1.0f;
        this.Layer.ShadowRadius = 6.0f;
        this.Layer.ShadowOffset = new System.Drawing.SizeF(0f, 3f);
    }


}

Within my ViewControllers ViewDidLoad

        public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        var view = new WhiteRectangle(new System.Drawing.RectangleF(10, 10, 300, 300));
        view.BackgroundColor = UIColor.White;
        View.AddSubview (view);
    }

Now my problem is the view I am creating as you would expect is being added after the view created in the interface builder. Is it possible to set the order of the view?

I have tried

    View.Subviews[0].SendSubviewToBack(View.Subviews[1]);
    View.Subviews[1].SendSubviewToBack(View.Subviews[0]);

Neither work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:05:42+00:00Added an answer on June 17, 2026 at 2:05 pm

    I was close. If anyone else is stuck on the same thing this worked

    this.View.BringSubviewToFront(View.Subviews[0]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ViewController and UIWebView created in Interface Builder in it. I fill
I have created a nib file tableHeaderView where i have added some labels and
I have created a UIPopoverController and added it to a view controller when clicking
I am using UIViewController for display my view. My view have been created in
I have created a view controller, and added a table view as a subview
I'm making an app with interface builder using storyboarding. I want to have a
I have created an view based app and added two table view controller in
I've added a UITableView component to a ViewController in Interface Builder to make it
I have created two viewController classes such that one is superclass of another.i have
I have a UIButton that I create in my sub class ViewController, and add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.