Skip to content

Commit c3661f4

Browse files
committed
Tweaks to chapter 4
1 parent 750f33a commit c3661f4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ <h4 class="exercise-start">
13681368
<img src="images/chapter4/ios/4.png" alt="Grocery data on iOS"></p>
13691369
<p>At this point you have a list of data associated with each account, but a grocery list isn’t very useful if you can’t add new groceries to the list. Let’s look at how to do that next.</p>
13701370
<h3 id="gridlayout">GridLayout</h3>
1371-
<p>In order to allow users to add to their grocery lists you need to add a few additional UI controls to the list page. While you could layout these elements with a <code>&lt;StackLayout&gt;</code>, let’s look at how to create a slightly more complex layout using the <code>&lt;GridLayout&gt;</code> element.</p>
1371+
<p>In order to allow users to add to their grocery lists, you need to add a few additional UI controls to the list page. While you could use a simple <code>&lt;StackLayout&gt;</code> to stack up the controls you need, let’s look at how to create a slightly more complex layout using the <code>&lt;GridLayout&gt;</code> element.</p>
13721372
<h4 class="exercise-start">
13731373
<b>Exercise</b>: Add a GridLayout
13741374
</h4>
@@ -1400,14 +1400,14 @@ <h4 class="exercise-start">
14001400
&lt;ListView row=&quot;1&quot;&gt;...&lt;/ListView&gt;
14011401
&lt;/GridLayout&gt;
14021402
</code></pre>
1403-
<p>The outer grid layout’s <code>rows</code> attribute divides the screen into two rows, the first auto-sized according to its childrens&#39; height, and the other to contain *, or the remaining height of the screen. You place UI elements into these rows using the zero-based <code>row</code> attribute. You place inner grid layout in the top row with the <code>row=&quot;0&quot;</code> attribute, and the list view in the bottom row with the <code>row=&quot;1&quot;</code> attribute.</p>
1403+
<p>The outer grid layout’s <code>rows</code> attribute divides the screen into two rows, the first auto-sized according to its childrens&#39; height, and the other to sized to take up *, or the remaining height of the screen. You place UI elements into these rows using the zero-based <code>row</code> attribute. The inner grid layout is in the top row because of its <code>row=&quot;0&quot;</code> attribute, and the list view is in the bottom row because of its <code>row=&quot;1&quot;</code> attribute.</p>
14041404
<p>Grid layouts can also divide the screen into columns, which is what the inner grid layout does:</p>
14051405
<pre><code class="lang-XML">&lt;GridLayout columns=&quot;*, auto&quot; class=&quot;add-bar&quot;&gt;
14061406
&lt;TextField col=&quot;0&quot;&gt;&lt;/TextField&gt;
14071407
&lt;Image col=&quot;1&quot;&gt;&lt;/Image&gt;
14081408
&lt;/GridLayout&gt;
14091409
</code></pre>
1410-
<p>Here the <code>columns</code> attribute divides the top of the screen into two columns. The <code>col=&quot;0&quot;</code> attribute puts the text field in the first column, and the <code>col=&quot;1&quot;</code> attribute puts the plus image in the last column. Grid layouts are the most commonly used NativeScript layout, so you may wish to take a minute to play around with the <code>columns</code> and <code>rows</code> attributes to figure out how they work.</p>
1410+
<p>Here the <code>columns</code> attribute divides the top of the screen into two columns. The <code>col=&quot;0&quot;</code> attribute puts the text field in the first column, and the <code>col=&quot;1&quot;</code> attribute puts the “+” image in the last column. Grid layouts are the most commonly used NativeScript layout, so you may wish to take a minute to play around with the <code>columns</code> and <code>rows</code> attributes to figure out how they work.</p>
14111411
<blockquote>
14121412
<p><strong>TIP</strong>:</p>
14131413
<ul>
@@ -1426,10 +1426,10 @@ <h4 class="exercise-start">
14261426
<p>Next, give the same file’s image a new <code>tap</code> attribute binding, so that the full <code>&lt;Image&gt;</code> looks like this:</p>
14271427
<pre><code class="lang-XML">&lt;Image src=&quot;res://add&quot; (tap)=&quot;add()&quot; col=&quot;1&quot;&gt;&lt;/Image&gt;
14281428
</code></pre>
1429-
<p>With these attributes in place, your next steps are to define the <code>grocery</code> property and the <code>add()</code> method. To do that, open <code>app/pages/list/list.component.ts</code> and add the following property to the <code>ListPage</code> class (right below the existing <code>groceryList</code> property):</p>
1429+
<p>With these attributes in place, your next steps are to define a new <code>grocery</code> property and <code>add()</code> method in your <code>ListPage</code> class. To do that, open <code>app/pages/list/list.component.ts</code> and add the following property to the <code>ListPage</code> class (right below the existing <code>groceryList</code> property):</p>
14301430
<pre><code class="lang-TypeScript">grocery: string = &quot;&quot;;
14311431
</code></pre>
1432-
<p>Next, add the following two inputs to the top of the <code>list.component.ts</code> file:</p>
1432+
<p>Next, add the following two imports to the top of the <code>list.component.ts</code> file:</p>
14331433
<pre><code class="lang-TypeScript">import {TextField} from &quot;ui/text-field&quot;;
14341434
import {topmost} from &quot;ui/frame&quot;;
14351435
</code></pre>

src/chapters/chapter4.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ At this point you have a list of data associated with each account, but a grocer
399399

400400
### GridLayout
401401

402-
In order to allow users to add to their grocery lists you need to add a few additional UI controls to the list page. While you could layout these elements with a `<StackLayout>`, lets look at how to create a slightly more complex layout using the `<GridLayout>` element.
402+
In order to allow users to add to their grocery lists, you need to add a few additional UI controls to the list page. While you could use a simple `<StackLayout>` to stack up the controls you need, lets look at how to create a slightly more complex layout using the `<GridLayout>` element.
403403

404404
<h4 class="exercise-start">
405405
<b>Exercise</b>: Add a GridLayout
@@ -440,7 +440,7 @@ To break down how this layout works, let’s start with the outer structure of t
440440
</GridLayout>
441441
```
442442

443-
The outer grid layouts `rows` attribute divides the screen into two rows, the first auto-sized according to its childrens' height, and the other to contain *, or the remaining height of the screen. You place UI elements into these rows using the zero-based `row` attribute. You place inner grid layout in the top row with the `row="0"` attribute, and the list view in the bottom row with the `row="1"` attribute.
443+
The outer grid layouts `rows` attribute divides the screen into two rows, the first auto-sized according to its childrens' height, and the other to sized to take up *, or the remaining height of the screen. You place UI elements into these rows using the zero-based `row` attribute. The inner grid layout is in the top row because of its `row="0"` attribute, and the list view is in the bottom row because of its `row="1"` attribute.
444444

445445
Grid layouts can also divide the screen into columns, which is what the inner grid layout does:
446446

@@ -451,7 +451,7 @@ Grid layouts can also divide the screen into columns, which is what the inner gr
451451
</GridLayout>
452452
```
453453

454-
Here the `columns` attribute divides the top of the screen into two columns. The `col="0"` attribute puts the text field in the first column, and the `col="1"` attribute puts the plus image in the last column. Grid layouts are the most commonly used NativeScript layout, so you may wish to take a minute to play around with the `columns` and `rows` attributes to figure out how they work.
454+
Here the `columns` attribute divides the top of the screen into two columns. The `col="0"` attribute puts the text field in the first column, and the `col="1"` attribute puts the “+” image in the last column. Grid layouts are the most commonly used NativeScript layout, so you may wish to take a minute to play around with the `columns` and `rows` attributes to figure out how they work.
455455

456456
> **TIP**:
457457
> * You can nest any of the [NativeScript layouts](http://docs.nativescript.org/ui/layout-containers.html)—not just grid layouts.
@@ -475,13 +475,13 @@ Next, give the same file’s image a new `tap` attribute binding, so that the fu
475475
<Image src="res://add" (tap)="add()" col="1"></Image>
476476
```
477477

478-
With these attributes in place, your next steps are to define the `grocery` property and the `add()` method. To do that, open `app/pages/list/list.component.ts` and add the following property to the `ListPage` class (right below the existing `groceryList` property):
478+
With these attributes in place, your next steps are to define a new `grocery` property and `add()` method in your `ListPage` class. To do that, open `app/pages/list/list.component.ts` and add the following property to the `ListPage` class (right below the existing `groceryList` property):
479479

480480
``` TypeScript
481481
grocery: string = "";
482482
```
483483

484-
Next, add the following two inputs to the top of the `list.component.ts` file:
484+
Next, add the following two imports to the top of the `list.component.ts` file:
485485

486486
``` TypeScript
487487
import {TextField} from "ui/text-field";

0 commit comments

Comments
 (0)