You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Finally, because a translucent status bar continues to take up space on iOS, open <code>app/platform.ios.css</code> and paste in the following code, which bumps the content of the page on top of the status bar.</p>
1794
+
<p>Finally, there are a few last CSS tweaks you to make to account for the now translucent status bars. On iOS a translucent status bar continues to take up space open, so you need to adjust the content of the page to sit on top of the status bar’s location. To do so, open <code>app/platform.ios.css</code> and paste in the following code:</p>
1795
1795
<pre><codeclass="lang-CSS">Page {
1796
1796
margin-top: -20;
1797
1797
}
1798
1798
</code></pre>
1799
+
<p>Next, open <code>app/pages/list/list.ios.css</code> and paste in the following code, which moves the add bar down from underneath the list page’s <code><ActionBar></code>:</p>
1800
+
<pre><codeclass="lang-CSS">.add-bar {
1801
+
margin-top: 20;
1802
+
}
1803
+
</code></pre>
1804
+
<p>On Android a translucent does not take up space, so you need to add a bit of padding to the top of the list page so the status bar and <code><ActionBar></code> don’t sit on top of one another. To do so, open <code>app/pages/list/list.android.css</code> and paste in the following code:</p>
1805
+
<pre><codeclass="lang-CSS">ActionBar {
1806
+
padding-top: 10;
1807
+
}
1808
+
</code></pre>
1799
1809
<divclass="exercise-end"></div>
1800
1810
1801
-
<p>And with that, your status bar is now translucent on iOS and Android:</p>
1811
+
<p>And with that, your status bar is now translucent and properly spaced on iOS and Android:</p>
1802
1812
<p><imgsrc="images/chapter6/android/3.png" alt="Updated status bar on Android">
1803
1813
<imgsrc="images/chapter6/ios/3.png" alt="Updated status bar on iOS"></p>
1804
-
<p>And... that's it! You've created a functional, cross-platform, backend-driven app to manage your grocery list. In the process you've created a unique UI for Android and iOS, leveraged NativeScript plugins and npm modules, learned how to log in and register, managed backend services, created a list with add and delete functionality, and more. </p>
1814
+
<p>And... that's it! You've created a functional, cross-platform, backend-driven app to manage your grocery list. In the process you've created a unique UI for Android and iOS, leveraged NativeScript plugins and npm modules, learned how to log in and register, managed backend services, created a list, and more. </p>
1805
1815
<p>Congratulations! Feel free to <ahref="https://twitter.com/intent/tweet?text=I%20just%20built%20an%20iOS%20and%20Android%20app%20using%20@NativeScript%20%F0%9F%8E%89.%20You%20can%20too!%20http://docs.nativescript.org/start/getting-started%20%23opensource">share your accomplishment on Twitter</a> or <ahref="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdocs.nativescript.org%2Fstart%2Fgetting-started&p%5B">Facebook</a> to impress your friends 😀.</p>
1816
+
<h4class="exercise-start">
1817
+
<b>Challenge</b>: Add the ability to delete groceries
1818
+
</h4>
1819
+
1820
+
<p>As cool as Groceries is, it’s currently missing one crucial feature for a grocery management app: the ability to delete groceries from the list.</p>
1821
+
<p>The Groceries backend already supports deleting, but it’s up to you to implement the feature in the app. You do get two hints though. First, this is a function you can use in the <code>GroceryListService</code> for performing the necessary HTTP call to delete a grocery:</p>
<p>Second, here’s an image you can use in your template for users to tap to delete items. One note though: the image is a white “X”, so you’ll have to find a way to create a non-white background in order to see the image.</p>
<p>If you get stuck the Groceries app’s <ahref="https://github.com/NativeScript/sample-Groceries/tree/angular-end">“angular-end” branch</a> has a solution you can check.</p>
Copy file name to clipboardExpand all lines: src/chapters/chapter6.md
+52-3Lines changed: 52 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,21 +166,70 @@ setStatusBarColors();
166
166
nativeScriptBootstrap(AppComponent);
167
167
```
168
168
169
-
Finally, because a translucent status bar continues to take up space on iOS, open `app/platform.ios.css` and paste in the following code, which bumps the content of the page on top of the status bar.
169
+
Finally, there are a few last CSS tweaks you to make to account for the now translucent status bars. On iOS a translucent status bar continues to take up space open, so you need to adjust the content of the page to sit on top of the status bar’s location. To do so, open `app/platform.ios.css` and paste in the following code:
170
170
171
171
```CSS
172
172
Page {
173
173
margin-top: -20;
174
174
}
175
175
```
176
176
177
+
Next, open `app/pages/list/list.ios.css` and paste in the following code, which moves the add bar down from underneath the list page’s `<ActionBar>`:
178
+
179
+
```CSS
180
+
.add-bar {
181
+
margin-top: 20;
182
+
}
183
+
```
184
+
185
+
On Android a translucent does not take up space, so you need to add a bit of padding to the top of the list page so the status bar and `<ActionBar>` don’t sit on top of one another. To do so, open `app/pages/list/list.android.css` and paste in the following code:
186
+
187
+
```CSS
188
+
ActionBar {
189
+
padding-top: 10;
190
+
}
191
+
```
192
+
177
193
<divclass="exercise-end"></div>
178
194
179
-
And with that, your status bar is now translucent on iOS and Android:
195
+
And with that, your status bar is now translucent and properly spaced on iOS and Android:
180
196
181
197

182
198

183
199
184
-
And... that's it! You've created a functional, cross-platform, backend-driven app to manage your grocery list. In the process you've created a unique UI for Android and iOS, leveraged NativeScript plugins and npm modules, learned how to log in and register, managed backend services, created a list with add and delete functionality, and more.
200
+
And... that's it! You've created a functional, cross-platform, backend-driven app to manage your grocery list. In the process you've created a unique UI for Android and iOS, leveraged NativeScript plugins and npm modules, learned how to log in and register, managed backend services, created a list, and more.
185
201
186
202
Congratulations! Feel free to [share your accomplishment on Twitter](https://twitter.com/intent/tweet?text=I%20just%20built%20an%20iOS%20and%20Android%20app%20using%20@NativeScript%20%F0%9F%8E%89.%20You%20can%20too!%20http://docs.nativescript.org/start/getting-started%20%23opensource) or [Facebook](https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fdocs.nativescript.org%2Fstart%2Fgetting-started&p%5B) to impress your friends 😀.
203
+
204
+
<h4class="exercise-start">
205
+
<b>Challenge</b>: Add the ability to delete groceries
206
+
</h4>
207
+
208
+
As cool as Groceries is, it’s currently missing one crucial feature for a grocery management app: the ability to delete groceries from the list.
209
+
210
+
The Groceries backend already supports deleting, but it’s up to you to implement the feature in the app. You do get two hints though. First, this is a function you can use in the `GroceryListService` for performing the necessary HTTP call to delete a grocery:
Second, here’s an image you can use in your template for users to tap to delete items. One note though: the image is a white “X”, so you’ll have to find a way to create a non-white background in order to see the image.
228
+
229
+
```XML
230
+
<Imagesrc="res://delete"></Image>
231
+
```
232
+
233
+
If you get stuck the Groceries app’s [“angular-end” branch](https://github.com/NativeScript/sample-Groceries/tree/angular-end) has a solution you can check.
0 commit comments