Mostly formatting fixes. removing ide switcher from recipes

This commit is contained in:
Amy Burns 2018-03-29 12:58:28 -04:00
Родитель cc6defba64
Коммит 6ea126936a
26 изменённых файлов: 215 добавлений и 253 удалений

Просмотреть файл

@ -33,32 +33,32 @@ version) to create the user profile:
In Android 4.x (Ice Cream Sandwich):
- Start the **People** app.
- Tap <span class="uiitem">Create a new contact</span>.
- Tap <span class="uiitem">Keep local</span>.
- Tap **Create a new contact**.
- Tap **Keep local**.
- Enter a name for a temporary user, such as "Temp".
- Tap the check mark next to <span class="uiitem">Done</span>.
- Tap the check mark next to **Done**.
- Tap the back arrow in the upper left hand corner of the screen.
- Tap <span class="uiitem">Set up my profile</span> (under the
- Tap **Set up my profile** (under the
**ME** heading).
- Under <span class="uiitem">My local profile</span>, enter your
- Under **My local profile**, enter your
name and, optionally, a phone
number and email address.
- Tap the check mark next to <span class="uiitem">Done</span>.
- Tap the check mark next to **Done**.
In Android 5.x (Lollipop):
- Start the **Contacts** app.
- Tap <span class="uiitem">CREATE A NEW CONTACT</span>.
- Tap <span class="uiitem">KEEP LOCAL</span>.
- Tap **CREATE A NEW CONTACT**.
- Tap **KEEP LOCAL**.
- Enter a name for a temporary user, such as "Temp".
- Tap the check mark next to <span class="uiitem">Add new contact</span>.
- Tap the check mark next to **Add new contact**.
- Click the back button.
- Tap <span class="uiitem">Set up my profile</span> (next to the
- Tap **Set up my profile** (next to the
**ME** heading).
- Under <span class="uiitem">My local profile</span>, enter your
- Under **My local profile**, enter your
name and, optionally, a phone
number and email address.
- Tap the check mark next to <span class="uiitem">Add new contact</span>.
- Tap the check mark next to **Add new contact**.
To update and query the user profile, follow these steps:
@ -70,19 +70,19 @@ To update and query the user profile, follow these steps:
(For more information about Android version settings, see
[Understanding Android API levels](https://developer.xamarin.com/guides/android/application_fundamentals/understanding_android_api_levels/).)
In Visual Studio, open the project properties in
<span class="uiitem">Solution Explorer</span> and select the <span
class="uiitem">Application</span> page. In the drop-down menu under
<span class="uiitem">Minimum Android to target</span> you can
**Solution Explorer** and select the <span
class="uiitem">Application** page. In the drop-down menu under
**Minimum Android to target** you can
select the minimum Android version for your project:
![](Images/vs-minimum.png)
In Visual Studio for Mac, click the gray gear icon to the right of the
project and select <span class="uiitem">Options</span>; this opens
the <span class="uiitem">Project Options</span> dialog. Click <span
class="uiitem">Build > Android Application</span>. Using the
drop-down menu to the right of <span class="uiitem">Minimum Android
version</span>, you can set the minimum Android version for your
project and select **Options**; this opens
the **Project Options** dialog. Click <span
class="uiitem">Build > Android Application**. Using the
drop-down menu to the right of **Minimum Android
version**, you can set the minimum Android version for your
project:
![](Images/xs-minimum.png)
@ -91,17 +91,17 @@ To update and query the user profile, follow these steps:
- Set the target framework to API level 15 or
later. In our example, we have it set to Android 5.0 (API level
21). In Visual Studio, go to the project's <span
class="uiitem">Application</span> page. Set the target framework by
class="uiitem">Application** page. Set the target framework by
selecting the API level in the drop-down menu under <span
class="uiitem">Compile using Android version</span>:
class="uiitem">Compile using Android version**:
![](Images/vs-target.png)
In Visual Studio for Mac, open the <span class="uiitem">Project
Options</span> dialog. In this dialog, click <span
class="uiitem">Build > General</span>. Set the target framework by
In Visual Studio for Mac, open the **Project
Options** dialog. In this dialog, click <span
class="uiitem">Build > General**. Set the target framework by
selecting the API level in the drop-down menu to the right of <span
class="uiitem">Target framework</span>:
class="uiitem">Target framework**:
![](Images/xs-target.png)
@ -109,13 +109,13 @@ To update and query the user profile, follow these steps:
- Add permissions to the Android manifest that enables the app to
read and write contacts as well as read and write profile data.
In Visual Studio, open the project properties in <span
class="uiitem">Solution Explorer</span> and select the <span
class="uiitem">Android Manifest</span> page:
class="uiitem">Solution Explorer** and select the <span
class="uiitem">Android Manifest** page:
![](Images/vs-manifest.png)
Enable the following permissions under <span
class="uiitem">Required permissions</span>:
class="uiitem">Required permissions**:
- **READ_CONTACTS**
- **READ_PROFILE**
@ -123,14 +123,14 @@ To update and query the user profile, follow these steps:
- **WRITE_PROFILE**
In Visual Studio for Mac, click the gray gear icon to the right of the
project and select <span class="uiitem">Options</span>; this opens
the <span class="uiitem">Project Options</span> dialog. Click <span
class="uiitem">Build > Android Application</span>:
project and select **Options**; this opens
the **Project Options** dialog. Click <span
class="uiitem">Build > Android Application**:
![](Images/xs-manifest.png)
Enable the following permissions in the <span
class="uiitem">Required permissions</span> section:
class="uiitem">Required permissions** section:
- **ReadContacts**
- **ReadProfile**
@ -244,8 +244,8 @@ button.Click += delegate {
};
```
- Build and run the app; it displays an <span class="uiitem">UPDATE
PROFILE</span> button as seen below in the screenshot on the left. When
- Build and run the app; it displays an **UPDATE
PROFILE** button as seen below in the screenshot on the left. When
we tap this button to cause the button click handler to run, the
following sequence takes place:
- The call to `NameOwner` updates the profile's display

Просмотреть файл

@ -4,30 +4,27 @@ title: "Add Permissions to Android Manifest"
brief: "This recipe shows how to add permissions to the Android Manifest (Manifest.xml)."
---
<a name="Recipe" class="injected"></a>
# Recipe
To edit Android Manifest permissions for your project:
<ide name="vs">
<ol>
<li>Right-click on your android project and select <span class="UIItem">Properties</span>.</li>
<li>Select <span class="UIItem">Android Manifest</span> in the window that opens.</li>
<li>Check the permissions that you want to require in the list of permissions.</li>
</ol>
<img src="Images/vis.png" />
</ide>
<ide name="xs">
<ol>
<li>Right-click on your android project and select <span class="UIItem">Options</span>.</li>
<li>Select <span class="UIItem">Android Application</span> in the window that opens.</li>
<li>Check the permissions that you want to require in the list of permissions.</li>
</ol>
<img src="Images/xam.png" />
</ide>
## Visual Studio
1. Right-click on your android project and select <span class="UIItem">**Properties**</span>.
2. Select <span class="UIItem">**Android Manifest**</span> in the window that opens.
3. Check the permissions that you want to require in the list of permissions.
![](Images/vis.png)
## Visual Studio for Mac
1. Right-click on your android project and select <span class="UIItem">**Options**</span>.
2. Select <span class="UIItem">**Android Application**</span> in the window that opens.
3. Check the permissions that you want to require in the list of permissions.
![](Images/xam.png)
<a name="Additional_Information" class="injected"></a>
# Additional Information

Просмотреть файл

@ -7,30 +7,24 @@ article:
url: https://developer.xamarin.com/guides/android/getting_started/hello,_world
---
<a name="Recipe" class="injected"></a>
# Recipe
<ide name="xs">
<ol>
<li>First, launch Visual Studio for Mac and click on <span class="UIItem">New...</span> in the top
left corner: <img src="Images/project_00.png"</li>
<li>A window will pop up with a list of options for the types of projects
available to you. To create an Android project, select the Android>App category to open up
the available sub-categories, then choose Android App: <img src="Images/android_project_01.png" /></li>
<li>Choose a sensible name for your app and choose development targets: <img src="Images/app_name.png" /></li>
<li>Choose a project name, then click <span class="UIItem">OK</span>:<br /> <img src="Images/project_name.png" /></li>
<li>Visual Studio for Mac will create and populate a new project for you: <img src="Images/android_project_02.png" /></li>
</ol>
</ide>
<ide name="vs">
<ol>
<li>First, launch Visual Studio and click on <span class="UIItem">New Project...</span> in the top
left corner: <img src="Images/project_00_vs.png"</li>
<li>A window will pop up with a list of options for the types of projects
available to you. To create an Android project, select the Android then <span class="UIItem">Blank App (Android)</span>. Enter a project name: <img src="Images/android_project_01_vs.png" /></li>
<li>Visual Studio will create and populate a new project for you: <img src="Images/android_project_02_vs.png" /></li>
</ol>
## Visual Studio for Mac
1. First, launch Visual Studio for Mac and click on <span class="UIItem">**New...**</span> in the top left corner: ![](Images/project_00.png)
2. A window will pop up with a list of options for the types of projects available to you. To create an Android project, select the Android>App category to open up the available sub-categories, then choose Android App: ![](Images/android_project_01.png)
3. Choose a sensible name for your app and choose development targets: ![](Images/app_name.png)
4. Choose a project name, then click <span class="UIItem">**OK**</span>:
![](Images/project_name.png)
5. Visual Studio for Mac will create and populate a new project for you: ![](Images/android_project_02.png)
## Visual Studio
1. First, launch Visual Studio and click on <span class="UIItem">**New Project...**</span> in the top left corner: ![](Images/project_00_vs.png)
2. A window will pop up with a list of options for the types of projects available to you. To create an Android project, select the Android then <span class="UIItem">**Blank App (Android)**</span>. Enter a project name: ![](Images/android_project_01_vs.png)
3. Visual Studio will create and populate a new project for you: ![](Images/android_project_02_vs.png)
</ide>
## Additional Information

Просмотреть файл

@ -4,26 +4,20 @@ title: "Specify Default Namespace"
brief: "This recipe shows where to set the default namespace for a project."
---
<a name="Recipe" class="injected"></a>
# Recipe
<ide name="xs">
<ol>
<li>Double click on the project in the <span class="UIItem">Solution Pad</span>, or right-click on the project and select <span class="UIItem">Options</span>: <img src="Images/DefaultNamespace1.png" /></li>
<li>Choose main settings and you'll be able to edit the default namespace: <img src="Images/DefaultNamespace4.png" /></li>
<li>This value will be automatically set as the root namespace in each new code file you create in your project.</li>
</ol>
</ide>
<ide name="vs">
<ol>
<li>Open the project <span class="UIItem">Properties</span>, and then choose the <span class="UIItem">Application</span> panel: <img src="Images/DefaultNamespace3.png" /></li>
<li>This value will be automatically set as the root namespace in each new code file you create in your project.</li>
</ol>
</ide>
## Visual Studio for Mac
1. Double click on the project in the <span class="UIItem">**Solution Pad**</span>, or right-click on the project and select <span class="UIItem">**Options**</span>: ![](Images/DefaultNamespace1.png)
2. Choose main settings and you'll be able to edit the default namespace: ![](Images/DefaultNamespace4.png)
3. This value will be automatically set as the root namespace in each new code file you create in your project.
## Visual Studio
1. Open the project <span class="UIItem">**Properties**</span>, and then choose the <span class="UIItem">**Application**</span> panel: ![](Images/DefaultNamespace3.png)
2. This value will be automatically set as the root namespace in each new code file you create in your project.
<a name="Additional_Information" class="injected"></a>
# Additional Information

Просмотреть файл

@ -58,7 +58,7 @@ videoView.Start ();
```
<ol start="6">
<li>Under <span class="UIItem">Project Options</span>, add an Android Manifest. Under Required permissions set the <code>INTERNET</code> permission and press <span class="UIItem">OK</span>.</li>
<li>Under **Project Options**, add an Android Manifest. Under Required permissions set the <code>INTERNET</code> permission and press **OK**.</li>
</ol>
<a name="Additional_Information" class="injected"></a>

Просмотреть файл

@ -7,6 +7,6 @@ Android provides support for animating properties of any type as well as animati
[ ![](Images/screen2.png)](Images/screen2.png)
- <span class="noChildren"><a href="/Recipes/android/other_ux/animation/frame_animation">Frame Animation</a></span>
- <span class="noChildren"><a href="/Recipes/android/other_ux/animation/frame_animation">Frame Animation</a>**
- <span class="noChildren"><a href="/Recipes/android/other_ux/animation/rotate_animation">Rotate Animation</a></span>
- <span class="noChildren"><a href="/Recipes/android/other_ux/animation/animate_listview_deletion">Animate ListView Deletion</a></span>

Просмотреть файл

@ -28,7 +28,7 @@ The `GetBlurredBitmap` method will take a single `Android.Graphics.Bitmap` insta
This code is a compromise between a Gaussian blur and a Box blur. The algorithm works by creating a moving stack of colors while scanning through the image. This "tower" controls the weights of the single pixels within the convolution kernel and gives the pixel in the center the highest weight.
When the user clicks on the <span class="uiitem">Load Blurred Image</span> button the application will load a bitmap, scale it a size that is appropriate for the device, and then apply a Gaussian blur to it. Blurring the image takes a noticeable amount of time (approximately 6 seconds on a Nexus 5), so the work is performed on a background thread. After the image is blurred it is displayed to the user, as demonstrated in the following screenshots:
When the user clicks on the **Load Blurred Image** button the application will load a bitmap, scale it a size that is appropriate for the device, and then apply a Gaussian blur to it. Blurring the image takes a noticeable amount of time (approximately 6 seconds on a Nexus 5), so the work is performed on a background thread. After the image is blurred it is displayed to the user, as demonstrated in the following screenshots:
![](Images/image00.png) ![](Images/image01.png)
@ -37,7 +37,7 @@ When the user clicks on the <span class="uiitem">Load Blurred Image</span> butto
# Recipe
The event handler for the <span class="uiitem">Load Blurred Image</span> button is shown in the following code snippet:
The event handler for the **Load Blurred Image** button is shown in the following code snippet:
```
_blurImageButton.Click += async delegate{

Просмотреть файл

@ -24,7 +24,7 @@ This recipe shows one way to blur an image using an API that was introduced in A
The recipe [Blur an Image with Managed Code]() is a example of how to apply a blur effect on all Android API levels.
This application will display a picture and a [SeekBar](http://developer.android.com/reference/android/widget/SeekBar.html).
The value of the <span class="uiitem">SeekBar</span> will determine how much the image should be blurred. You can see
The value of the **SeekBar** will determine how much the image should be blurred. You can see
this application running in the following screenshots:
![](Images/image01.png) ![](Images/image03.png)

Просмотреть файл

@ -52,21 +52,34 @@ Rivets.AppLinks.Navigator.Navigate(&quot;http://any.old.url&quot;)
- Install the [Rivets](https://www.nuget.org/packages/Rivets/) package from
the NuGet Gallery if you have not already done so.
- <ide name="xs">Open your app&#39;s `Info.plist` file, and under the **Advanced** tab, in the **URL Types** section, add a new URL Type like:<br/> ![Image of Info.plist configuration](Images/app-links-incoming-ios-infoplist.png)</ide><ide name="vs">Manually edit your <code>Info.plist</code> file and add the following section:<br/><pre><code>
&lt;key&gt;CFBundleURLTypes&lt;/key&gt;
&lt;array&gt;
&lt;dict&gt;
&lt;key&gt;CFBundleURLName&lt;/key&gt;
&lt;string&gt;com.example.store&lt;/string&gt;
&lt;key&gt;CFBundleURLTypes&lt;/key&gt;
&lt;string&gt;Viewer&lt;/string&gt;
&lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
&lt;array&gt;
&lt;string&gt;example&lt;/string&gt;
&lt;/array&gt;
&lt;/dict&gt;
&lt;/array&gt;
</code></pre></ide>
- Edit the Info.plist
## Visual Studio for Mac
Open your app's **Info.plist** file, and under the **Advanced** tab, in the **URL Types** section, add a new URL Type like:
![Image of Info.plist configuration](Images/app-links-incoming-ios-infoplist.png)
## Visual Studio
Manually edit your **Info.plist** file and add the following section:
```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.example.store</string>
<key>CFBundleURLTypes</key>
<string>Viewer</string>
<key>CFBundleURLSchemes</key>
<array>
<string>example</string>
</array>
</dict>
</array>
```
- In your `AppDelegate` , setup your app to have a Navigation controller which is your window&#39;s root view controller, like this:

Просмотреть файл

@ -15,11 +15,11 @@ article:
The log window is a useful debugging tool, and is simple to use.
1. First, locate the log window. You can toggle it in Visual Studio for Mac by selecting
the <span class="UIItem">Application Output</span> panel on the bottom right:
the **Application Output** panel on the bottom right:
[ ![](Images/ios_log_00.png)](Images/ios_log_00.png)
In Visual Studio, select the <span class="UIItem">Output</span> panel on the bottom left:
In Visual Studio, select the **Output** panel on the bottom left:
[ ![](Images/ios_log_00_vs.png)](Images/ios_log_00_vs.png)

Просмотреть файл

@ -19,12 +19,12 @@ view the call stack, and more:
[ ![](Images/breakpoint_00.png)](Images/breakpoint_00.png)
You can configure which tools you see in the Debug
view by selecting <span class="UIItem">View > Debug Windows</span>:
view by selecting **View > Debug Windows**:
[ ![](Images/breakpoint_01.png)](Images/breakpoint_01.png)
To set a breakpoint, simply click to the left of the line number at the
place in your code that you need to troubleshoot. You will see the breakpoint appear in the <span class="UIItem">Breakpoints</span> window:
place in your code that you need to troubleshoot. You will see the breakpoint appear in the **Breakpoints** window:
[ ![](Images/breakpoint_03.png)](Images/breakpoint_03.png)
@ -52,17 +52,17 @@ To set a conditional
breakpoint, you need to access the breakpoint properties window. There are
several ways to toggle this:
1. Right click on the space to the left of the line number where you want to set the breakpoint, and select <span class="uiitem">New Breakpoint</span> :
1. Right click on the space to the left of the line number where you want to set the breakpoint, and select **New Breakpoint** :
[ ![](Images/breakpoint_05.png)](Images/breakpoint_05.png)
1. For an existing breakpoint, right click on the breakpoint and select <span class="UIItem">Breakpoint Properties</span> :
1. For an existing breakpoint, right click on the breakpoint and select **Breakpoint Properties** :
[ ![](Images/breakpoint_06.png)](Images/breakpoint_06.png)
1. For an existing breakpoint, select the breakpoint in the <span class="UIItem">Breakpoints</span> window, and hit the wrench icon:
1. For an existing breakpoint, select the breakpoint in the **Breakpoints** window, and hit the wrench icon:
[ ![](Images/breakpoint_02.png)](Images/breakpoint_02.png)

Просмотреть файл

@ -5,7 +5,7 @@ subtitle: "How to use Progress<T> in a Xamarin mobile application"
brief: "This recipe will demonstrate how to download a file in the background and report the download progress to the end user."
article:
- title: "Async Support Overview"
url: http://docs.xamarin.com/guides/cross-platform/advanced/async_support_overview/
url: https://developer.xamarin.com/guides/cross-platform/advanced/async_support_overview/
api:
- title: "IProgress<T>"
url: http://msdn.microsoft.com/en-us/library/hh138298(v=vs.110).aspx

Просмотреть файл

@ -21,7 +21,7 @@ A basic annotation consists of a pin marker added to map. When touched, the
pin displays a small popup with more information. To add an annotation to a
MKMapView:
1. Start with an existing MKMapView or review the [Displaying a Location (MapView)](http://docs.xamarin.com/Recipes/ios/content_controls/map_view/display_a_location) recipe.
1. Start with an existing MKMapView or review the [Displaying a Location (MapView)](https://developer.xamarin.com/Recipes/ios/content_controls/map_view/display_a_location) recipe.
<ol start="2">
<li>Create a subclass of MKAnnotation</li>

Просмотреть файл

@ -3,22 +3,21 @@ id: BE09FD47-1AC9-4104-AF8E-DEF3A9F541CE
title: "Create a Custom TableViewCell using a .xib"
---
### Referencing the Custom Cell
# Referencing the Custom Cell
1. Create a new Master Detail Solution and name it **CustomCellDemo**.
<ide name="xs">
<ol start="2">
<li>Open the `Main.Storyboard` file and right-click on the table cell in the <strong>Master View Controller</strong> to delete it:
</br><a href="Images/image6.png"><img src="Images/image6.png"></a></li>
<li>Add a new file by right-clicking on the solution name and selecting <em>Add > New File...</em>. Select the <strong>TableViewCell</strong> template, and name it <strong>Cell</strong>:
</br><a href="Images/image7.png"><img src="Images/image7.png"></a></br>
This will create a .xib file plus a backing class
</li>
<li>Double click on the Cell.xib file to open it in the iOS Designer</li>
<li>In the properties panel, change the background color.</li>
<li>To register the .xib for cell reuse, add the following line of code to the <code>MasterViewController</code> class before you set <code>TableView.Source</code> in the <code>ViewDidLoad()</code> method:
<pre><code>
## Visual Studio for Mac
1. Open the `Main.Storyboard` file and right-click on the table cell in the **Master View Controller** to delete it:
[![](Images/image6.png)](Images/image6.png)
2. Add a new file by right-clicking on the solution name and selecting _Add > New File..._. Select the **TableViewCell** template, and name it **Cell**:
[![](Images/image7.png)](Images/image7.png)
This will create a .xib file plus a backing class
3. Double click on the Cell.xib file to open it in the iOS Designer
4. In the properties panel, change the background color.
5. To register the .xib for cell reuse, add the following line of code to the `MasterViewController` class before you set `TableView.Source` in the `ViewDidLoad()` method:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
@ -28,29 +27,25 @@ title: "Create a Custom TableViewCell using a .xib"
TableView.RegisterNibForCellReuse(Cell.Nib, "Cell");
TableView.Source = dataSource = new DataSource (this);
}
</code></pre>
</li>
<li>Run the application and test it, you should notice that the background color of the cell, matches the background color of the cell in your .xib.</li>
</ol>
</ide>
<ide name="vs">
<ol start="2">
<li>Open the `Main.Storyboard` file and right-click on the table cell in the <strong>Master View Controller</strong> to delete it:
</br><a href="Images/image1.png"><img src="Images/image1.png"></a></li>
<li> Add a new item by right-clicking on the solution name and selecting <em>Add > New Item...</em>. Select the View template and name it <strong>Cell</strong>:
</br><a href="Images/image5.png"><img src="Images/image5.png"></a></br>
This will create a .xib file with <strong>no</strong> backing class
</li>
<li>If the .xib file doesn't open automatically, double-click on the <strong>Cell.xib</strong> file to open it in the Designer.</li>
<li>Delete the View on the design surface and add a <strong>Table View Cell</strong> from the toolbox:
</br><a href="Images/image2.png"><img src="Images/image2.png"></a></li>
<li>We now need to give it a code behind class so that we can access the .xib in code. To do this select the Table View Cell, and in the properties explorer under <em>Identity > Class</em> enter <code>Cell</code>:
</br><a href="Images/image3.png"><img src="Images/image3.png"></a></li>
<li>In the properties panel, change the background color:
</br><a href="Images/image4.png"><img src="Images/image4.png"></a></li>
<li>To register the .xib for cell reuse, add the following line of code to the <code>MasterViewController</code> class before you set <code>TableView.Source</code> in the <code>ViewDidLoad()</code> method:
<pre><code>
6. Run the application and test it, you should notice that the background color of the cell, matches the background color of the cell in your .xib.
## Visual Studio
1. Open the `Main.Storyboard` file and right-click on the table cell in the **Master View Controller** to delete it:
[![](Images/image1.png)](Images/image1.png)
2. Add a new item by right-clicking on the solution name and selecting _Add > New Item..._. Select the View template and name it **Cell**:
[![](Images/image5.png)](Images/image5.png)
This will create a .xib file with **no** backing class
3. If the .xib file doesn't open automatically, double-click on the **Cell.xib** file to open it in the Designer.
4. Delete the View on the design surface and add a **Table View Cell** from the toolbox:
[![](Images/image2.png)](Images/image2.png)
5. We now need to give it a code behind class so that we can access the .xib in code. To do this select the Table View Cell, and in the properties explorer under _Identity > Class_ enter `Cell`:
[![](Images/image3.png)](Images/image3.png)
6. In the properties panel, change the background color:
[![](Images/image4.png)](Images/image4.png)
7. To register the .xib for cell reuse, add the following line of code to the `MasterViewController` class before you set `TableView.Source` in the `ViewDidLoad()` method:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
@ -60,11 +55,8 @@ title: "Create a Custom TableViewCell using a .xib"
TableView.RegisterNibForCellReuse(UINib.FromName("Cell", null), "Cell”);
TableView.Source = dataSource = new DataSource (this);
}
</code></pre>
</li>
<li>Run the application and test it, you should notice that the background color of the cell, matches the background color of the cell in your .xib.</li>
</ol>
</ide>
8. Run the application and test it, you should notice that the background color of the cell, matches the background color of the cell in your .xib.

Просмотреть файл

@ -7,29 +7,21 @@ article:
url: https://developer.xamarin.com/guides/ios/getting_started/hello,_world
---
<a name="Recipe" class="injected"></a>
# Recipe
<ide name="xs">
<h2>Create an iOS Project in Visual Studio for Mac</h2>
<ol>
<li>First, launch Visual Studio for Mac and click <span class="UIItem">+ New Solution...</span> in the upper left corner: <img src="Images/ios_project_00.png" /></li>
<li>A window will pop up asking you to choose a template for the project. Select <span class="UIItem">App</span> under <span class="UIItem">iOS</span> in the panel on the left. Then select the desired app type from the list of options and click <span class="UIItem">Next</span>. If you are new to Xamarin.iOS and don't know which to choose, select <span class="UIItem">Single View Application</span>. <img src="Images/choose_template.png" /></li>
<li>The window will move to the <span class="UIItem">Configure your iOS app</span> screen. Enter the name of your app, select the devices you'd like to support and choose a minimum target OS. <img src="Images/choose_device.png" /></li>
<li>The window will move to the <span class="UIItem">Configure your new project</span> screen. Choose the name of the project (avoiding spaces and special characters) and the location on disk to store the project, then click <span class="UIItem">Create</span><img src="Images/choose_name.png" /></li>
<li>Visual Studio for Mac will create your new iOS app. <img src="Images/xam_result.png" /></li>
</ol>
</ide>
<ide name="vs">
<h2>Create an iOS Project in Visual Studio</h2>
<ol>
<li><a href="https://developer.xamarin.com/guides/ios/getting_started/introduction_to_xamarin_ios_for_visual_studio">Make sure Xamarin.iOS for Visual Studio is configured correctly</a>. Launch Visual Studio and choose <span class="UIItem">File > New > Project</span>: <im src="Images/ios_project_00_vs.png" /></li>
<li>A window will pop up with a list of options for the types of projects available to you. To create an iOS project, choose the <span class="UIItem">Templates</span> and then the <span class="UIItem">Visual C#</span> category to open up the available sub-categories, then select <span class="UIItem">iOS</span>:<img src="Images/ios_project_01_vs.png" /></li>
<li>Choose your device from the menu on the left. If you are new to Xamarin.iOS and unsure about what template to use, select <span class="UIItem">Single View Application</span> from the panel on the right. This will create an application with one view and one View Controller.</li>
<li>Choose a sensible name for your project, avoiding spaces and special characters, and click <span class="UIItem">OK</span>.
<li>Visual Studio will create and populate a new project for you:<img src="Images/ios_project_02_vs.png"</li>
</ol>
</ide>
## Create an iOS Project in Visual Studio for Mac
1. First, launch Visual Studio for Mac and click **+ New Solution...** in the upper left corner: ![](Images/ios_project_00.png)
2. A window will pop up asking you to choose a template for the project. Select **App** under **iOS** in the panel on the left. Then select the desired app type from the list of options and click **Next**. If you are new to Xamarin.iOS and don't know which to choose, select **Single View Application**. ![](Images/choose_template.png)
3. The window will move to the **Configure your iOS app** screen. Enter the name of your app, select the devices you'd like to support and choose a minimum target OS. ![](Images/choose_device.png)
4. The window will move to the **Configure your new project** screen. Choose the name of the project (avoiding spaces and special characters) and the location on disk to store the project, then click **Create**![](Images/choose_name.png)
5. Visual Studio for Mac will create your new iOS app. ![](Images/xam_result.png)
## Create an iOS Project in Visual Studio
1. [Make sure Xamarin.iOS for Visual Studio is configured correctly](https://developer.xamarin.com/guides/ios/getting_started/introduction_to_xamarin_ios_for_visual_studio). Launch Visual Studio and choose **File > New > Project**:
2. A window will pop up with a list of options for the types of projects available to you. To create an iOS project, choose the **Templates** and then the **Visual C#** category to open up the available sub-categories, then select **iOS**:![](Images/ios_project_01_vs.png)
3. Choose your device from the menu on the left. If you are new to Xamarin.iOS and unsure about what template to use, select **Single View Application** from the panel on the right. This will create an application with one view and one View Controller.
4. Choose a sensible name for your project, avoiding spaces and special characters, and click **OK**.
5. Visual Studio will create and populate a new project for you:![](Images/ios_project_02_vs.png)

Просмотреть файл

@ -4,24 +4,22 @@ title: "Specify Default Root Namespace"
brief: "This recipe shows where to set the default namespace for a project."
---
<a name="Recipe" class="injected"></a>
# Recipe
<ide name="xs">
<h2>Set Default Namespace in Visual Studio for Mac</h2>
<ol>
<li>Double click on the project in the <span class="UIItem">Solution Pad</span>, or right-click on the project and select <span class="UIItem">Options</span>: <br /> <img src="Images/DefaultNamespace1.png" /></li>
<li>Choose <span class="uiitem">Main Settings</span> to view the <span class="uiitem">Default Namespace</span> field:<img src="Images/DefaultNamespace2.png" /></li>
<li>This value will be automatically set as the root namespace in each new code file you create in your project, including the <code>.designer.cs</code> partial classes created when you add a XIB or Storyboard file.</li>
</ol>
</ide>
<ide name="vs">
<h2>Set Default Namespace in Visual Studio</h2>
<ol>
<li>Open the project <span class="uiitem">Properties</span>, and then choose the <span class="uiitem">Application</span> panel: <img src="Images/DefaultNamespace3.png" /></li>
</ol>
</ide>
## Set Default Namespace in Visual Studio for Mac
1. Double click on the project in the **Solution Pad**, or right-click on the project and select **Options**:
![](Images/DefaultNamespace1.png)
2. Choose **Main Settings** to view the **Default Namespace** field:![](Images/DefaultNamespace2.png)
3. This value will be automatically set as the root namespace in each new code file you create in your project, including the `.designer.cs` partial classes created when you add a XIB or Storyboard file.
## Set Default Namespace in Visual Studio
1. Open the project **Properties**, and then choose the **Application** panel: ![](Images/DefaultNamespace3.png)
## Additional Information
If you edit the default namespace value in an existing project,

Просмотреть файл

@ -23,7 +23,7 @@ It is possible to use a Storyboard to create custom Table Views. This recipe dem
To create a Storyboard-based application using a TableView:
Create a new solution in Visual Studio for Mac using <span class="UIItem">File > Solution > iOS > iPhone Storyboard > Master-Detail Application</span>.
Create a new solution in Visual Studio for Mac using **File > Solution > iOS > iPhone Storyboard > Master-Detail Application**.
[ ![Create Project](Images/image14a.png "")](Images/image14a.png)
@ -59,7 +59,7 @@ Let's follow these steps to delete the existing Detail view and replace it with
- Create a segue from the Master View Controller to the View Controller that was just added. To create the segue, Control+drag from the Detail cell to the newly added UITableViewController. Choose the option Push under Segue Selection
- Select the new segue you created and give it an identifier to reference this segue in code. Click on the segue and enter “TaskSegue” for the Identifier in the <span class="UIItem">Properties Pad</span> , like this:
- Select the new segue you created and give it an identifier to reference this segue in code. Click on the segue and enter “TaskSegue” for the Identifier in the **Properties Pad** , like this:
@ -125,11 +125,11 @@ To build the complete layout, first select the table view and open the Property
Now, select the top section of the DetailView and under <span class="UIItem">Properties > Table View Section</span> change rows to '3', as illustrated below:
Now, select the top section of the DetailView and under **Properties > Table View Section** change rows to '3', as illustrated below:
[ ![](Images/image29.png)](Images/image29.png)
For each cell in Section 1 open the <span class="UIItem">Properties Pad</span> and set:
For each cell in Section 1 open the **Properties Pad** and set:
- Style: *Custom*
@ -145,7 +145,7 @@ For each cell in Section 1 open the <span class="UIItem">Properties Pad</span> a
In the second section, set the number of Rows to 1 and grab the bottom resize handle to make it taller. Select the cell in the <span class="UIItem">Properties pad</span> and set:
In the second section, set the number of Rows to 1 and grab the bottom resize handle to make it taller. Select the cell in the **Properties pad** and set:
- Identifier: *to a unique value in the Property Pad(eg. “save”)* .
@ -158,7 +158,7 @@ In the second section, set the number of Rows to 1 and grab the bottom resize ha
The last step in creating our Storyboard is giving each of our controls a name under <span class="UIItem">Identity > Name</span>. Name these as follows:
The last step in creating our Storyboard is giving each of our controls a name under **Identity > Name**. Name these as follows:
- Title UITextField: TitleText

Просмотреть файл

@ -26,7 +26,7 @@ An unwind Segue can be used to navigate back through a push or modal segue - for
To create an unwind Segue in the Xamarin Designer for iOS:
- Create a new <span class="UIItem">iOS > Single View Application</span> with Visual Studio for Mac or Visual Studio:
- Create a new **iOS > Single View Application** with Visual Studio for Mac or Visual Studio:
[ ![](Images/unwindSegue2.png)](Images/unwindSegue2.png)
@ -46,12 +46,12 @@ To create an unwind Segue in the Xamarin Designer for iOS:
[ ![](Images/AddVC.png)](Images/AddVC.png)
- Select each UIView and change the background colour using the <span class="UIItem">Properties Pad</span> , as shown in the screenshot below.
- Select each UIView and change the background colour using the **Properties Pad** , as shown in the screenshot below.
[ ![](Images/BackgroundColour.png)](Images/BackgroundColour.png)
- Select each UIViewController and change the <span class="UIItem">Identity > Class</span> in the <span class="UIItem">Properties Pad</span> to reflect the background color. - Yellow Background: YellowViewController
- Select each UIViewController and change the **Identity > Class** in the **Properties Pad** to reflect the background color. - Yellow Background: YellowViewController
- Magenta Background: PinkViewController
- Green Background: GreenViewController
@ -61,9 +61,9 @@ To create an unwind Segue in the Xamarin Designer for iOS:
[ ![](Images/NameViewControllers.png)](Images/NameViewControllers.png)
- To finish creating the UI use the <span class="UIItem">Toolbox</span> and add <span class="UIItem">Buttons</span> to your View as follows. - YellowViewController : 1 <span class="UIItem">Button</span> with title "Go To Pink"
- PinkViewController: 2 <span class="UIItem">Buttons</span> , one with title "Go To Green", the other "Unwind to Yellow"
- GreenViewController: 2 <span class="UIItem">Buttons</span> , one with title "Unwind to Pink", the other "Unwind to Yellow"
- To finish creating the UI use the **Toolbox** and add **Buttons** to your View as follows. - YellowViewController : 1 **Button** with title "Go To Pink"
- PinkViewController: 2 **Buttons** , one with title "Go To Green", the other "Unwind to Yellow"
- GreenViewController: 2 **Buttons** , one with title "Unwind to Pink", the other "Unwind to Yellow"
@ -118,7 +118,7 @@ public void UnwindToPinkViewController (UIStoryboardSegue segue)
}
```
- <span class="UIItem">Save All</span> and return to the MainStoryboard.storyboard, where the unwind segue will be added.
- **Save All** and return to the MainStoryboard.storyboard, where the unwind segue will be added.
- Create another Segue, this time from the 'Unwind to Yellow' Button in the PinkViewController to the Scene Exit

Просмотреть файл

@ -12,16 +12,12 @@ xamu:
# Recipe
First, create a new solution named `TestApp` using the <span class="UIItem">Single View Application</span> template, and add a new file to it called `SomeView` using the <span class="UIItem">View</span> file template,
First, create a new solution named `TestApp` using the **Single View Application** template, and add a new file to it called `SomeView` using the **View** file template,
as shown below:
<ide name="xs">
<a href="Images/image01.png"><img src="Images/image01.png"></a>
</ide>
[![](Images/image01.png)](Images/image01.png)
<ide name="vs">
<a href="Images/xib2.png"><img src="Images/xib2.png"></a>
</ide>
[![](Images/xib2.png)](Images/xib2.png)
This creates a new file called `SomeView.xib`.
@ -29,13 +25,10 @@ Double-click `SomeView.xib` to open it in the Xamarin Designer for iOS.
At this point controls can be added to the .xib. As an example, search the toolbox for **label** drag a `UILabel` onto the design surface as shown below:
<ide name="xs">
<a href="Images/image02.png"><img src="Images/image02.png"></a>
</ide>
[![](Images/image02.png)](Images/image02.png)
[![](Images/xib3.png)](Images/xib3.png)
<ide name="vs">
<a href="Images/xib3.png"><img src="Images/xib3.png"></a>
</ide>
However, since the .xib has not been connected to any backing class, we cannot
yet manage properties nor handle events on the controls in the view. For example buttons should have behaviour that responds to the user's touch, and labels may need to be updated based on user input. To interact with the .xib programmatically we need to have two files:
@ -45,23 +38,18 @@ yet manage properties nor handle events on the controls in the view. For example
To connect these C# files to our .xib file, select the root view on the [design surface](https://developer.xamarin.com/guides/ios/user_interface/designer/introduction/#iOS_Designer_features), and under *Widget > Identity* set the **Class** to `SomeView` and press **Enter**:
<ide name="xs">
<a href="Images/image03.png"><img src="Images/image03.png"></a>
</ide>
[![](Images/image03.png)](Images/image03.png)
[![](Images/xib4.png)](Images/xib4.png)
<ide name="vs">
<a href="Images/xib4.png"><img src="Images/xib4.png"></a>
</ide>
This will create the two classes – `SomeView.cs` and `SomeView.designer.cs` – in our solution :
<ide name="xs">
<a href="Images/image04.png"><img src="Images/image04.png"></a>
</ide>
<ide name="vs">
<a href="Images/xib5.png"><img src="Images/xib5.png"></a>
</ide>
[![](Images/image04.png)](Images/image04.png)
[![](Images/xib5.png)](Images/xib5.png)
The result will be a reusable view that can be included in any view hierarchy as with any other view.
@ -69,13 +57,9 @@ This differs from the ViewController template, whose Storyboard file comes alrea
We can now manage the properties of the controls in the view, such as the label we added earlier. To interact with our UILabel control using code, we must give it a unique identifier so that it can be accessed in the C# backing code for the view. To do this select the label on the designer surface, and under *Widget > Identity > Name* in the **Properties Pad** enter `MyLabel`:
<ide name="xs">
<a href="Images/image05.png"><img src="Images/image05.png"></a>
</ide>
[![](Images/image05.png)](Images/image05.png)
<ide name="vs">
<a href="Images/xib6.png"><img src="Images/xib6.png"></a>
</ide>
[![](Images/xib6.png)](Images/xib6.png)
If we open **SomeView.designer.cs**, we can see that the label has been defined:
@ -168,8 +152,6 @@ displayed:
[ ![](Images/image06.png)](Images/image06.png)
<a name="Summary" class="injected"></a>
# Summary

Просмотреть файл

@ -23,7 +23,7 @@ if (application.BackgroundRefreshStatus == UIBackgroundRefreshStatus.Available)
</ol>
![]("Images/bg_start.png")
<ol start="3">
<li>Let's see what happens when we change the refresh setting. While the app is running in the background, navigate to <span class="uiitem">Settings > General > Background App Refresh</span> on the device:</li>
<li>Let's see what happens when we change the refresh setting. While the app is running in the background, navigate to **Settings > General > Background App Refresh** on the device:</li>
</ol>
![]("Images/3_.png")
<ol start="4">

Просмотреть файл

@ -32,7 +32,7 @@ var LocMgr = new CLLocationManager();
LocMgr.requestWhenInUseAuthorization(); //to access user's location when the app is in use.
```
<ol start="4">
<li>In addition to explicitly requesting access to the user's location, you must add two keys to the <strong>Info.plist</strong> file, by opening <strong>Info.plist</strong> and selecting <span class="UIItem">Source</span>. </li>
<li>In addition to explicitly requesting access to the user's location, you must add two keys to the <strong>Info.plist</strong> file, by opening <strong>Info.plist</strong> and selecting **Source**. </li>
</ol>
* **NSLocationWhenInUseUsageDescription** - A description of why your app wants to access the user's location in the foreground.
* **NSLocationAlwaysInUsageDescription** - A description of why your app wants to access the user's location in the background.

Просмотреть файл

@ -6,17 +6,17 @@ brief: "Some location APIs such as Significant Location Change and Geofences req
# Recipe
1. Launch the iOS Simulator. Then, open the iOS Simulator's <span class="UIItem">Debug</span> menu and select <span class="UIItem">Location > Freeway Drive</span> . This will simulate a coastal drive up California's highway 280:
1. Launch the iOS Simulator. Then, open the iOS Simulator's **Debug** menu and select **Location > Freeway Drive** . This will simulate a coastal drive up California's highway 280:
[ ![](Images/00.png)](Images/00.png)
2. Deploy the application to the simulator. The simulator will begin feeding sample data to the application, which should respond appropriately. For example, running the [Track Significant Location Change](http://docs.xamarin.com/recipes/ios/multitasking/track_significant_location_change/) code in the simulator produces the following application log:
2. Deploy the application to the simulator. The simulator will begin feeding sample data to the application, which should respond appropriately. For example, running the [Track Significant Location Change](https://developer.xamarin.com/recipes/ios/multitasking/track_significant_location_change/) code in the simulator produces the following application log:
[ ![](Images/02.png)](Images/02.png)
3. If your application requires a custom location to test, choose the <span class="UIItem">Location > Custom Location...</span> option from the <span class="UIItem">Debug</span> menu, and specify your own latitude and longitude to test:
3. If your application requires a custom location to test, choose the **Location > Custom Location...** option from the **Debug** menu, and specify your own latitude and longitude to test:
[ ![](Images/03.png)](Images/03.png) [ ![](Images/04.png)](Images/04.png)

Просмотреть файл

@ -29,7 +29,7 @@ var LocMgr = new CLLocationManager();
LocMgr.requestWhenInUseAuthorization(); //to access user's location when the app is in use.
```
<ol start="4">
<li>In addition to explicitly requesting access to the user's location, you must add two keys to the <strong>Info.plist</strong> file, by opening <strong>Info.plist</strong> and selecting <span class="UIItem">Source</span>. </li>
<li>In addition to explicitly requesting access to the user's location, you must add two keys to the <strong>Info.plist</strong> file, by opening <strong>Info.plist</strong> and selecting **Source**. </li>
</ol>
* **NSLocationWhenInUseUsageDescription** - A description of why your app wants to access the user's location in the foreground.
* **NSLocationAlwaysInUsageDescription** - A description of why your app wants to access the user's location in the background.

Просмотреть файл

@ -19,7 +19,7 @@ the user has entered text, or via a button press.
## Via EditingDidEnd
The `EditingDidEnd` event is raised when a user moves focus from a control,
either from selecting the next control, or from clicking the <span class="UIItem">Done</span>
either from selecting the next control, or from clicking the **Done**
button. The border properties on the text field can be accessed via the underlying `Layer` object:
```

Просмотреть файл

@ -5,7 +5,7 @@ subtitle: "How to remove the lines between rows in a Xamarin.Forms table view"
brief: "This recipe shows how to build a custom renderer for the TableView to hide the lines between each cell on iOS and Android."
article:
- title: "Customizing Controls for Each Platform"
url: http://docs.xamarin.com/guides/xamarin-forms/custom-renderer
url: https://developer.xamarin.com/guides/xamarin-forms/custom-renderer
api:
- title: "ListView"
url: http://developer.xamarin.com/api/type/Xamarin.Forms.ListView/

Просмотреть файл

@ -5,7 +5,7 @@ subtitle: "How to dismiss the keyboard on iOS"
brief: "This recipe shows how to build a custom renderer for an Entry that includes a 'Done' button to dismiss the keyboard"
article:
- title: "Customizing Controls for Each Platform"
url: http://docs.xamarin.com/guides/xamarin-forms/custom-renderer
url: https://developer.xamarin.com/guides/xamarin-forms/custom-renderer
api:
- title: "Entry"
url: https://developer.xamarin.com/api/type/Xamarin.Forms.Entry/
@ -14,7 +14,7 @@ dateupdated: 2015-12-09
# Overview
To dismiss a keyboard in Xamarin.Forms the user can normally just tap outside the input control, however this is unintuitive and may be difficult when using a `ListView` or `TableView` to host the input. A [custom-renderer](http://docs.xamarin.com/guides/xamarin-forms/custom-renderer) can be written for iOS that adds a toolbar and **Done** button to programmatically dismiss the keyboard.
To dismiss a keyboard in Xamarin.Forms the user can normally just tap outside the input control, however this is unintuitive and may be difficult when using a `ListView` or `TableView` to host the input. A [custom-renderer](https://developer.xamarin.com/guides/xamarin-forms/custom-renderer) can be written for iOS that adds a toolbar and **Done** button to programmatically dismiss the keyboard.
Any iOS keyboard type can have a toolbar added; this example shows the numeric keypad.