mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Merge pull request #2079 from NativeScript/pete/docs-update
Update docomentation
This commit is contained in:
@ -336,12 +336,13 @@ export var testFileNameExtension = function () {
|
||||
export var testFileExists = function () {
|
||||
// >> file-system-fileexists
|
||||
var documents = fs.knownFolders.documents();
|
||||
var file = documents.getFile("Test.txt");
|
||||
var exists = fs.File.exists(file.path);
|
||||
var filePath = fs.path.join(documents.path, "Test.txt");
|
||||
var exists = fs.File.exists(filePath);
|
||||
// >> (hide)
|
||||
TKUnit.assert(exists, "File.exists API not working.");
|
||||
exists = fs.File.exists(file.path + "_");
|
||||
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();
|
||||
// << (hide)
|
||||
// << file-system-fileexists
|
||||
|
@ -54,7 +54,7 @@ The icon can only be set in Android platform. It is hidden by default, but you e
|
||||
</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`.
|
||||
* **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.
|
||||
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
|
||||
The value should be a number from the `UIBarButtonSystemItem` enumeration
|
||||
(https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIBarButtonItem_Class/#//apple_ref/c/tdef/UIBarButtonSystemItem)
|
||||
0: Done
|
||||
1: Cancel
|
||||
2: Edit
|
||||
3: Save
|
||||
4: Add
|
||||
5: FlexibleSpace
|
||||
6: FixedSpace
|
||||
7: Compose
|
||||
8: Reply
|
||||
9: Action
|
||||
10: Organize
|
||||
11: Bookmarks
|
||||
12: Search
|
||||
13: Refresh
|
||||
14: Stop
|
||||
15: Camera
|
||||
16: Trash
|
||||
17: Play
|
||||
18: Pause
|
||||
19: Rewind
|
||||
20: FastForward
|
||||
21: Undo
|
||||
22: Redo
|
||||
23: PageCurl
|
||||
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:
|
||||
0: `Done`
|
||||
1: `Cancel`
|
||||
2: `Edit`
|
||||
3: `Save`
|
||||
4: `Add`
|
||||
5: `FlexibleSpace`
|
||||
6: `FixedSpace`
|
||||
7: `Compose`
|
||||
8: `Reply`
|
||||
9: `Action`
|
||||
10: `Organize`
|
||||
11: `Bookmarks`
|
||||
12: `Search`
|
||||
13: `Refresh`
|
||||
14: `Stop`
|
||||
15: `Camera`
|
||||
16: `Trash`
|
||||
17: `Play`
|
||||
18: `Pause`
|
||||
19: `Rewind`
|
||||
20: `FastForward`
|
||||
21: `Undo`
|
||||
22: `Redo`
|
||||
23: `PageCurl`
|
||||
|
||||
### Android
|
||||
Set `android.systemIcon` the name of the system drawable resource to be displayed.
|
||||
|
@ -5,7 +5,7 @@ description: "Examples for using Border"
|
||||
previous_url: /ApiReference/ui/border/HOW-TO
|
||||
---
|
||||
# Border
|
||||
Using borders requires the "ui/border" module.
|
||||
Using borders requires the Border module.
|
||||
<snippet id='border-require'/>
|
||||
|
||||
### Declaring a Border.
|
||||
|
@ -23,17 +23,17 @@ Binding the image source property to a view-model property.
|
||||
</StackLayout>
|
||||
</Page>
|
||||
```
|
||||
### How to create an image and set its source.
|
||||
### Creating an image and setting its source
|
||||
<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'/>
|
||||
|
||||
### 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'/>
|
||||
|
||||
### 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'/>
|
||||
|
||||
### How to set image stretching.
|
||||
### Setting image stretching
|
||||
<snippet id='img-set-stretch'/>
|
||||
|
@ -14,20 +14,20 @@ Using a label requires the Label module.
|
||||
{%raw%}<Label text="{{ title }}" />{%endraw%}
|
||||
</Page>
|
||||
```
|
||||
### How to set label text content
|
||||
### Setting the label text content
|
||||
<snippet id='label-settext'/>
|
||||
|
||||
### How to turn on text wrapping for a label
|
||||
### Turning on text wrapping for a label
|
||||
<snippet id='label-textwrap'/>
|
||||
|
||||
### How to style a label via css class
|
||||
### Styling a label via css class
|
||||
<snippet id='label-cssclass'/>
|
||||
|
||||
### How to style a label via css type
|
||||
### Styling a label via css 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'/>
|
||||
|
||||
### 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'/>
|
||||
|
@ -1,13 +1,14 @@
|
||||
---
|
||||
nav-title: "absolute-layout How-To"
|
||||
title: "absolute-layoyt"
|
||||
title: "absolute-layout"
|
||||
description: "Examples for using absolute-layout"
|
||||
previous_url: /ApiReference/ui/layouts/absolute-layout/HOW-TO
|
||||
---
|
||||
# AbsoluteLayout
|
||||
Using a AbsoluteLayout requires the AbsoluteLayout module.
|
||||
Using an AbsoluteLayout requires the AbsoluteLayout module.
|
||||
<snippet id='absolute-layout-require'/>
|
||||
|
||||
### Declaring an AbsoluteLayout
|
||||
``` XML
|
||||
<Page>
|
||||
<AbsoluteLayout>
|
||||
|
@ -8,7 +8,7 @@ previous_url: /ApiReference/ui/layouts/dock-layout/HOW-TO
|
||||
Using a DockLayout requires the DockLayout module.
|
||||
<snippet id='dock-layout-require'/>
|
||||
|
||||
### Declaring a DockLayout.
|
||||
### Declaring a DockLayout
|
||||
``` XML
|
||||
<Page>
|
||||
<DockLayout stretchLastChild="true">
|
||||
|
@ -4,11 +4,11 @@ title: "grid-layout"
|
||||
description: "Examples for using grid-layout"
|
||||
previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO
|
||||
---
|
||||
## GridLayout sample
|
||||
### Creating Grid Layout via code.
|
||||
# GridLayout
|
||||
Using a GridLayout requires the GridLayout module.
|
||||
<snippet id='grid-layout-require'/>
|
||||
|
||||
### Create grid layout with an xml declaration
|
||||
### Declaring a GridLayout
|
||||
``` XML
|
||||
<GridLayout columns="80, *, auto" rows="auto, *" >
|
||||
<Button col="0" />
|
||||
@ -19,20 +19,20 @@ previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO
|
||||
</GridLayout>
|
||||
```
|
||||
|
||||
### Add views to grid layout
|
||||
## Add views to grid layout
|
||||
<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'/>
|
||||
|
||||
### Set row property on btn4.
|
||||
## Set row property on btn4.
|
||||
<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'/>
|
||||
|
||||
### 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'/>
|
||||
|
||||
### Add columns and rows to GridLayout
|
||||
## Add columns and rows to GridLayout
|
||||
<snippet id='grid-layout-add-rowscols'/>
|
||||
|
@ -161,9 +161,11 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
|
||||
}
|
||||
|
||||
public test_codesnippets() {
|
||||
// >> stack-layout-require
|
||||
// var StackLayout = require("ui/layouts/stack-layout").StackLayout;
|
||||
// << stack-layout-require
|
||||
|
||||
// >> stack-layout-new
|
||||
// var StackLayout = require("ui/layouts/stack-layout").StackLayout;
|
||||
// >> (hide)
|
||||
// var Button = require("ui/button").Button;
|
||||
// << (hide)
|
||||
|
@ -4,12 +4,10 @@ title: "stack-layout"
|
||||
description: "Examples for using stack-layout"
|
||||
previous_url: /ApiReference/ui/layouts/stack-layout/HOW-TO
|
||||
---
|
||||
### import StackLayout and Button classes
|
||||
var StackLayout = require("ui/layouts/stack-layout").StackLayout;
|
||||
var Button = require("ui/button").Button;
|
||||
### Create StackLayout
|
||||
<snippet id='stack-layout-new'/>
|
||||
|
||||
# StackLayout
|
||||
Using a StackLayout requires the StackLayout module.
|
||||
<snippet id='stack-layout-require'/>
|
||||
|
||||
### Declaring a StackLayout.
|
||||
``` XML
|
||||
<Page>
|
||||
@ -19,12 +17,15 @@ var Button = require("ui/button").Button;
|
||||
</Page>
|
||||
```
|
||||
|
||||
### Add child view to layout
|
||||
## Create StackLayout
|
||||
<snippet id='stack-layout-new'/>
|
||||
|
||||
## Add child view to layout
|
||||
<snippet id='stack-layout-addchild'/>
|
||||
|
||||
### Remove child view from layout
|
||||
## Remove child view from layout
|
||||
<snippet id='stack-layout-remove'/>
|
||||
|
||||
### Change layout orientation to Horizontal
|
||||
## Change layout orientation to Horizontal
|
||||
<snippet id='stack-layout-horizontal'/>
|
||||
|
||||
|
@ -8,12 +8,6 @@ previous_url: /ApiReference/ui/layouts/wrap-layout/HOW-TO
|
||||
Using a WrapLayout requires the WrapLayout module.
|
||||
<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.
|
||||
``` XML
|
||||
<Page>
|
||||
@ -26,5 +20,11 @@ Other frequently used modules when working with a WrapLayout include:
|
||||
</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.
|
||||
<snippet id='wrap-layout-orientation'/>
|
||||
|
@ -7,7 +7,7 @@ previous_url: /ApiReference/ui/scroll-view/HOW-TO
|
||||
# ScrollView
|
||||
Using a ScrollView requires the ScrollView module.
|
||||
<snippet id='article-require-scrollview-module'/>
|
||||
### Declaring the ScrollView.
|
||||
### Declaring the ScrollView
|
||||
``` XML
|
||||
<Page>
|
||||
<ScrollView>
|
||||
|
Reference in New Issue
Block a user