O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning iOS UI Development

Book Description

Implement complex iOS user interfaces with ease using Swift

About This Book

  • Build compelling user interfaces that users will enjoy using the iOS UIKit framework
  • Make your iOS apps easily recognizable and familiar with the UIKit framework
  • Use this comprehensive, step-by-step guide to create a complete custom layout

Who This Book Is For

This easy-to-follow guide is perfect for beginner-level iOS developers who want to become proficient in user interface development. It would also be useful for experienced iOS developers who need a complete overview of this broad topic all in one place, without having to consult various sources.

What You Will Learn

  • Understand the basic requirements to work with iOS user interfaces
  • Get to know about the UI tools, frameworks, and built-in components
  • Plot dynamic layout structures using Auto Layout
  • Shape and implement adaptive user interfaces for different screen sizes
  • Draw and animate your user interfaces using the CALayer and UIKit animations
  • Intercept and handle user touches to create user interface interactivity
  • Create and depict totally custom controls
  • Design with iOS through Core Graphics

In Detail

Through this comprehensive one-stop guide, you’ll get to grips with the entire UIKit framework and in a flash, you’ll be creating modern user interfaces for your iOS devices using Swift.

Starting with an overview of the iOS drawing system and the available tools, you will then learn how to use these technologies to create adaptable layouts and custom elements for your applications. Next, you’ll be introduced to other topics such as animation and code-drawing with Core Graphics, which will give you all the knowledge you need to create astonishing user interfaces.

By the end of this book, you will have a solid foundation in iOS user interface development and will have gained valuable insights on the process of building firm and complex UIs.

Style and approach

This concise yet information-packed guide is full of step-by-step instructions and screenshots of real-life examples, delivered in a direct manner, to get you creating modern user interfaces for your iOS devices using SWIFT in no time.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning iOS UI Development
    1. Table of Contents
    2. Learning iOS UI Development
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. UI Fundamentals
      1. Exploring windows
        1. The contents of windows
        2. Configuring windows
      2. Working with views
        1. Defining the view's geometry
          1. The bounds property
          2. The frame property
          3. The center property
      3. UI hierarchy and views inheritance
        1. Managing with the hierarchy
          1. View and subview visibility
          2. Hierarchy events
          3. Notes about debug
        2. Hands-on code
        3. View drawing and life cycle
        4. View controllers and views
      4. Summary
    9. 2. UI Components Overview – UIKit
      1. Exploring text elements
        1. Presenting text with UILabel
        2. Receiving user input with UITextField
        3. Multiline text with UITextView
        4. Notes about the keyboard
          1. Keyboard events
          2. Keyboard configuration
      2. Exploring buttons and selectors
        1. UIButton and user interaction
          1. The target-action pattern
        2. Boolean selection with UISwitch
          1. Control customization
        3. Selecting values with UISlider
          1. Control customization
        4. User choices through UISegmentedControl
          1. Control customization
        5. Selecting values with UIPickerView and UIDatePicker
        6. Updating values with UIStepper
          1. Control customization
      3. View-based components
        1. Showing progress with UIProgressView
          1. Control customization
        2. Working with UIActivityIndicatorView
          1. Control customization
        3. Introducing UIImageView and UIImage
        4. Introducing UIScrollView
      4. Managing and presenting structured data
        1. Introducing UITableView
        2. Introducing UICollectionView
      5. The UIAppearance protocol
        1. Hands-on code
      6. Summary
    10. 3. Interface Builder, XIB, and Storyboard
      1. Interface Builder
      2. An overview of the editor
      3. Working with XIB files
      4. Managing user interfaces with Storyboards
      5. Connecting user interfaces with your code
      6. Implementing navigation with Storyboard and segues
        1. The unwind segue
        2. Hands-on code
      7. Summary
    11. 4. Auto Layout
      1. How Auto Layout works
        1. Xcode and Auto Layout
        2. Practical introduction to constraints
        3. Xcode helpers
        4. Intrinsic content size
        5. Independence from screen size
        6. Updating constraints programmatically
        7. Working with Auto Layout programmatically
          1. Initializing the views
          2. Adding constraints
          3. Working with multiple views
          4. Relations between views
      2. Summary
    12. 5. Adaptive User Interfaces
      1. UI definition with size classes
      2. User interface's traits
        1. Trait collection and trait environment
        2. Working with trait collections
      3. Size classes and Interface Builder
        1. Hands-on code
        2. Image assets and size classes
      4. Working with Dynamic Type
        1. Configurable text size
      5. Exploring text styles
      6. Improving Auto Layout structures with UIStackView
        1. Setting up UIStackView
        2. UIStackView and adaptive layouts
      7. Summary
    13. 6. Layers and Core Animation
      1. Exploring layers
        1. Layers and views
        2. The content of a layer
          1. Flat layer
          2. The contents property
          3. The layer delegate
          4. Layer subclassing
          5. Contents properties
        3. The layer geometry
        4. The layers hierarchy
        5. The appearance of layers
      2. Working with core animation
        1. Layers and animations
        2. Implicit animations
        3. Properties animations
          1. Initializing and launching the animation
          2. Keeping the animation result
          3. Handling timing and repetitions
        4. Animations group
        5. Keyframe animations
        6. Removing animations from a layer
        7. View animations
      3. Summary
    14. 7. UI Interactions – Touches and Gestures
      1. Events and touches
        1. Touch phases
        2. The UITouch class
      2. Responder chain
        1. Hit-testing
        2. Responding to touch events
      3. Gestures and gesture recognizers
        1. Working with gesture recognizers
          1. Gesture recognizer states
          2. Hands-on code
      4. Summary
    15. 8. How to Build Custom Controls
      1. The Thermostat control
      2. Designing a custom control
      3. The UIControl class
      4. Implementing the ThermostatSlider control
        1. Control initialization
        2. Drawing the control
          1. Prototyping using playground
          2. Drawing the borders
          3. Drawing the track
          4. Drawing the handle
        3. Updating the control value
          1. Updating borders
          2. Updating the track
          3. Updating the handle
        4. Touch tracking
          1. Beginning tracking
          2. Continuing tracking
          3. Ending tracking
      5. Sending actions
      6. Customizing the control with UI Appearance
      7. Summary
    16. 9. Introduction to Core Graphics
      1. Drawing on the graphic context
        1. How drawing works
          1. Handling the graphic states
          2. The coordinate system
      2. UIKit helpers
        1. Drawing with fill and stroke options
        2. Drawing with blending modes
        3. Drawing with paths
      3. Drawing with paths
        1. Path initialization
        2. Building a path
        3. Drawing the path
      4. Summary
    17. Index