Partilhar via


Windows cookbook for iOS devs

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Here are some common Windows 8.1 and Windows Phone 8.1 programming tasks you might be wondering how to migrate from iOS.

We'll look at these tasks, provide some code and discuss how they might be different from the iOS way of doing things.

In this section

Topic Description

Special considerations for Windows Store apps

A few things to consider when creating a Windows Store app.

Designing your app with XAML: the Grid

Design your app using XAML grid controls and take control of its appearance and behavior.

Designing your app with XAML: Orientation

Design your C# and XAML to respond appropriately when the orientation changes.

Designing your app with XAML: Resizing

Design your C#/XAML app so it responds as expected to resizing.

Skinning and animating a button

You are free to skin your app's buttons and animate them too. Here's how.

Applying storyboard animations to multiple XAML objects

Here's how to avoid having to create multiple storyboard animations, and instead apply the same storyboard to multiple objects.

Writing a sprite-based game

Creating a 2D action game is a rite of passage for developing on any platform.

Detecting motion with accelerometer hardware

Use your Windows 8.1 or Windows Phone 8.1 device as the controller in your apps and games.

Making use of existing iOS code

Speed up development time by re-using your existing iOS code.

Capturing and saving images from the camera

Here's how to capture an image from a camera and then save it or share it.

Making your app speak

Adding speech to your app takes only a few lines of code. Can you say "Easy peasy?"

Opening message boxes

Open a UIAlertView-style pop-up box in Windows 8 and Windows Phone 8.1, using the MessageDialog control.

Displaying debug messages

When developing for iOS, you’ve probably used NSLog to display debugging and status messages. Here's how you would do that with Windows 8 and Windows Phone 8.1.

Displaying progress and activity indicators

Keep your users informed when your app is busy with progress bars and spinning activity dots.

Data binding controls

Data binding links your app's user interface with your app's data classes.

Loading and saving files

How to use file pickers to load and save data.

Loading and processing bitmaps

Here's code that will allow the user to select an image using a FilePicker control, and then load and process it.

Loading and saving settings

You can store and access app preferences and settings, and even share this data between computers using automatic syncing.

Push notifications

Send messages to your apps using push notifications.

Creating a trial version of your app

There is no need to create a separate project to make a trial version for your Windows Store apps, thanks to the LicenseInformation class.

Sharing test builds

Here is how to share versions of your app for beta testing, equivalent to Ad Hoc builds in iOS.

Running code in the background

You can run a task in the background to perform work when your main app is not running.

App lifecycle for iOS devs

Both iOS and Windows Store apps have a specific set of methods and events that are called or triggered as an app starts up and shuts down. Here's a comparison.

Supporting multiple resolutions in Windows 8.1 apps

Windows Store apps can run on a wide variety of screen sizes and resolutions, and bitmaps can suffer if scaled.

Playing a sound effect

Here are code samples for playing an audio file, such as a sound effect.

Obtaining and using location data

Finding your user's location, and plotting their position on a map.

Using a database

If you have been using CoreData in your iOS apps, you'll find this info useful when working in Windows 8.1 or Windows Phone 8.1.

Downloading JSON data

Downloading and processing data from web sites is a common task, and here's how to do the equivalent of iOS's [NSData dataWithContentsOfURL] in Windows 8.1 and Windows Phone 8.1.

Code libraries, toolkits and other sources of help

The Microsoft developer community and other third-parties have created many toolkits and frameworks to help you. Check them out!

Source control with Visual Studio

Keep your projects safe and collaborate with others using Visual Studio Online.

Visual Studio hints and tips

Here's how to become as comfortable in Microsoft Visual Studio as you are in Xcode.