Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
iOS 10 Programming for Beginners

You're reading from   iOS 10 Programming for Beginners Explore the latest iOS 10 and Swift 3 features

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781786464507
Length 678 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Craig Clayton Craig Clayton
Author Profile Icon Craig Clayton
Craig Clayton
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Getting Familiar with Xcode FREE CHAPTER 2. Building a Foundation with Swift 3. Digging Deeper 4. Digging into Collections 5. Starting the UI Setup 6. Setting Up UI 7. Getting Started with the Grid 8. Getting Started with the List 9. Working More with Lists 10. Where Are We? 11. Where's My Data? 12. Foodie Reviews 13. Saving Reviews 14. Universal 15. iMessages 16. Notifications 17. Just a Peek 18. Beta and Store Submission Index

Adding Our First Table View


Now, let's add a UITableView into our UIViewController:

  1. Open Explore.storyboard.

  2. In the Utilities panel, in the filter field, type tableview; then, drag the Table View onto the scene:

  3. Select the Pin icon and enter the following values:

    • Set all values under Add New Constraints to 0

    • Constrain to margins: unchecked

    • Update Frames: Items of New Constraints

  4. Now click on Add 4 Constraints.

Updating Our Edges

We now need to correct the gap at the top of our Table View:

  1. With the View Controller selected (as opposed to the Table View), select the Attributes Inspector in the Utilities panel.

  2. Scroll down to Extend Edges and uncheck both Under Top Bars and Under Bottom Bars.

Creating Our View Controller Class

Now that we have our UI set up, we need to get our data to display inside of our Table View. Before we start, create three new folders inside of the Location folder—Controller, View, and Model. As we have previously done, right-click on the Location folder and hit New Group in order...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image