Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Swift Essentials
  • Table Of Contents Toc
  • Feedback & Rating feedback
Swift Essentials

Swift Essentials

By : Alex Blewitt, Bandlem Limited
4.8 (4)
close
close
Swift Essentials

Swift Essentials

4.8 (4)
By: Alex Blewitt, Bandlem Limited

Overview of this book

Whether you are a seasoned Objective-C developer or new to the Xcode platform, Swift Essentials will provide you with all you need to know to get started with the language. Prior experience with iOS development is not necessary, but will be helpful to get the most out of the book.
Table of Contents (10 chapters)
close
close
9
Index

Creating views by subclassing UIView

Although xib files offer a mechanism to customize classes, the majority of UIKit views outside of standard frameworks are implemented in custom code. This makes it easier to reason what the intrinsic size should be as well as to receive code patches and understand diffs from version control systems. The downside of this approach is when using Auto Layout, writing the constraints can be a challenge and the intrinsic sizes are often misreported or return the unknown value (-1,-1).

A custom view can be implemented as a subclass of UIView. Subclasses of UIView are expected to have two initializers; one that takes frame:CGRect and one that takes a coder:NSCoder. The frame is generally used in code, and the rect specifies the position on screen (0,0 is the top-left) along with the width and height. The coder is used when deserializing from a xib file.

To allow custom subclasses to be used in either interface builder or instantiated from code, it is a best practice...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY