- 520 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
iOS Programming Cookbook
About This Book
Over 50 exciting and powerful recipes to help you unearth the promise of iOS programmingAbout This Book⢠Create high performance iOS apps with a focus on application development APIs and techniques⢠Enrich your UI skills with UIStoryboard, Autolayout, Size classes, and Container view⢠Produce enhanced results with iOS 10 as a result of learning and implementing pro-level practices, techniques, and solutionsWho This Book Is ForIf you are an iOS developer on a quest to develop your perfect iOS app, then this book is for you. It would also prove to be a valuable resource for those who want to get up and running with iOS development through a clear, practical approach. In order to unleash the full potential of this book, basic Swift programming knowledge is necessary.What You Will Learn⢠Build your own custom UIViews through code or the interface builder⢠Implement a dynamic and interactive interface in an iOS app⢠Work on various graphics related elements and the process of using them together to make meaningful shapes.⢠Use the side over and split view to interact with multiple apps concurrently⢠Encrypt JSON calls to make the app more secure⢠Work on web markup feature to enhance search optimizationIn DetailDo you want to understand all the facets of iOS programming and build complex iOS apps? Then you have come to the right place. This problem-solution guide will help you to eliminate expensive learning curves and focus on specific issues to make you proficient at tasks and the speed-up time involved.Beginning with some advanced UI components such as Stack Views and UICollectionView, you will gradually move on to building an interface efficiently.You will work through adding gesture recognizer and touch elements on table cells for custom actions. You will work with the Photos framework to access and manipulate photos. You will then prepare your app for multitasking and write responsive and highly efficient apps. Next, you will integrate maps and core location services while making your app more secure through various encryption methods. Finally, you will dive deep into the advanced techniques of implementing notifications while working with memory management and optimizing the performance of your apps. By the end of the book, you will master most of the latest iOS 10 frameworks.Style and approachThis is the best practical resource on iOS 10 development. This book, with its no nonsense approach and a clear practical focus, will be your best friend on your quest to develop your perfect iOS app. The best thing about this book is that in addition to recipes on iOS programming techniques and app development essentials, it will take you on a complete guided tour of all the new app development APIs that are shipped with iOS 10.
Frequently asked questions
Information
The Essentials
- Using UIView via code or interface builder to build your own custom views
- Working with navigation controller and navigation bar
- Working with stack views
- Working with UICollectionView
- Working with gestures like swipe, pan, rotation, and tap
- Using 3D touch
Introduction
Using UIView via code or interface builder to build your own custom views
Getting ready
How to do it...
- Go to Xcode and create a new iOS project with template Single View Application. Set the name of the project to UIViews.
- Now, select the storyboard file and open the single page view controller:
- In the Attribute Inspector in the right-hand side bar, set the size of the View Controller to iPhone 4.7-inch size.
- Open the View Controller view, and from Object Library in the right-hand side bar, drag two UIViews. In the first UIView and from the Size Inspector tab in the right side bar, set the frame of the first one to (x = 0, y = 0, width = 375, height = 300), and from the Attribute Inspector tab, set red as the background color. In the second UIView, set the frame to (x = 0, y = 300, width = 375, height = 300).
- Rename the two views by selecting each one and hit the Enter key. The title will be converted to a text field where you can rename your views. Change the first view to RedView and the second one to BlueView. You should see something like this:
- Take an outlet for your views. Click on Assistant Editor at the top bar to open the ViewController.swift file, and drag the view to the source code file to add outlets by selecting each view and holding the Ctrl key:
- Now, open the ViewController.swift file in the viewDidLoad function and add the following code:
let yellowView = UIView(frame: CGRectMake(0, 0, 200, 100))
yellowView.backgroundColor = UIColor.yellowColor()
self.redView.addSubview(yellowView)
let brownView = UIView(frame: CGRectMake(100, 50, 200, 100))
brownView.backgroundColor = UIColor.brownColor()
self.redView.insertSubview(brownView, belowSubview: yellowView)
- Now, build and run the project; you should see something like this:
How it works...
- Function insertSubview(brownView, belowSubview: yellowView): This adds a subview below any other subview that you have in your view hierarchy. This method requires having a reference to the view you want to add below a subview.
- Function insertSubview(view, atIndex: 2): This is a very flexible function to add any subview to your view hierarchy at any index. The index is 0 indexed, and 0 means the first subview.
- Function insertSubview(view, aboveSubview: superview): This adds a subview above any other subview you have in your view hierarchy. This method requires having a reference to the view you want ...
Table of contents
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Swift Programming Language
- The Essentials
- Integrating with Messages App
- Working with Interface Builder
- Working with UITableView
- Animations and Graphics
- Multimedia
- Concurrency
- Location Services
- Security and Encryption
- Networking
- Persisting Data with Core Data
- Notifications
- App Search
- Optimizing Performance