August 28, 2015

Xamarin Events in September


Xamarin is back in session with tons of new workshops, seminars, Dev Days, user groups, and conferences happening this September all over the world!

September meetup-banner

Get involved this month in events near you:

Seattle Mobile .NET Developers us

  • Seattle, WA: September 1st
  • What’s new in C# 6 and F# 4! with James Montemagno and Xamarin MVP, Frank Krueger

XHackNight powered by IBM Bluemix & Xamarin in

  • Bangalore, India: September 5th – 6th
  • LEARN.HACK.WIN – a Cross Platform Mobile Hackathon

Gauteng Xamarin User Group in

  • Johannesburg­, South Africa: September 8th
  • Real World Xamarin.Forms (a case study)

Xamarin Dev Days – Jacksonville us

  • Jacksonville, FL: September 12th
  • Come learn Xamarin awesomeness with your community in Jacksonville

NYC Mobile .NET Developers us

  • New York, NY: September 15th
  • Xamarin Navigation Patterns with Xamarin MVP, Dan Hermes

Noser Engineering Breakfast ch

  • Zurich, Switzerland: September 16th
  • Noser, Go Mobile with Xamarin

Slalom us

  • Boston, MA: September 15th
  • Rapidly Delivering High Quality Mobile Experiences with Xamarin

Slalom us

  • Chicago, IL: September 16th
  • Rapidly Delivering High Quality Mobile Experiences with Xamarin

H&D International Workshops & Training Germany

  • Hanover, Germany: September 21st – 25th
  • Five days of extensive training in the world of Xamarin!

Xamarin Dev Days – Miami us

  • Miami, FL: September 26th
  • Come learn Xamarin awesomeness with your community in Jacksonville

Be sure to check out the Xamarin Events Forum for even more Xamarin events, meetups, and presentations happening near you!

Interested in getting a developer group started? We’re here to help! Here’s a tips and tricks guide on staring a developer group, an Introduction to Xamarin slide deck, and, of course, our community sponsorship program to get you started. Also, we love to hear from you, so feel free to send us an email or tweet @XamarinEvents to help spread the word and keep an eye out for events in your neck of the woods!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 27, 2015

Easily Automate Your Xamarin.Forms Apps


When developing mobile applications, it’s extremely time consuming and tedious to manually test your app for every new feature added or bug fixed. Of course, it’s possible to test an app’s business logic with common unit testing practices using nUnit or xUnit, but what about the user interface? UITestHow can we ensure that an application’s user interface is not only behaving properly, but also looks right on the thousands of unique iOS and Android devices out in the world?

This is where automated user interface testing with Xamarin.UITest, combined with the power and scale of Xamarin Test Cloud, comes in. In the past, we’ve looked at creating tests for traditional Xamarin iOS and Android applications by setting the Accessibility and Resource IDs to gain access to user interface controls in Xamarin.UITest, and today we’ll look at how to use UITest with Xamarin.Forms apps.

Meetup Manager in Test Cloud

Accessing Controls

When creating applications with Xamarin.Forms, we create our user interface with Xamarin.Forms controls in C# or XAML. At runtime, Xamarin.Forms handles laying down and displaying the native controls for the application. Since we’re developing against Xamarin.Forms controls, there’s a special way to gain access to them in our Xamarin.UITests through a special property called StyleId. The StyleId can be set to any string that can be accessed when creating your tests and will be the same between iOS and Android, which means there is no special management of Ids when developing with Xamarin.Forms.


 <Button x:Name="ButtonLogin"
         Text="Login to Meetup"
         Command="{Binding LoginCommand}" />


var buttonLogin = new Button
    StyleId = "ButtonLogin",
    Text = "Login to Meetup",
    BorderRadius = 0,
    TextColor = Color.White,
    BackgroundColor = Color.FromHex("F443336")

The last thing to do is to add a few lines of code in your iOS and Android applications to apply the StyleId to the native controls, which actually does expose them to Xamarin.UITest. These lines of code should be commented out for final app store submissions.

iOS Setup

Open the AppDelegate.cs file in your iOS project. Add the following lines in FinishedLaunching method after Xamarin.Forms’ Init is called:

Forms.ViewInitialized += (sender, e) =>
  if (null != e.View.StyleId)
    e.NativeView.AccessibilityIdentifier = e.View.StyleId;

Android Setup

Open the MainActivity.cs file and add the following lines in OnCreate method after Xamarin.Forms’ Init is called:

Xamarin.Forms.Forms.ViewInitialized += (sender,  e) =>
  if (!string.IsNullOrWhiteSpace(e.View.StyleId))
    e.NativeView.ContentDescription = e.View.StyleId;

Now, if I was to run a UITest and open the REPL, ButtonLogin will be visible in the tree:


In the UITest, the ButtonLogin can be now used to interact with the button and validate so the login screen appears:

public void OpenLoginScreen()
  app.Screenshot("App Launches");
  app.Screenshot("When I tap Login");
  app.Screenshot("Login Page is Visible");

Learn More

To learn more about Xamarin.UITest and Xamarin Test Cloud, be sure to dive through the developer documentation and see our advanced guide for using Xamarin.UITest with Xamarin.Forms. You can also download the full source code and Xamarin.UITest for Meetup Manager, which I demoed here, on my GitHub.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Join Xamarin at GOTO London & GOTO Copenhagen


Highly regarded in the software development community, the GOTO Conference series of annual events has been firmly established in Europe since 2009. This year, for the first time, the UK is getting it’s own three-day conference at GOTO London 2015.

GOTO London 2015 – September 16th to 18th (Workshops Sept. 15-16)

GOTO London 2015 BannerJoin Xamarin Developer Evangelist Mike James on Friday, September 18 to learn about creating native apps with up to 100% cross-platform code sharing with Xamarin.Forms. We’ll also have our team of mobile experts on hand at the Xamarin booth to answer your questions and help you understand how Xamarin can help you build, test, and monitor apps. Drop by for a chat—and maybe some of our popular Xamarin t-shirts and other swag!

GOTO Copenhagen 2015 – October 5th to 6th (Workshops Oct. 7-8)

GOTO Copenhagen 2015

If you can’t catch Mike’s talk in London, you have another chance to get the lowdown on Xamarin.Forms just a few weeks later at GOTO Copenhagen 2015 in Denmark. While you’re there, don’t miss Niels Frydenholm, Senior iOS Developer at eBay Classifieds, who will be presenting invaluable advice on the topic of “Continuous Delivery of Native Apps”, including automated UI testing with Xamarin Test Cloud.

We look forward to seeing you soon!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 26, 2015

Securing Your App with Touch ID


One of my favorite features of the iPhone is Touch ID, introduced by Apple with the release of the iPhone 5s a couple of years ago. touch-id-iconTouch ID adds biometric authentication to your device so users can touch the home button to unlock their device instead of using a pin code.

Since its initial release, Apple has added a few new ways to use Touch ID, including integrating it as an essential part of Apple Pay and adding an API for developers to use Touch ID in their apps. In this blog post we’re going to discuss how you can leverage Touch ID to create secure user authentication. We’ll include a fallback to store the password in Keychain and authenticate our users against that in cases where the device doesn’t support Touch ID.

Xamarin Studio with TouchID Design

Supporting Older Devices

Sign Up

If the device has Touch ID, we won’t need to sign the user up since the device can authenticate them for us. But to ensure we support devices such as iPhone 4, 4S, and the iPhone 5, we’ll want to ensure we’ve got a fallback in place. To do this, we’ll use Keychain to store and validate the user credentials.

I like to use UserDefaults for storing usernames to read back information when the app launches and populate the username UITextField for the user. It’s small touches like this that make an app feel more polished and help achieve higher ratings on the app store.

var hasLoginKey = NSUserDefaults.StandardUserDefaults.BoolForKey("hasLogin");

if (!hasLoginKey)

    NSUserDefaults.StandardUserDefaults.SetValueForKey(new NSString(tbxUsername.Text), new NSString("username"));

Saving the Password

It’s important to note that we don’t want to use UserDefaults here since it’s not a secure approach to saving your data. Instead, we’ll use Keychain, which is iOS’s built-in secure storage service that allows us to store passwords, keys, certificates, and more. My colleague René Ruppert has developed a helpful wrapper for storing passwords on iOS with Keychain that you can grab here and is what I’ll be using.

To save the password, we simply call ‘SetPasswordForUsername’. In this case, I have my serviceId set to ‘MySecureApp’.

Helpers.KeychainHelpers.SetPasswordForUsername(tbxUsername.Text, tbxPassword.Text, serviceId, Security.SecAccessible.Always, true);

Once we’ve done that, it’s time to set ‘hasLogin’ to true and synchronize the UserDefaults.

NSUserDefaults.StandardUserDefaults.SetBool(true, "hasLogin");


Validating the User Credentials

We’re now ready to validate the credentials provided by the user. To do this, we get the password from the Keychain and check that it matches the password provided. We then repeat the process with the username. If CheckLogin returns true, then we can continue loading new views.

static bool CheckLogin(string username, string password)
    if (password == Helpers.KeychainHelpers.GetPasswordForUsername(username, serviceId, true) &&
        username == NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("username")).ToString())
        return true;
    return false;

Adding Touch ID

Implementing user authentication with Touch ID is painless and only involves a tiny amount of code since iOS does most of the heavy lifting for us. Below is all the code required to get started.

//Lets double check the device supports Touch ID
if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out error))
    var replyHandler = new LAContextReplyHandler((success, error) =>
            InvokeOnMainThread(() =>
                    if (success)
                        var newVC = new UIViewController();
                        PresentViewController(newVC, true, null);
                        var alert = new UIAlertView("OOPS!", "Something went wrong.", null, "Oops", null);
    context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, "Logging in with Touch ID", replyHandler);
    var alert = new UIAlertView("Error", "TouchID not available", null, "BOOO!", null);

Wrapping Up

Not all apps require a backend service for user authentication, and iOS provides lots of options for authenticating locally. If you wanted to take this one step further you could look at integrating 1Password authentication into your app. I’ve created a completed version of the demo project on GitHub, to which I’ll be adding 1Password support to in a separate branch that you can find here. Additionally, be sure to read through our full documentation on integrating Touch ID.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 25, 2015

Mobile Apps with Visual Basic & Xamarin.Forms


If you are a Visual Basic developer, your options for becoming a mobile developer have historically been limited to targeting Windows Phone; however, with Xamarin.Forms, Portable Class Libraries, and Visual Studio, developing iOS and Android apps entirely in Visual Basic has become a real possibility.

Last year I wrote about how Visual Basic Portable Class Libraries (PCLs) can be used in Xamarin apps. Xamarin.iOS and Xamarin.Android can access business logic written in Visual Basic PCLs, while writing the platform-specific code (including the user interface) in C# (or F#) on the Xamarin platform.

Visual Basic Xamarin.Forms

Since then we’ve released Xamarin.Forms, which makes it possible for an entire app—from business logic to user interface—to be written in a PCL and shared across platforms. This means that it’s become possible to write entire mobile applications in Visual Basic in Visual Studio using Xamarin.Forms. The Xamarin developer portal has instructions on creating a Visual Basic project from the Xamarin.Forms new project template. A “Basic” App class is shown here:

Public Class App
    Inherits Application
    Public Sub New()
        Dim label = New Label With {.XAlign = TextAlignment.Center,
                                    .FontSize = Device.GetNamedSize(NamedSize.Medium, GetType(Label)),
                                    .Text = "Welcome to Xamarin.Forms with Visual Basic.NET"}
        Dim stack = New StackLayout With {
            .VerticalOptions = LayoutOptions.Center
        Dim page = New ContentPage
        page.Content = stack
        MainPage = page
    End Sub

Once you’ve created a new project and converted it to Visual Basic (or just started with the sample) your entire application can be written in Visual Basic. The code below represents a simple ContentPage written in Visual Basic. You can use this as a basis for new pages in your apps:

Public Class Page2
    Inherits ContentPage
    Public Sub New()
        Dim label = New Label With {.XAlign = TextAlignment.Center,
                                    .FontSize = Device.GetNamedSize(NamedSize.Medium, GetType(Label)),
                                    .Text = "Visual Basic  ContentPage"}
        Dim button = New Button With {.Text = "Click me"}
        AddHandler button.Clicked, Async Sub(sender, e)
                                       Await DisplayAlert("Hello from VB", "Visual Basic.NET is back!", "Thanks")
                                   End Sub
        Dim stack = New StackLayout With {
            .VerticalOptions = LayoutOptions.Center
        Content = stack
    End Sub
End Class

Xamarin doesn’t implement support for the Visual Basic language directly, so you can’t use Xamarin Studio for these projects; however, if you’re a Visual Basic programmer, or have existing Visual Basic code you’d like to mobilize, there’s never been a better time to get started with mobile development with Xamarin.Forms! And, of course, if you have published a Windows Phone application written in Visual Basic, there’s still time to take advantage of our free subscriptions for Windows Phone Developers promotion before August 31, 2015.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 24, 2015

Rapid Mobile App Prototyping with Xamarin.Forms


Creating mobile app prototypes is an important part of the design process. It’s extremely useful for developers and test users to be able to interact with a prototype in order to experience how the app will behave when it’s complete, but building prototypes can be daunting due to the large amount of time it takes. This is especially true when you’re asked to make prototypes for more than just one mobile platform, which happens more often than not. With Xamarin.Forms, though, it’s quick and easy to create user interfaces that are shared across Android, iOS, and Windows Phone.

Wireframes vs. Mockups vs. Prototypes

These terms often get used interchangeably in the mobile world. In order to understand why you might use Xamarin.Forms for prototyping, let’s go over the differences between these design terms.



Wireframes are a static, low-fidelity representation of design. They’re usually in black and white, with blue sometimes used to show links and/or buttons. Wireframes should be created before mockups or prototypes, since they’re the backbone of your mobile app’s design.

Bottom Line: Wireframes are quick to create and are typically used as documentation for your project.


Mockups are a static, high-fidelity representation of designs. These full-color images should look almost exactly like the final product in terms of color, icons, buttons, etc. Mockups represent the structure of information and demonstrate the basic functionalities of your app in a static way.

Bottom Line: Mockups are quicker to create than prototypes and are great for gathering feedback on the design in its entirety.


Prototypes are a middle to high-fidelity representation of the final product that simulates user interaction. It’s more likely that your prototypes will be middle-fidelity, meaning they won’t have to be as accurate as mockups when it comes to the design of your app. Prototypes should allow testers to interact with the app in a way similar to the final product.
Bottom Line: Prototypes are expensive to create but are good for allowing stakeholders to preview the mobile app in its entirety.

Xamarin.Forms for Prototyping

Prototyping can be expensive and time consuming, but Xamarin.Forms lets you create prototypes for all three platforms by writing code in XAML or C# just one time, greatly reducing this pain. Xamarin.Forms also allows you to put real apps onto real devices to show off your prototypes. It empowers you to rapidly create a prototype and then put your prototype onto iOS, Android, and Windows devices so that your client or stakeholder can experience the user interaction of your app. That’s a pretty powerful tool in the design and development process.

So… Let’s code!

We are going to use the Swarm mobile app by Foursquare for our prototyping example. Here are a few screens that we should be able to easily create prototypes for:

Initial Setup

Create a new Xamarin.Forms app. I’m going to name mine “SwarmPrototype”. Now, add a new Forms ContentPage XAML file named “LoginPage”.

In your App.cs file, modify the existing App() method so that our LoginPage shows up as soon as the app starts. We will also wrap the LoginPage in a NavigationPage and change some navigation bar properties.

public App ()
  // The root page of your application
  MainPage = new NavigationPage(new LoginPage())
    BarBackgroundColor = Color.Transparent,
    BarTextColor = Color.White

This gives us a NavigationPage, which provides some simple navigation properties so we can easily move from screen to screen through our prototype. The navigation bar will have white text to represent the screenshots above.


Let’s head over to our LoginPage.xaml now. You can see it has automatically given us a content page in which we will need to add some content. First, add a StackLayout with 200 padding on top and an orange background.


Now, inside of our stacklayout, which is oriented vertically by default, we want to add a label, two entries, and three buttons. The label and the two entries will look like this:

  Text="Log in with your Foursquare account"

As you can see, we have a label and then two entries inside of another stacklayout. The reason I put those two entries inside of a new stacklayout is so that I could make sure the Spacing=”20″ in our main stacklayout didn’t apply to those elements. Here’s the rest of the XAML for the LoginPage:

    Text="Log in"
  Text="Forgot your password?"

One Last Thing

Now we have a static login page, which is a great start, but prototypes are meant to be interactive; we want the app to navigate when the user clicks the “Log in” button. In the LoginPage.xaml.cs file, we’re going to add an event handler for that button as well as a line of code to hide the navigation bar on the LoginPage.

public LoginPage ()
  InitializeComponent ();
  NavigationPage.SetHasNavigationBar (this, false);
  buttonLogin.Clicked += async (object sender, EventArgs e) => {
    await Navigation.PushAsync (new ActivityFeedPage ());

In the event handler, we use the Navigation property (given to us by the NavigationPage we set up in our App.cs file) to Push a new ActivityFeedPage. You will have to add a new ContentPage XAML file named “ActivityFeedPage” for this to work.

Our login page is now good to go! If we run the app we can see that, even though we only wrote one XAML file, it looks and feels native on Android and iOS.

Keep on coding!

I urge you to take a look at the Xamarin.Forms guides and to try creating the next two pages on your own. If you’re having trouble, take a look at the completed project on my GitHub. I will also be doing a more extensive guest lecture on this topic through Xamarin University on September 24th. Get your free 30-day trial so you can join me for this awesome rapid prototyping session!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 21, 2015

Test Your Way to Xamarin Evolve Contest Winners!


We’d like to extend a big “Thank you!” to everyone that entered our “Test Your Way to Xamarin Evolve” contest. With app testing at the forefront of every mobile project, Xamarin wanted to relieve some of the stress associated with UI.Testing by introducing Xamarin Test Cloud. Now that all Xamarin Platform subscriptions include 60 Xamarin Test Cloud device minutes per month to test any app, we asked to see all of your awesome apps running in Xamarin Test Cloud!

Picking a single winner for a big prize like a ticket to Xamarin Evolve 2016 is difficult. However, without further adieu, I’m excited to congratulate our Grand Prize winner, Casper Skoubo!

Casper Tweet Pic 1

The app is called “Tilbagekaldt”, which in Danish translates to “revoke” or “withdraw” and was intended as a warning service for users when the Danish Ministry of Food sends out warnings about foods that may not have been handled correctly.

Casper Tweet Pic 2

With such great submissions from the community, we couldn’t decide on just one second place winner. So, I’m happy to congratulate both of our second place winners: James Alt and Mitch Muenster, for their wonderful contributions to Xamarin Test Cloud!

And also honorable mentions to:

Sebastian Seidel

Esteban Solano

Alison Fernandes

Marcel Malik

Mark Arteaga

Pavlina Pavlova

Didn’t get a chance to partake in the contest? Not to worry! You can still take advantage of this new benefit to start automating UI testing for mobile apps written on ANY platform (not just Xamarin) on our industry-leading catalog of over 1,800 devices. Get started using Xamarin Test Cloud today!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 20, 2015

Mars Petcare Improves Engagement 10x with Xamarin


Mars Petcare logoIn 1911, Frank C. Mars made the first Mars candies, establishing Mars’ roots as a confectionery company. The company, based in McLean, Virginia, now has a presence in 74 countries, generating net sales of more than $33 billion a year.

Mars Petcare, one of the company’s six lines of business, is headquartered in Brussels, Belgium, and is one of the world’s leading pet care providers, employing more than 35,000 associates representing over 41 brands, including industry giants PEDIGREE®, IAMS®, and WHISKAS®. To keep sales representatives and other customer-oriented personnel up to date, they created a sales portal to access marketing collateral, training information, and their own private social network.

Hoping that a move to mobile would increase the use of the previously web-based sales portal by sales associates and distributors, Mars Petcare turned to Fortuitas, a Xamarin Premier Consulting Partner. Using the Xamarin Platform and Xamarin.Forms, Fortuitas and Mars created a cross-platform iOS and Android app that shares 100% of its code.

Mars Petcare app on iPhone, Android, and tablet

“Our ability to use Xamarin to create all of the user interface using the same code across platforms was a major time saver,” Kurtz says. “The 100% code sharing reduced our total development time for the iOS and Android apps by at least 50%.”

Mars is more than pleased with the results, with sales representatives and other users valuing the newfound ease with which they can access and share blogs, collateral, and other materials and collaborate socially to help build a sense of community.

“Initially there were just a few hundred people using the portal,” Kurtz says. “After deploying the mobile app, those numbers skyrocketed to almost 3,000 users. We’ve been told that people love it because it provides the true mobile user experience they needed to access high- value content.”


View the Case Study

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 19, 2015

Xamarin Helps Launch AWS APN Mobile Competency Program


We’re excited to announce that we’ve been selected as an inaugural Amazon Web Services’ (AWS) Mobile Competency Program Partner. The Amazon Partner Network (APN) Competency Program highlights companies who have demonstrated technical expertise and customer success across specialized solutions and industries, including security, digital media, big data, and many others. The new Mobile Competency Program recognizes top partners with extensive experience working with developers and mobile-first businesses to help build, test, and monitor mobile apps.

AWS Advanced Technology Partner for Mobile Competency badge

We recently announced the Amazon Web Services (AWS) Mobile SDKs for Xamarin, allowing developers to quickly connect their native Xamarin apps to an array of AWS cloud services for identity management, push notifications, cloud storage, analytics, and more. Our inclusion in the APN Mobile Competency Program reinforces our collaboration with AWS, and affirms our leadership in delivering high quality integrations to organizations worldwide.

Together with AWS, we’re making it easy, fast, and fun to build beautiful, high-performance apps powered by robust cloud services. To get started, check out the AWS Mobile SDKs from the Xamarin Component Store.

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone
August 18, 2015

Using Auto Layouts for iOS 9 SplitView


The official launch of iOS 9 is on the horizon, which makes it a great time to ensure your Xamarin.iOS app is ready to take advantage of all of the upcoming features. One that I’m excited about is the new and improved multi-tasking experience on the iPad. With iOS 9, it’s possible to run two apps side-by-side in a split view on the iPad. This means that your app can’t assume that it’s going to have the device’s full resources, or, more importantly, the entire screen. If you already use Auto Layouts for your apps, then you’re all set to take advantage of split view on the iPad, but if your app is using the older layout option of Autoresizing, you’ll want to transition to Auto Layouts as soon as possible to make sure you’re ready for the change.

iOS 9 Split View Multitasking

Getting Started with Auto Layouts

Auto Layout for iOS is an extremely powerful layout system that allows you to create complex relationships between controls and how they should respond to changes in screen size or orientation. Let’s take a look at how you can take an existing Autoresizing layout and convert it to Auto Layout. Below is my simple iPad layout, which uses Autoresizing.

Screen Shot 2015-08-13 at 16.29.08This is how we want our app to look when Auto Layouts is switched on. To turn Auto Layouts on, we’ll first need to click on the canvas behind our view controllers. This will allow access to the Storyboard Document Inspector, as you can see in the right hand side of the above screenshot.

Select ‘Use Auto Layouts’. When you do this you’ll notice two extra buttons appear in the toolbar. These are adding and removing constraints from our controls. Now that Auto Layouts is enabled, we can begin to define our layout relationships between controls. We’ll begin with configuring the layout for the title. The key to successfully mastering Auto Layouts is understanding that you’re providing rules for width, height, and X and Y positions. If you don’t provide these four pieces of information per control, your layout won’t work. When you double click the ‘My Amazing App!’ label, you’ll see controls that look similar to “Ts” appear on the edges. Screen Shot 2015-08-13 at 16.37.30

We can drag these controls to form connections. In the example below, I’m defining the Y-value of the control relationship to the top of the view controller.

Screen Shot 2015-08-13 at 16.38.36

Dragging the square in the center of the label allows us to set its X position as the middle of the view. I can click the control on the bottom and right of the Ts to fix the height and width of the label. If you’ve done this successfully, you’ll see the Auto Layout guides change from orange (to indicate an issue) to blue.

Screen Shot 2015-08-13 at 16.42.18

If you repeat the process for the bottom button by fixing the height and drawing lines to the left button and right edges, you should be able to rotate the UI and see both the label and the button resize correctly.

Screen Shot 2015-08-13 at 16.48.51

Finishing Up

Hopefully this post has demonstrated that using Auto Layouts is straight forward and not as complex as you might have initially thought. If you’re looking for advanced examples or more in-depth understanding of how to utilize Auto Layouts, make sure to check out our documentation.

Remember, its not long before iPad users will expect your app to work with Split View, so make sure you’re ready today!

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone