Merge pull request #2079 from NativeScript/pete/docs-update

Update docomentation
This commit is contained in:
Vladimir Enchev
2016-05-09 11:34:31 +03:00
12 changed files with 76 additions and 72 deletions

View File

@ -336,12 +336,13 @@ export var testFileNameExtension = function () {
export var testFileExists = function () { export var testFileExists = function () {
// >> file-system-fileexists // >> file-system-fileexists
var documents = fs.knownFolders.documents(); var documents = fs.knownFolders.documents();
var file = documents.getFile("Test.txt"); var filePath = fs.path.join(documents.path, "Test.txt");
var exists = fs.File.exists(file.path); var exists = fs.File.exists(filePath);
// >> (hide) // >> (hide)
TKUnit.assert(exists, "File.exists API not working.");
exists = fs.File.exists(file.path + "_");
TKUnit.assert(!exists, "File.exists API not working."); TKUnit.assert(!exists, "File.exists API not working.");
var file = documents.getFile("Test.txt");
exists = fs.File.exists(file.path);
TKUnit.assert(exists, "File.exists API not working.");
file.remove(); file.remove();
// << (hide) // << (hide)
// << file-system-fileexists // << file-system-fileexists

View File

@ -54,7 +54,7 @@ The icon can only be set in Android platform. It is hidden by default, but you e
</Page> </Page>
``` ```
The position option is platform specific. The available values are as follows: The position option is platform-specific. The available values are as follows:
* **Android** - `actionBar`, `actionBarIfRoom` and `popup`. The default is `actionBar`. * **Android** - `actionBar`, `actionBarIfRoom` and `popup`. The default is `actionBar`.
* **iOS** - `left` and `right`. The default is `left`. * **iOS** - `left` and `right`. The default is `left`.
@ -78,32 +78,31 @@ The position option is platform specific. The available values are as follows:
Set `ios.systemIcon` to a number representing the iOS system item to be displayed. Set `ios.systemIcon` to a number representing the iOS system item to be displayed.
Use this property instead of `ActionItem.icon` if you want to diplsay a built-in iOS system icon. Use this property instead of `ActionItem.icon` if you want to diplsay a built-in iOS system icon.
Note: systemIcon is not supported on NavigationButton in iOS Note: systemIcon is not supported on NavigationButton in iOS
The value should be a number from the `UIBarButtonSystemItem` enumeration The value should be a number from the [UIBarButtonSystemItem](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIBarButtonItem_Class/#//apple_ref/c/tdef/UIBarButtonSystemItem) enumeration:
(https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIBarButtonItem_Class/#//apple_ref/c/tdef/UIBarButtonSystemItem) 0: `Done`
0: Done 1: `Cancel`
1: Cancel 2: `Edit`
2: Edit 3: `Save`
3: Save 4: `Add`
4: Add 5: `FlexibleSpace`
5: FlexibleSpace 6: `FixedSpace`
6: FixedSpace 7: `Compose`
7: Compose 8: `Reply`
8: Reply 9: `Action`
9: Action 10: `Organize`
10: Organize 11: `Bookmarks`
11: Bookmarks 12: `Search`
12: Search 13: `Refresh`
13: Refresh 14: `Stop`
14: Stop 15: `Camera`
15: Camera 16: `Trash`
16: Trash 17: `Play`
17: Play 18: `Pause`
18: Pause 19: `Rewind`
19: Rewind 20: `FastForward`
20: FastForward 21: `Undo`
21: Undo 22: `Redo`
22: Redo 23: `PageCurl`
23: PageCurl
### Android ### Android
Set `android.systemIcon` the name of the system drawable resource to be displayed. Set `android.systemIcon` the name of the system drawable resource to be displayed.

View File

@ -5,7 +5,7 @@ description: "Examples for using Border"
previous_url: /ApiReference/ui/border/HOW-TO previous_url: /ApiReference/ui/border/HOW-TO
--- ---
# Border # Border
Using borders requires the "ui/border" module. Using borders requires the Border module.
<snippet id='border-require'/> <snippet id='border-require'/>
### Declaring a Border. ### Declaring a Border.

View File

@ -23,17 +23,17 @@ Binding the image source property to a view-model property.
</StackLayout> </StackLayout>
</Page> </Page>
``` ```
### How to create an image and set its source. ### Creating an image and setting its source
<snippet id='img-create'/> <snippet id='img-create'/>
### How to create an image and set its src. ### Creating an image and setting its src
<snippet id='img-create-src'/> <snippet id='img-create-src'/>
### How to create an image and set its src to file within the application. ### Creating an image and setting its src to a file within the application
<snippet id='img-create-local'/> <snippet id='img-create-local'/>
### How to create an image and set its src to Data URI. ### Creating an image and setting its src to Data URI
<snippet id='img-create-datauri'/> <snippet id='img-create-datauri'/>
### How to set image stretching. ### Setting image stretching
<snippet id='img-set-stretch'/> <snippet id='img-set-stretch'/>

View File

@ -14,20 +14,20 @@ Using a label requires the Label module.
{%raw%}<Label text="{{ title }}" />{%endraw%} {%raw%}<Label text="{{ title }}" />{%endraw%}
</Page> </Page>
``` ```
### How to set label text content ### Setting the label text content
<snippet id='label-settext'/> <snippet id='label-settext'/>
### How to turn on text wrapping for a label ### Turning on text wrapping for a label
<snippet id='label-textwrap'/> <snippet id='label-textwrap'/>
### How to style a label via css class ### Styling a label via css class
<snippet id='label-cssclass'/> <snippet id='label-cssclass'/>
### How to style a label via css type ### Styling a label via css type
<snippet id='label-cssclass-type'/> <snippet id='label-cssclass-type'/>
### How to style a label via css control identifier ### Styling a label via css control identifier
<snippet id='label-css-identifier'/> <snippet id='label-css-identifier'/>
### How to bind text property of a label to an observable model ### Binding text property of a label to an observable model
<snippet id='label-observable'/> <snippet id='label-observable'/>

View File

@ -1,13 +1,14 @@
--- ---
nav-title: "absolute-layout How-To" nav-title: "absolute-layout How-To"
title: "absolute-layoyt" title: "absolute-layout"
description: "Examples for using absolute-layout" description: "Examples for using absolute-layout"
previous_url: /ApiReference/ui/layouts/absolute-layout/HOW-TO previous_url: /ApiReference/ui/layouts/absolute-layout/HOW-TO
--- ---
# AbsoluteLayout # AbsoluteLayout
Using a AbsoluteLayout requires the AbsoluteLayout module. Using an AbsoluteLayout requires the AbsoluteLayout module.
<snippet id='absolute-layout-require'/> <snippet id='absolute-layout-require'/>
### Declaring an AbsoluteLayout
``` XML ``` XML
<Page> <Page>
<AbsoluteLayout> <AbsoluteLayout>

View File

@ -8,7 +8,7 @@ previous_url: /ApiReference/ui/layouts/dock-layout/HOW-TO
Using a DockLayout requires the DockLayout module. Using a DockLayout requires the DockLayout module.
<snippet id='dock-layout-require'/> <snippet id='dock-layout-require'/>
### Declaring a DockLayout. ### Declaring a DockLayout
``` XML ``` XML
<Page> <Page>
<DockLayout stretchLastChild="true"> <DockLayout stretchLastChild="true">

View File

@ -4,11 +4,11 @@ title: "grid-layout"
description: "Examples for using grid-layout" description: "Examples for using grid-layout"
previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO
--- ---
## GridLayout sample # GridLayout
### Creating Grid Layout via code. Using a GridLayout requires the GridLayout module.
<snippet id='grid-layout-require'/> <snippet id='grid-layout-require'/>
### Create grid layout with an xml declaration ### Declaring a GridLayout
``` XML ``` XML
<GridLayout columns="80, *, auto" rows="auto, *" > <GridLayout columns="80, *, auto" rows="auto, *" >
<Button col="0" /> <Button col="0" />
@ -19,20 +19,20 @@ previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO
</GridLayout> </GridLayout>
``` ```
### Add views to grid layout ## Add views to grid layout
<snippet id='grid-layout-addviews'/> <snippet id='grid-layout-addviews'/>
### Set column property on views - btn1 in first column, btn2 is second and btn3 in third ## Set column property on views - btn1 in first column, btn2 is second and btn3 in third
<snippet id='grid-layout-setcolumn'/> <snippet id='grid-layout-setcolumn'/>
### Set row property on btn4. ## Set row property on btn4.
<snippet id='grid-layout-setrow'/> <snippet id='grid-layout-setrow'/>
### Set columnSpan property on btn4 to stretch into all columns ## Set columnSpan property on btn4 to stretch into all columns
<snippet id='grid-layout-columnspan'/> <snippet id='grid-layout-columnspan'/>
### Create ItemSpec for columns and rows 3 columns - 80px, *, auto size and 2 rows - 100px and auto size ## Create ItemSpec for columns and rows 3 columns - 80px, *, auto size and 2 rows - 100px and auto size
<snippet id='grid-layout-itemspec'/> <snippet id='grid-layout-itemspec'/>
### Add columns and rows to GridLayout ## Add columns and rows to GridLayout
<snippet id='grid-layout-add-rowscols'/> <snippet id='grid-layout-add-rowscols'/>

View File

@ -161,9 +161,11 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
} }
public test_codesnippets() { public test_codesnippets() {
// >> stack-layout-require
// var StackLayout = require("ui/layouts/stack-layout").StackLayout;
// << stack-layout-require
// >> stack-layout-new // >> stack-layout-new
// var StackLayout = require("ui/layouts/stack-layout").StackLayout;
// >> (hide) // >> (hide)
// var Button = require("ui/button").Button; // var Button = require("ui/button").Button;
// << (hide) // << (hide)

View File

@ -4,12 +4,10 @@ title: "stack-layout"
description: "Examples for using stack-layout" description: "Examples for using stack-layout"
previous_url: /ApiReference/ui/layouts/stack-layout/HOW-TO previous_url: /ApiReference/ui/layouts/stack-layout/HOW-TO
--- ---
### import StackLayout and Button classes # StackLayout
var StackLayout = require("ui/layouts/stack-layout").StackLayout; Using a StackLayout requires the StackLayout module.
var Button = require("ui/button").Button; <snippet id='stack-layout-require'/>
### Create StackLayout
<snippet id='stack-layout-new'/>
### Declaring a StackLayout. ### Declaring a StackLayout.
``` XML ``` XML
<Page> <Page>
@ -19,12 +17,15 @@ var Button = require("ui/button").Button;
</Page> </Page>
``` ```
### Add child view to layout ## Create StackLayout
<snippet id='stack-layout-new'/>
## Add child view to layout
<snippet id='stack-layout-addchild'/> <snippet id='stack-layout-addchild'/>
### Remove child view from layout ## Remove child view from layout
<snippet id='stack-layout-remove'/> <snippet id='stack-layout-remove'/>
### Change layout orientation to Horizontal ## Change layout orientation to Horizontal
<snippet id='stack-layout-horizontal'/> <snippet id='stack-layout-horizontal'/>

View File

@ -8,12 +8,6 @@ previous_url: /ApiReference/ui/layouts/wrap-layout/HOW-TO
Using a WrapLayout requires the WrapLayout module. Using a WrapLayout requires the WrapLayout module.
<snippet id='wrap-layout-require'/> <snippet id='wrap-layout-require'/>
Other frequently used modules when working with a WrapLayout include:
<snippet id='wrap-layout-others'/>
## Creating a WrapLayout
<snippet id='wrap-layout-new'/>
### Declaring a WrapLayout. ### Declaring a WrapLayout.
``` XML ``` XML
<Page> <Page>
@ -26,5 +20,11 @@ Other frequently used modules when working with a WrapLayout include:
</Page> </Page>
``` ```
Other frequently used modules when working with a WrapLayout include:
<snippet id='wrap-layout-others'/>
## Creating a WrapLayout
<snippet id='wrap-layout-new'/>
## Setting the orientation of a wrap-layout. ## Setting the orientation of a wrap-layout.
<snippet id='wrap-layout-orientation'/> <snippet id='wrap-layout-orientation'/>

View File

@ -7,7 +7,7 @@ previous_url: /ApiReference/ui/scroll-view/HOW-TO
# ScrollView # ScrollView
Using a ScrollView requires the ScrollView module. Using a ScrollView requires the ScrollView module.
<snippet id='article-require-scrollview-module'/> <snippet id='article-require-scrollview-module'/>
### Declaring the ScrollView. ### Declaring the ScrollView
``` XML ``` XML
<Page> <Page>
<ScrollView> <ScrollView>