iOS Developer Notes For Professionals. 800+ pages of professional hints and tricks (GoalKicker.com) (Z-Library)
Author: GoalKicker.com
非小说
No Description
📄 File Format:
PDF
💾 File Size:
14.2 MB
46
Views
0
Downloads
0.00
Total Donations
📄 Text Preview (First 20 pages)
ℹ️
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
📄 Page
1
iOS Developer Notes for ProfessionalsiOS® Developer Notes for Professionals GoalKicker.com Free Programming Books Disclaimer This is an unocial free book created for educational purposes and is not aliated with ocial iOS® Developer group(s) or company(s). All trademarks and registered trademarks are the property of their respective owners 800+ pages of professional hints and tricks
📄 Page
2
Contents About 1 ................................................................................................................................................................................... Chapter 1: Getting started with iOS Development 2 ...................................................................................... Section 1.1: Creating a default Single View Application 2 ............................................................................................. Section 1.2: Hello World 6 ................................................................................................................................................. Section 1.3: Xcode Interface 11 ....................................................................................................................................... Section 1.4: Create your first program in Swift 3 17 ...................................................................................................... Chapter 2: UILabel 22 ...................................................................................................................................................... Section 2.1: Create a UILabel 22 ...................................................................................................................................... Section 2.2: Number of Lines 24 ..................................................................................................................................... Section 2.3: Set Font 25 .................................................................................................................................................... Section 2.4: Text Color 26 ................................................................................................................................................ Section 2.5: Background Color 27 .................................................................................................................................. Section 2.6: Size to fit 27 .................................................................................................................................................. Section 2.7: Text alignment 30 ........................................................................................................................................ Section 2.8: Calculate Content Bounds (for i.e. dynamic cell heights) 30 .................................................................. Section 2.9: Label Attributed Text 32 .............................................................................................................................. Section 2.10: Clickable Label 38 ...................................................................................................................................... Section 2.11: Variable height using constraints 39 ......................................................................................................... Section 2.12: LineBreakMode 39 ...................................................................................................................................... Section 2.13: Add shadows to text 41 ............................................................................................................................. Section 2.14: Changing Text in an Existing Label 41 ..................................................................................................... Section 2.15: Auto-size label to fit text 42 ....................................................................................................................... Section 2.16: Get UILabel's size strictly based on its text and font 43 ......................................................................... Section 2.17: Highlighted and Highlighted Text Color 44 .............................................................................................. Section 2.18: Justify Text 44 ............................................................................................................................................ Section 2.19: Dynamic label frame from unknown text length 45 ............................................................................... Chapter 3: UILabel text underlining 47 .................................................................................................................. Section 3.1: Underlining a text in a UILabel using Objective C 47 ................................................................................ Section 3.2: Underlining a text in UILabel using Swift 47 .............................................................................................. Chapter 4: attributedText in UILabel 48 ............................................................................................................... Section 4.1: HTML text in UILabel 48 ............................................................................................................................... Section 4.2: Set dierent property to text in single UILabel 48 ................................................................................... Chapter 5: UIButton 50 ................................................................................................................................................... Section 5.1: Creating a UIButton 50 ................................................................................................................................ Section 5.2: Attaching a Method to a Button 50 ........................................................................................................... Section 5.3: Setting Font 51 ............................................................................................................................................. Section 5.4: Set Image 51 ................................................................................................................................................ Section 5.5: Get UIButton's size strictly based on its text and font 51 ........................................................................ Section 5.6: Disabling a UIButton 52 ............................................................................................................................... Section 5.7: Set title 52 ..................................................................................................................................................... Section 5.8: Set title color 52 ........................................................................................................................................... Section 5.9: Horizontally aligning contents 53 .............................................................................................................. Section 5.10: Getting the title label 53 ............................................................................................................................. Section 5.11: Adding an action to an UIButton via Code (programmatically) 54 ....................................................... Chapter 6: UIDatePicker 55 .......................................................................................................................................... Section 6.1: Create a Date Picker 55 ............................................................................................................................... Section 6.2: Setting Minimum-Maximum Date 55 .........................................................................................................
📄 Page
3
Section 6.3: Modes 55 ....................................................................................................................................................... Section 6.4: Setting minute interval 55 ........................................................................................................................... Section 6.5: Count Down Duration 56 ............................................................................................................................. Chapter 7: UILocalNotification 57 ............................................................................................................................ Section 7.1: Scheduling a local notification 57 ............................................................................................................... Section 7.2: Presenting a local notification immediately 57 ........................................................................................ Section 7.3: Managing local notifications using UUID 58 ............................................................................................. Section 7.4: Registering for local notifications 59 ......................................................................................................... Section 7.5: what's new in UILocalNotification with iOS10 60 ....................................................................................... Section 7.6: Responding to received local notification 62 ............................................................................................ Section 7.7: Register and Schedule Local Notification in Swift 3.0 (iOS 10) 62 ........................................................... Chapter 8: UIImage 64 .................................................................................................................................................... Section 8.1: Creating UIImage 64 .................................................................................................................................... Section 8.2: Comparing Images 65 ................................................................................................................................. Section 8.3: Gradient Image with Colors 66 ................................................................................................................... Section 8.4: Convert UIImage to/from base64 encoding 66 ....................................................................................... Section 8.5: Take a Snapshot of a UIView 67 ................................................................................................................ Section 8.6: Change UIImage Color 67 ........................................................................................................................... Section 8.7: Apply UIColor to UIImage 67 ...................................................................................................................... Section 8.8: Creating and Initializing Image Objects with file contents 68 ................................................................. Section 8.9: Resizable image with caps 68 .................................................................................................................... Section 8.10: Gradient Background Layer for Bounds 69 ............................................................................................ Chapter 9: Convert NSAttributedString to UIImage 70 ................................................................................. Section 9.1: NSAttributedString to UIImage Conversion 70 .......................................................................................... Chapter 10: UIImagePickerController 71 ............................................................................................................... Section 10.1: Generic usage of UIImagePickerController 71 ......................................................................................... Chapter 11: UIImageView 73 ......................................................................................................................................... Section 11.1: UIImage masked with Label 73 .................................................................................................................. Section 11.2: Making an image into a circle or rounded 73 .......................................................................................... Section 11.3: How the Mode property aects an image 74 .......................................................................................... Section 11.4: Animating a UIImageView 80 ..................................................................................................................... Section 11.5: Create a UIImageView 81 ........................................................................................................................... Section 11.6: Change color of an image 82 .................................................................................................................... Section 11.7: Assigning an image to a UIImageView 82 ................................................................................................ Chapter 12: Resizing UIImage 83 ............................................................................................................................... Section 12.1: Resize any image by size & quality 83 ...................................................................................................... Chapter 13: Cut a UIImage into a circle 84 ........................................................................................................... Section 13.1: Cut a image into a circle - Objective C 84 ................................................................................................ Section 13.2: SWIFT 3 Example 85 ................................................................................................................................... Chapter 14: UITableView 87 ......................................................................................................................................... Section 14.1: Self-Sizing Cells 87 ....................................................................................................................................... Section 14.2: Custom Cells 87 .......................................................................................................................................... Section 14.3: Separator Lines 90 ...................................................................................................................................... Section 14.4: Delegate and Datasource 92 .................................................................................................................... Section 14.5: Creating a UITableView 98 ........................................................................................................................ Section 14.6: Swipe to Delete Rows 102 ......................................................................................................................... Section 14.7: Expanding & Collapsing UITableViewCells 105 ....................................................................................... Chapter 15: UITableViewController 108 ................................................................................................................. Section 15.1: TableView with dynamic properties with tableviewCellStyle basic 108 ................................................
📄 Page
4
Section 15.2: TableView with Custom Cell 109 ............................................................................................................... Chapter 16: UIRefreshControl TableView 111 ..................................................................................................... Section 16.1: Set up refreshControl on tableView: 111 .................................................................................................. Section 16.2: Objective-C Example 111 .......................................................................................................................... Chapter 17: UITableViewCell 113 ............................................................................................................................... Section 17.1: Xib file of UITableViewCell 113 ................................................................................................................... Chapter 18: Custom methods of selection of UITableViewCells 114 ....................................................... Section 18.1: Distinction between single and double selection on row 114 ................................................................. Chapter 19: Custom methods of selection of UITableViewCells 115 ....................................................... Section 19.1: Distinction between single and double selection on row 115 ................................................................. Chapter 20: UIView 116 .................................................................................................................................................. Section 20.1: Make the view rounded 116 ...................................................................................................................... Section 20.2: Using IBInspectable and IBDesignable 118 ............................................................................................ Section 20.3: Taking a snapshot 121 .............................................................................................................................. Section 20.4: Create a UIView 121 .................................................................................................................................. Section 20.5: Shake a View 121 ...................................................................................................................................... Section 20.6: Utilizing Intrinsic Content Size 122 ........................................................................................................... Section 20.7: Programmatically manage UIView insertion and deletion into and from another UIView 124 ............................................................................................................................................................................. Section 20.8: Create UIView using Autolayout 125 ....................................................................................................... Section 20.9: Animating a UIView 127 ............................................................................................................................ Section 20.10: UIView extension for size and frame attributes 127 ............................................................................ Chapter 21: Snapshot of UIView 129 ........................................................................................................................ Section 21.1: Getting the Snapshot 129 ........................................................................................................................... Section 21.2: Snapshot with subview with other markup and text 129 ....................................................................... Chapter 22: UIAlertController 131 ............................................................................................................................. Section 22.1: AlertViews with UIAlertController 131 ...................................................................................................... Section 22.2: Action Sheets with UIAlertController 132 ................................................................................................ Section 22.3: Adding Text Field in UIAlertController like a prompt Box 135 .............................................................. Section 22.4: Highlighting an action button 135 ........................................................................................................... Section 22.5: Displaying and handling alerts 136 ......................................................................................................... Chapter 23: UIColor 141 ................................................................................................................................................. Section 23.1: Creating a UIColor 141 ............................................................................................................................... Section 23.2: Creating a UIColor from hexadecimal number or string 142 ............................................................... Section 23.3: Color with Alpha component 144 ............................................................................................................. Section 23.4: Undocumented Methods 145 ................................................................................................................... Section 23.5: UIColor from an image pattern 146 ........................................................................................................ Section 23.6: Lighter and Darker Shade of a given UIColor 147 ................................................................................. Section 23.7: Make user defined attributes apply the CGColor datatype 148 ........................................................... Chapter 24: UITextView 149 ........................................................................................................................................ Section 24.1: Set attributed text 149 ............................................................................................................................... Section 24.2: Change font 149 ........................................................................................................................................ Section 24.3: Auto Detect Links, Addresses, Dates, and more 149 ............................................................................. Section 24.4: Change text 150 ......................................................................................................................................... Section 24.5: Change text alignment 150 ...................................................................................................................... Section 24.6: UITextViewDelegate methods 150 .......................................................................................................... Section 24.7: Change text color 151 ............................................................................................................................... Section 24.8: Remove extra paddings to fit to a precisely measured text 151 ......................................................... Section 24.9: Getting and Setting the Cursor Postition 151 .........................................................................................
📄 Page
5
Section 24.10: UITextView with HTML text 153 .............................................................................................................. Section 24.11: Check to see if empty or nil 153 .............................................................................................................. Chapter 25: UITextField Delegate 154 .................................................................................................................... Section 25.1: Actions when a user has started/ended interacting with a textfield 154 ............................................. Section 25.2: UITextField - Restrict textfield to certain characters 155 ...................................................................... Chapter 26: UINavigationController 156 ............................................................................................................... Section 26.1: Embed a view controller in a navigation controller programmatically 156 ........................................ Section 26.2: Popping in a Navigation Controller 156 .................................................................................................. Section 26.3: Purpose 156 ................................................................................................................................................ Section 26.4: Pushing a view controller onto the navigation stack 157 ..................................................................... Section 26.5: Creating a NavigationController 157 ....................................................................................................... Chapter 27: UIGestureRecognizer 158 .................................................................................................................... Section 27.1: UITapGestureRecognizer 158 ................................................................................................................... Section 27.2: UITapGestureRecognizer (Double Tap) 159 .......................................................................................... Section 27.3: Adding a Gesture recognizer in the Interface Builder 159 .................................................................... Section 27.4: UILongPressGestureRecognizer 160 ....................................................................................................... Section 27.5: UISwipeGestureRecognizer 161 ............................................................................................................... Section 27.6: UIPinchGestureRecognizer 162 ................................................................................................................ Section 27.7: UIRotationGestureRecognizer 163 ........................................................................................................... Chapter 28: UIBarButtonItem 164 ............................................................................................................................ Section 28.1: Creating a UIBarButtonItem in the Interface Builder 164 ...................................................................... Section 28.2: Creating a UIBarButtonItem 167 ............................................................................................................. Section 28.3: Bar Button Item Original Image with no Tint Color 167 ........................................................................ Chapter 29: UIScrollView 168 ....................................................................................................................................... Section 29.1: Scrolling content with Auto Layout enabled 168 .................................................................................... Section 29.2: Create a UIScrollView 171 ........................................................................................................................ Section 29.3: ScrollView with AutoLayout 171 ............................................................................................................... Section 29.4: Detecting when UIScrollView finished scrolling with delegate methods 176 ...................................... Section 29.5: Enable/Disable Scrolling 176 ................................................................................................................... Section 29.6: Zoom In/Out UIImageView 177 ............................................................................................................... Section 29.7: Scroll View Content Size 178 ..................................................................................................................... Section 29.8: Restrict scrolling direction 178 ................................................................................................................. Chapter 30: UIStackView 179 ...................................................................................................................................... Section 30.1: Center Buttons with UIStackview 179 ....................................................................................................... Section 30.2: Create a horizontal stack view programmatically 183 ......................................................................... Section 30.3: Create a vertical stack view programmatically 184 .............................................................................. Chapter 31: Dynamically updating a UIStackView 185 .................................................................................. Section 31.1: Connect the UISwitch to an action we can animate switching between a horizontal or vertical layout of the image views 185 ................................................................................................................................ Chapter 32: UIScrollView with StackView child 186 ......................................................................................... Section 32.1: A complex StackView inside Scrollview Example 186 ............................................................................. Section 32.2: Preventing ambiguous layout 187 ........................................................................................................... Section 32.3: Scrolling to content inside nested StackViews 188 ................................................................................ Chapter 33: UIScrollView AutoLayout 189 ............................................................................................................ Section 33.1: ScrollableController 189 ............................................................................................................................. Section 33.2: UIScrollView dynamic content size through Storyboard 193 ............................................................... Chapter 34: UITextField 195 ......................................................................................................................................... Section 34.1: Get Keyboard Focus and Hide Keyboard 195 ........................................................................................ Section 34.2: Dismiss keyboard when user pushes the return button 195 .................................................................
📄 Page
6
Section 34.3: Hide blinking caret 196 .............................................................................................................................. Section 34.4: Input accessory view (toolbar) 196 ......................................................................................................... Section 34.5: Moving scroll when UITextView becomes first responder 197 ............................................................. Section 34.6: KeyboardType 199 .................................................................................................................................... Section 34.7: Change placeholder color and font 199 ................................................................................................. Section 34.8: Replace keyboard with UIPickerView 200 ............................................................................................... Section 34.9: Create a UITextField 203 ........................................................................................................................... Section 34.10: Getting and Setting the Cursor Position 204 ......................................................................................... Section 34.11: Dismiss Keyboard 205 .............................................................................................................................. Section 34.12: Initialize text field 208 ............................................................................................................................... Section 34.13: Autocapitalization 208 .............................................................................................................................. Section 34.14: Set Alignment 209 .................................................................................................................................... Chapter 35: Custom UITextField 210 ....................................................................................................................... Section 35.1: Custom UITextField for Filtering Input Text 210 ...................................................................................... Section 35.2: Custom UITextField to Disallow All Actions like Copy, Paste, etc 210 .................................................. Chapter 36: UIViewController 212 ............................................................................................................................. Section 36.1: Subclassing 212 .......................................................................................................................................... Section 36.2: Access the container view controller 214 ................................................................................................ Section 36.3: Set the view programmatically 214 ......................................................................................................... Section 36.4: Instantiate from a Storyboard 214 .......................................................................................................... Section 36.5: Create an instance 215 ............................................................................................................................. Section 36.6: Adding/removing a child view controller 216 ......................................................................................... Chapter 37: UISwitch 217 ............................................................................................................................................... Section 37.1: Set Image for On/O state 217 ................................................................................................................ Section 37.2: Set On / O 217 ......................................................................................................................................... Section 37.3: Set Background Color 217 ........................................................................................................................ Section 37.4: Set Tint Color 218 ....................................................................................................................................... Chapter 38: UICollectionView 219 ............................................................................................................................. Section 38.1: Create a UICollectionView 219 .................................................................................................................. Section 38.2: UICollectionView - Datasource 219 ......................................................................................................... Section 38.3: Basic Swift example of a Collection View 220 ........................................................................................ Section 38.4: Manage Multiple Collection view with DataSource and Flowlayout 225 ............................................. Section 38.5: UICollectionViewDelegate setup and item selection 227 ...................................................................... Section 38.6: Create a Collection View Programmatically 228 ................................................................................... Section 38.7: Swift - UICollectionViewDelegateFlowLayout 229 ................................................................................. Section 38.8: Performing batch updates 229 ................................................................................................................ Chapter 39: UISearchController 231 ........................................................................................................................ Section 39.1: Search Bar in Navigation Bar Title 231 .................................................................................................... Section 39.2: Search Bar in Table View Header 234 ..................................................................................................... Section 39.3: Implementation 237 ................................................................................................................................... Section 39.4: UISerachController in Objective-C 237 .................................................................................................... Chapter 40: UITabBarController 239 ...................................................................................................................... Section 40.1: Create an instance 239 .............................................................................................................................. Section 40.2: Navigation Controller with TabBar 239 .................................................................................................. Section 40.3: Tab Bar color customizing 240 ................................................................................................................ Section 40.4: Changing Tab Bar Item Title and Icon 240 ............................................................................................. Section 40.5: Create Tab Bar controller programmatically without Storyboard 241 ............................................... Section 40.6: UITabBarController with custom color selection 242 ............................................................................ Chapter 41: UIWebView 245 .........................................................................................................................................
📄 Page
7
Section 41.1: Create a UIWebView instance 245 ............................................................................................................ Section 41.2: Determining content size 245 ................................................................................................................... Section 41.3: Load HTML string 245 ................................................................................................................................ Section 41.4: Making a URL request 246 ........................................................................................................................ Section 41.5: Load JavaScript 246 .................................................................................................................................. Section 41.6: Stop Loading Web Content 247 ................................................................................................................ Section 41.7: Reload Current Web Content 247 ............................................................................................................. Section 41.8: Load Document files like .pdf, .txt, .doc etc 247 ...................................................................................... Section 41.9: Load local HTML file in webView 247 ....................................................................................................... Section 41.10: Make links That inside UIWebview clickable 248 ................................................................................... Chapter 42: UIActivityViewController 250 ............................................................................................................ Section 42.1: Initializing the Activity View Controller 250 .............................................................................................. Chapter 43: UIControl - Event Handling with Blocks 251 ............................................................................. Section 43.1: Introduction 251 .......................................................................................................................................... Chapter 44: UISplitViewController 254 .................................................................................................................. Section 44.1: Master and Detail View interaction using Delegates in Objective C 254 .............................................. Chapter 45: UISlider 264 ................................................................................................................................................ Section 45.1: UISlider 264 ................................................................................................................................................. Section 45.2: SWIFT Example 264 ................................................................................................................................... Section 45.3: Adding a custom thumb image 264 ........................................................................................................ Chapter 46: UIStoryboard 266 ................................................................................................................................... Section 46.1: Getting an instance of UIStoryboard programmatically 266 ................................................................ Section 46.2: Open another storyboard 266 ................................................................................................................. Chapter 47: UIPageViewController 267 ................................................................................................................. Section 47.1: Create a horizontal paging UIPageViewController programmatically 267 ......................................... Section 47.2: A simple way to create horizontal page view controllers ( infinite pages ) 268 ................................. Chapter 48: UISplitViewController 272 .................................................................................................................. Section 48.1: Interacting Between Master and Detail View using Delegates in Objective C 272 ............................. Chapter 49: UIFont 276 .................................................................................................................................................. Section 49.1: Declaring and initializing UIFont 276 ........................................................................................................ Section 49.2: Changing the font of a label 276 ............................................................................................................. Chapter 50: UIDevice 277 .............................................................................................................................................. Section 50.1: Get iOS device model name 277 .............................................................................................................. Section 50.2: Identifying the Device and Operating 278 .............................................................................................. Section 50.3: Getting the Device Orientation 279 ......................................................................................................... Section 50.4: Getting the Device Battery State 280 ...................................................................................................... Section 50.5: Using the Proximity Sensor 281 ............................................................................................................... Section 50.6: Getting Battery Status and Battery Level 281 ....................................................................................... Chapter 51: Make selective UIView corners rounded 282 ............................................................................. Section 51.1: Objective C code to make selected corner of a UiView rounded 282 ................................................... Chapter 52: Custom UIViews from XIB files 283 ................................................................................................ Section 52.1: Wiring elements 283 .................................................................................................................................. Section 52.2: How to make custom reusable UIView using XIB 297 ........................................................................... Chapter 53: UIBezierPath 298 ..................................................................................................................................... Section 53.1: Designing and drawing a Bezier Path 298 ............................................................................................... Section 53.2: How to apply corner radius to rectangles drawn by UIBezierPath 303 .............................................. Section 53.3: How to apply shadows to UIBezierPath 305 ........................................................................................... Section 53.4: How to create a simple shapes using UIBezierPath 307 .......................................................................
📄 Page
8
Section 53.5: UIBezierPath + AutoLayout 309 ............................................................................................................... Section 53.6: pie view & column view with UIBezierPath 310 ....................................................................................... Chapter 54: UIPickerView 313 ..................................................................................................................................... Section 54.1: Basic example 313 ..................................................................................................................................... Section 54.2: Changing pickerView Background Color and text color 314 ................................................................ Chapter 55: UIFeedbackGenerator 315 ................................................................................................................. Section 55.1: Trigger Impact Haptic 315 ........................................................................................................................ Chapter 56: UIAppearance 317 .................................................................................................................................. Section 56.1: Set appearance of all instances of the class 317 ................................................................................... Section 56.2: Appearance for class when contained in container class 318 ............................................................. Chapter 57: UIKit Dynamics with UICollectionView 319 ................................................................................. Section 57.1: Creating a Custom Dragging Behavior with UIDynamicAnimator 319 ................................................ Chapter 58: UIPheonix - easy, flexible, dynamic & highly scalable UI framework 329 ................. Section 58.1: Example UI Components 329 .................................................................................................................... Section 58.2: Example Usage 331 ................................................................................................................................... Chapter 59: UIKit Dynamics 332 ................................................................................................................................ Section 59.1: Flick View Based on Gesture Velocity 332 ............................................................................................... Section 59.2: "Sticky Corners" Eect Using UIFieldBehaviors 335 .............................................................................. Section 59.3: UIDynamicBehavior Driven Custom Transition 340 ............................................................................... Section 59.4: Shade Transition with Real-World Physics Using UIDynamicBehaviors 351 ...................................... Section 59.5: Map Dynamic Animation Position Changes to Bounds 363 .................................................................. Section 59.6: The Falling Square 368 ............................................................................................................................. Chapter 60: UI Testing 370 ........................................................................................................................................... Section 60.1: Accessibility Identifier 370 ......................................................................................................................... Section 60.2: Adding Test Files to Xcode Project 372 ................................................................................................... Section 60.3: Disable animations during UI Testing 373 .............................................................................................. Section 60.4: Lunch and Terminate application while executing 373 ......................................................................... Section 60.5: Rotate devices 373 .................................................................................................................................... Chapter 61: Change Status Bar Color 374 ............................................................................................................. Section 61.1: For non-UINavigationBar status bars 374 ................................................................................................ Section 61.2: For UINavigationBar status bars 374 ....................................................................................................... Section 61.3: For ViewController containment 375 ........................................................................................................ Section 61.4: If you cannot change ViewController's code 375 ................................................................................... Section 61.5: Changing the status bar style for the entire application 375 ................................................................ Chapter 62: UISegmentedControl 377 .................................................................................................................... Section 62.1: Creating UISegmentedControl via code 377 ........................................................................................... Chapter 63: Passing Data between View Controllers 378 ............................................................................ Section 63.1: Using the Delegate Pattern (passing data back) 378 ............................................................................ Section 63.2: Using Segues (passing data forward) 380 ............................................................................................. Section 63.3: Passing data backwards using unwind to segue 381 ............................................................................ Section 63.4: Passing data using closures (passing data back) 382 .......................................................................... Section 63.5: Using callback closure(block) passing data back 383 .......................................................................... Section 63.6: By assigning property (Passing data forward) 384 ............................................................................... Chapter 64: Managing the Keyboard 385 ............................................................................................................ Section 64.1: Create a custom in-app keyboard 385 .................................................................................................... Section 64.2: Dismiss a keyboard with tap on view 389 ............................................................................................... Section 64.3: Managing the Keyboard Using a Singleton + Delegate 390 ................................................................. Section 64.4: Moving view up or down when keyboard is present 393 ...................................................................... Section 64.5: Scrolling a UIScrollView/UITableView When Displaying the Keyboard 394 .......................................
📄 Page
9
Chapter 65: Checking for Network Connectivity 396 ...................................................................................... Section 65.1: Creating a Reachability listener 396 ......................................................................................................... Section 65.2: Add observer to network changes 396 ................................................................................................... Section 65.3: Alert when network becomes unavailable 396 ....................................................................................... Section 65.4: Alert when connection becomes a WIFI or cellular network 396 ......................................................... Section 65.5: Verify if is connected to network 397 ...................................................................................................... Chapter 66: Accessibility 399 ....................................................................................................................................... Section 66.1: Make a View Accessible 399 ...................................................................................................................... Section 66.2: Accessibility Frame 399 ............................................................................................................................ Section 66.3: Layout Change 399 ................................................................................................................................... Section 66.4: Accessibility Container 399 ....................................................................................................................... Section 66.5: Hiding Elements 400 .................................................................................................................................. Section 66.6: Screen Change 400 .................................................................................................................................... Section 66.7: Announcement 400 .................................................................................................................................... Section 66.8: Ordering Elements 400 ............................................................................................................................. Section 66.9: Modal View 401 .......................................................................................................................................... Chapter 67: Auto Layout 402 ....................................................................................................................................... Section 67.1: Space Views Evenly 402 ............................................................................................................................. Section 67.2: Center Constraints 403 .............................................................................................................................. Section 67.3: Setting constraints programmatically 406 .............................................................................................. Section 67.4: UILabel & Parentview size According to Text in UILabel 407 ................................................................ Section 67.5: UILabel Intrinsic Size 412 ........................................................................................................................... Section 67.6: Visual Format Language Basics: Constraints in Code! 422 ................................................................... Section 67.7: Resolve UILabel Priority Conflict 424 ....................................................................................................... Section 67.8: How to animate with Auto Layout 426 .................................................................................................... Section 67.9: NSLayoutConstraint: Contraints in code! 427 ......................................................................................... Section 67.10: Proportional Layout 428 .......................................................................................................................... Section 67.11: Mixed usage of Auto Layout with non-Auto Layout 429 ....................................................................... Section 67.12: How to use Auto Layout 429 ................................................................................................................... Chapter 68: MKMapView 431 ....................................................................................................................................... Section 68.1: Change map-type 431 ............................................................................................................................... Section 68.2: Simulate a custom location 435 ............................................................................................................... Section 68.3: Set Zoom/Region for Map 435 ................................................................................................................ Section 68.4: Local search implementation using MKLocalSearch 436 ..................................................................... Section 68.5: OpenStreetMap Tile-Overlay 436 ............................................................................................................ Section 68.6: Scroll to coordinate and zoom-level 438 ................................................................................................ Section 68.7: Working With Annotation 440 .................................................................................................................. Section 68.8: Add MKMapView 440 ................................................................................................................................ Section 68.9: Show UserLocation and UserTracking example 441 ............................................................................. Section 68.10: Adding Pin/Point Annotation on map 444 ............................................................................................. Section 68.11: Adjust the map view's visible rect in order to display all annotations 445 ......................................... Chapter 69: NSArray 446 ............................................................................................................................................... Section 69.1: Convert Array into json string 446 ............................................................................................................ Chapter 70: NSAttributedString 447 ....................................................................................................................... Section 70.1: Creating a string that has custom kerning (letter spacing) 447 ........................................................... Section 70.2: Change the color of a word or string 447 ............................................................................................... Section 70.3: Removing all attributes 448 ...................................................................................................................... Section 70.4: Appending Attributed Strings and bold text in Swift 448 ...................................................................... Section 70.5: Create a string with strikethrough text 448 ............................................................................................
📄 Page
10
Chapter 71: Convert HTML to NSAttributed string and vice verse 450 ................................................. Section 71.1: Objective C code to convert HTML string to NSAttributedString and Vice Versa 450 ......................... Chapter 72: NSTimer 451 ............................................................................................................................................... Section 72.1: Creating a Timer 451 ................................................................................................................................. Section 72.2: Manually firing a timer 451 ....................................................................................................................... Section 72.3: Timer frequency options 452 ................................................................................................................... Section 72.4: Invalidating a timer 453 ............................................................................................................................ Section 72.5: Passing of data using Timer 453 ............................................................................................................. Chapter 73: NSDate 454 ................................................................................................................................................. Section 73.1: NSDateFormatter 454 ................................................................................................................................ Section 73.2: Date Comparison 455 ............................................................................................................................... Section 73.3: Get Historic Time from NSDate (eg: 5s ago, 2m ago, 3h ago) 457 ...................................................... Section 73.4: Get Unix Epoch time 458 ........................................................................................................................... Section 73.5: Get NSDate from JSON Date format "/Date(1268123281843)/" 458 .................................................... Section 73.6: Get time cycle type (12-hour or 24-hour) 459 ......................................................................................... Section 73.7: Get Current Date 459 ................................................................................................................................. Section 73.8: Get NSDate Object N seconds from current date 459 .......................................................................... Section 73.9: UTC Time oset from NSDate with TimeZone 460 ................................................................................ Section 73.10: Convert NSDate that is composed from hour and minute (only) to a full NSDate 460 ................... Chapter 74: NSNotificationCenter 462 .................................................................................................................. Section 74.1: Removing Observers 462 .......................................................................................................................... Section 74.2: Adding an Observer 462 ........................................................................................................................... Section 74.3: Posting a Notification with Data 463 ....................................................................................................... Section 74.4: Add and remove observer for name 463 ............................................................................................... Section 74.5: Posting a Notification 463 ......................................................................................................................... Section 74.6: Observing a Notification 464 .................................................................................................................... Section 74.7: Adding/Removing an Observer with a Block 464 .................................................................................. Chapter 75: NSURLSession 465 .................................................................................................................................. Section 75.1: Objective-C Create a Session And Data Task 465 .................................................................................. Section 75.2: Setting up background configuration 465 .............................................................................................. Section 75.3: Simple GET request 466 ............................................................................................................................ Section 75.4: Sending a POST Request with arguments using NSURLSession in Objective-C 466 ......................... Chapter 76: NSUserDefaults 471 ............................................................................................................................... Section 76.1: Setting values 471 ...................................................................................................................................... Section 76.2: UserDefaults uses in Swift 3 472 .............................................................................................................. Section 76.3: Use Managers to Save and Read Data 473 ............................................................................................ Section 76.4: Saving Values 475 ...................................................................................................................................... Section 76.5: Clearing NSUserDefaults 475 ................................................................................................................... Section 76.6: Getting Default Values 475 ....................................................................................................................... Chapter 77: NSHTTPCookieStorage 477 ............................................................................................................... Section 77.1: Store and read the cookies from NSUserDefault 477 ............................................................................ Chapter 78: NSURLConnection 479 .......................................................................................................................... Section 78.1: Delegate methods 479 ............................................................................................................................... Section 78.2: Synchronous Request 479 ........................................................................................................................ Section 78.3: Asynchronous request 480 ....................................................................................................................... Chapter 79: NSURL 481 .................................................................................................................................................. Section 79.1: How to get last string component from NSURL String 481 ................................................................... Section 79.2: How to get last string component from URL (NSURL) in Swift 481 ..................................................... Chapter 80: NSData 482 ................................................................................................................................................
📄 Page
11
Section 80.1: Converting NSData to HEX string 482 ..................................................................................................... Section 80.2: Creating NSData objects 482 ................................................................................................................... Section 80.3: Converting NSData to other types 482 ................................................................................................... Chapter 81: NSInvocation 484 ..................................................................................................................................... Section 81.1: NSInvocation Objective-C 484 ................................................................................................................... Chapter 82: NSUserActivity 486 ................................................................................................................................. Section 82.1: Creating a NSUserActivity 486 .................................................................................................................. Chapter 83: NSPredicate 487 ...................................................................................................................................... Section 83.1: Form validation using NSPredicate 487 ................................................................................................... Section 83.2: Creating an NSPredicate Using predicateWithBlock 488 ...................................................................... Section 83.3: Creating an NSPredicate Using predicateWithFormat 488 .................................................................. Section 83.4: Creating an NSPredicate with Substitution Variables 489 ..................................................................... Section 83.5: NSPredicate with `AND`, `OR` and `NOT` condition 489 .......................................................................... Section 83.6: Using NSPredicate to Filter an Array 489 ............................................................................................... Chapter 84: NSBundle 491 ........................................................................................................................................... Section 84.1: Getting Bundle by Path 491 ....................................................................................................................... Section 84.2: Getting the Main Bundle 491 .................................................................................................................... Chapter 85: CAAnimation 492 ..................................................................................................................................... Section 85.1: Animate a view from one position to another 492 ................................................................................. Section 85.2: Animate View - Toss 492 .......................................................................................................................... Section 85.3: Push View Animation 492 .......................................................................................................................... Section 85.4: Revolve View 493 ....................................................................................................................................... Section 85.5: Shake View 493 .......................................................................................................................................... Chapter 86: Concurrency 494 ...................................................................................................................................... Section 86.1: Dispatch group - waiting for other threads completed 494 .................................................................. Section 86.2: Executing on the main thread 495 ........................................................................................................... Section 86.3: Running code concurrently -- Running code while running other code 495 ...................................... Chapter 87: CAGradientLayer 496 ............................................................................................................................ Section 87.1: Creating a CAGradientLayer 496 .............................................................................................................. Section 87.2: Animating a color change in CAGradientLayer 497 .............................................................................. Section 87.3: Creating a horizontal CAGradientLayer 498 ........................................................................................... Section 87.4: Creating a horizontal CAGradientLayer with multiple colors 499 ........................................................ Section 87.5: Creating a CGGradientLayer with multiple colors 500 .......................................................................... Chapter 88: Safari Services 502 ................................................................................................................................ Section 88.1: Open a URL with SafariViewController 502 ............................................................................................. Section 88.2: Implement SFSafariViewControllerDelegate 502 .................................................................................. Section 88.3: Add Items to Safari Reading List 503 ...................................................................................................... Chapter 89: CALayer 504 ............................................................................................................................................... Section 89.1: Adding Transforms to a CALayer (translate, rotate, scale) 504 ........................................................... Section 89.2: Shadows 508 .............................................................................................................................................. Section 89.3: Emitter View with custom image 509 ...................................................................................................... Section 89.4: Rounded corners 510 ................................................................................................................................ Section 89.5: Creating particles with CAEmitterLayer 510 ........................................................................................... Section 89.6: How to add a UIImage to a CALayer 511 ............................................................................................... Section 89.7: Disable Animations 514 ............................................................................................................................. Chapter 90: iOS - Implementation of XMPP with Robbie Hanson framework 516 .......................... Section 90.1: iOS XMPP Robbie Hanson Example with Openfire 516 .......................................................................... Chapter 91: Swift and Objective-C interoperability 519 ................................................................................ Section 91.1: Using Objective-C Classes in Swift 519 .....................................................................................................
📄 Page
12
Section 91.2: Using Swift Classes in Objective-C 521 .................................................................................................... Chapter 92: Custom fonts 523 .................................................................................................................................... Section 92.1: Embedding custom fonts 523 ................................................................................................................... Section 92.2: Applying custom fonts to controls within a Storyboard 523 ................................................................ Section 92.3: Custom Fonts with Storyboard 526 ......................................................................................................... Chapter 93: AVSpeechSynthesizer 529 ................................................................................................................... Section 93.1: Creating a basic text to speech 529 ......................................................................................................... Chapter 94: Localization 530 ...................................................................................................................................... Section 94.1: Localization in iOS 530 ............................................................................................................................... Chapter 95: Alamofire 531 ............................................................................................................................................ Section 95.1: Manual Validation 531 ............................................................................................................................... Section 95.2: Automatic Validation 531 ......................................................................................................................... Section 95.3: Chained Response Handlers 531 ............................................................................................................. Section 95.4: Making a Request 531 ............................................................................................................................... Section 95.5: Response Handling 531 ............................................................................................................................ Section 95.6: Response Handler 532 .............................................................................................................................. Chapter 96: iBeacon 533 ................................................................................................................................................ Section 96.1: iBeacon Basic Operation 533 .................................................................................................................... Section 96.2: Ranging iBeacons 533 .............................................................................................................................. Section 96.3: Scanning specific Beacons 534 ................................................................................................................ Chapter 97: CLLocation 535 ......................................................................................................................................... Section 97.1: Distance Filter using 535 ............................................................................................................................ Section 97.2: Get User Location Using CLLocationManager 535 ................................................................................ Chapter 98: Checking iOS version 537 .................................................................................................................... Section 98.1: iOS 8 and later 537 ..................................................................................................................................... Section 98.2: Swift 2.0 and later 537 .............................................................................................................................. Section 98.3: Compare versions 537 .............................................................................................................................. Section 98.4: Device iOS Version 537 ............................................................................................................................. Chapter 99: Universal Links 539 ................................................................................................................................. Section 99.1: Setup iOS Application (Enabling Universal Links) 539 ............................................................................ Section 99.2: Supporting Multiple Domains 542 ............................................................................................................ Section 99.3: Signing the App-Site-Association File 542 ............................................................................................... Section 99.4: Setup Server 542 ........................................................................................................................................ Chapter 100: PDF Creation in iOS 544 ..................................................................................................................... Section 100.1: Create PDF 544 ......................................................................................................................................... Section 100.2: Show PDF 545 ........................................................................................................................................... Section 100.3: Multiple page PDF 546 ............................................................................................................................. Section 100.4: Create PDF from any Microsoft Document loaded in UIWebview 546 .............................................. Chapter 101: In-App Purchase 548 ............................................................................................................................. Section 101.1: Single IAP in Swift 2 548 ............................................................................................................................ Section 101.2: Most basic steps for purchasing/subscribing a user to an IAP 550 .................................................... Section 101.3: Set Up in iTunesConnect 550 ................................................................................................................... Chapter 102: CGContext Reference 552 ................................................................................................................. Section 102.1: Draw line 552 ............................................................................................................................................. Section 102.2: Draw Text 552 .......................................................................................................................................... Chapter 103: Core Location 554 ................................................................................................................................. Section 103.1: Request Permission to Use Location Services 554 ................................................................................ Section 103.2: Add own custom location using GPX file 557 ........................................................................................
📄 Page
13
Section 103.3: Link CoreLocation Framework 557 ........................................................................................................ Section 103.4: Location Services in the Background 558 ............................................................................................. Chapter 104: FacebookSDK 560 ................................................................................................................................. Section 104.1: Creating your own custom "Sign In With Facebook" button 560 ........................................................ Section 104.2: FacebookSDK Integration 560 ................................................................................................................ Section 104.3: Fetching the facebook user data 563 .................................................................................................... Chapter 105: AFNetworking 564 ................................................................................................................................. Section 105.1: Dispatching completion block on a custom thread 564 ....................................................................... Chapter 106: CTCallCenter 565 ................................................................................................................................... Section 106.1: CallKit - ios 10 565 ..................................................................................................................................... Section 106.2: Intercepting calls from your app even from the background 565 ..................................................... Chapter 107: Push Notifications 567 ........................................................................................................................ Section 107.1: Registering device for Push Notifications 567 ....................................................................................... Section 107.2: Registering App ID for use with Push Notifications 570 ....................................................................... Section 107.3: Testing push notifications 572 ................................................................................................................ Section 107.4: Checking if your app is already registered for Push Notification 574 ................................................ Section 107.5: Generating a .pem certificate from your .cer file, to pass on to the server developer 574 ............. Section 107.6: Unregistering From Push Notifications 574 ........................................................................................... Section 107.7: Setting the application icon badge number 575 ................................................................................... Section 107.8: Registering for (Non Interactive) Push Notification 575 ...................................................................... Section 107.9: Handling Push Notification 576 ............................................................................................................... Chapter 108: Extension for rich Push Notification - iOS 10. 578 ................................................................. Section 108.1: Notification Content Extension 578 ......................................................................................................... Section 108.2: Implementation 578 ................................................................................................................................. Chapter 109: Rich Notifications 580 ......................................................................................................................... Section 109.1: Creating a simple UNNotificationContentExtension 580 ...................................................................... Chapter 110: Key Value Coding-Key Value Observation 585 ...................................................................... Section 110.1: Observing a property of a NSObject subclass 585 ................................................................................ Section 110.2: Use of context for KVO Observation 586 ............................................................................................... Chapter 111: Initialization idioms 587 ........................................................................................................................ Section 111.1: Factory method with block 587 ................................................................................................................. Section 111.2: Set to tuples to avoid code repetition 587 .............................................................................................. Section 111.3: Initialize with positional constants 587 ..................................................................................................... Section 111.4: Initialize attributes in didSet 588 ............................................................................................................... Section 111.5: Group outlets in a custom NSObject 588 ................................................................................................ Section 111.6: Initialize with then 588 ................................................................................................................................ Chapter 112: Storyboard 590 ....................................................................................................................................... Section 112.1: Initialize 590 ................................................................................................................................................ Section 112.2: Fetch Initial ViewController 590 ............................................................................................................... Section 112.3: Fetch ViewController 590 ......................................................................................................................... Chapter 113: Background Modes and Events 591 .............................................................................................. Section 113.1: Play Audio in Background 591 .................................................................................................................. Chapter 114: Fastlane 593 ............................................................................................................................................. Section 114.1: fastlane tools 593 ....................................................................................................................................... Chapter 115: CAShapeLayer 594 ................................................................................................................................ Section 115.1: Draw Rectangle 594 .................................................................................................................................. Section 115.2: Draw Circle 594 ......................................................................................................................................... Section 115.3: CAShapeLayer Animation 595 .................................................................................................................
📄 Page
14
Section 115.4: Basic CAShapeLayer Operation 596 ....................................................................................................... Chapter 116: WKWebView 600 ..................................................................................................................................... Section 116.1: Adding custom user script loaded from app bundle 600 ...................................................................... Section 116.2: Send messages from JavaScript and Handle them on the native side 600 ....................................... Section 116.3: Creating a Simple WebBrowser 601 ....................................................................................................... Chapter 117: UUID (Universally Unique Identifier) 609 .................................................................................... Section 117.1: Apple's IFA vs. IFV (Apple Identifier for Advertisers vs. Identifier for Vendors) 609 ............................ Section 117.2: Create UUID String for iOS devices 609 .................................................................................................. Section 117.3: Generating UUID 609 ................................................................................................................................ Section 117.4: Identifier for vendor 610 ........................................................................................................................... Chapter 118: Categories 611 ......................................................................................................................................... Section 118.1: Create a Category 611 .............................................................................................................................. Chapter 119: Handling URL Schemes 614 ............................................................................................................... Section 119.1: Using built-in URL scheme to open Mail app 614 ................................................................................... Section 119.2: Apple URL Schemes 614 .......................................................................................................................... Chapter 120: Realm 617 ................................................................................................................................................. Section 120.1: RLMObject Base Model Class with Primary Key - Objective-C 617 .................................................... Chapter 121: ARC (Automatic Reference Counting) 618 ................................................................................. Section 121.1: Enable/Disable ARC on a file 618 ............................................................................................................ Chapter 122: Dynamic Type 619 ................................................................................................................................. Section 122.1: Matching Dynamic Type Font Size in WKWebView 619 ....................................................................... Section 122.2: Get the Current Content Size 620 ........................................................................................................... Section 122.3: Handling Preferred Text Size Change Without Notifications on iOS 10 620 ....................................... Section 122.4: Text Size Change Notification 620 .......................................................................................................... Chapter 123: SWRevealViewController 621 .......................................................................................................... Section 123.1: Setting up a basic app with SWRevealViewController 621 ................................................................... Chapter 124: DispatchGroup 624 ............................................................................................................................... Section 124.1: Introduction 624 ........................................................................................................................................ Chapter 125: GCD (Grand Central Dispatch) 627 ............................................................................................... Section 125.1: Dispatch Semaphore 627 ......................................................................................................................... Section 125.2: Dispatch Group 627 ................................................................................................................................. Section 125.3: Getting the Main Queue 628 .................................................................................................................... Section 125.4: Create a dispatch queue 629 .................................................................................................................. Section 125.5: Serial vs Concurrent Dispatch Queues 629 ........................................................................................... Chapter 126: Size Classes and Adaptivity 631 ..................................................................................................... Section 126.1: Trait Collections 631 ................................................................................................................................. Section 126.2: Updating Auto Layout with Trait Collection Changes 631 ................................................................... Section 126.3: Supporting iOS Multitasking on iPad 632 ............................................................................................... Chapter 127: IBOutlets 634 ............................................................................................................................................ Section 127.1: Using an IBOutlet in a UI Element 634 .................................................................................................... Chapter 128: AWS SDK 635 ............................................................................................................................................ Section 128.1: Upload an image or a video to S3 using AWS SDK 635 ....................................................................... Chapter 129: Debugging Crashes 638 ...................................................................................................................... Section 129.1: Debugging EXC_BAD_ACCESS 638 ........................................................................................................ Section 129.2: Finding information about a crash 639 ................................................................................................. Section 129.3: Debugging SIGABRT and EXC_BAD_INSTRUCTION crashes 640 ...................................................... Chapter 130: CloudKit 642 ............................................................................................................................................. Section 130.1: Registering app for use with CloudKit 642 .............................................................................................
📄 Page
15
Section 130.2: Using CloudKit Dashboard 642 ............................................................................................................... Section 130.3: Saving data to CloudKit 643 .................................................................................................................... Chapter 131: GameplayKit 644 .................................................................................................................................... Section 131.1: Generating random numbers 644 ............................................................................................................ Section 131.2: GKEntity and GKComponent 645 ............................................................................................................ Chapter 132: Xcode Build & Archive From Command Line 648 .................................................................. Section 132.1: Build & Archive 648 ................................................................................................................................... Chapter 133: XCTest framework - Unit Testing 649 ......................................................................................... Section 133.1: Adding Test Files to Xcode Project 649 ................................................................................................... Section 133.2: Adding test methods 650 ......................................................................................................................... Section 133.3: Writing a test class 651 ............................................................................................................................ Section 133.4: Adding Storyboard and View Controller as instances to test file 652 ................................................ Section 133.5: Import a module that it can be tested 652 ............................................................................................ Section 133.6: Trigger view loading and appearance 653 ............................................................................................ Section 133.7: Start Testing 653 ....................................................................................................................................... Chapter 134: AVPlayer and AVPlayerViewController 654 ............................................................................ Section 134.1: Playing Media using AVPlayer and AVPlayerLayer 654 ....................................................................... Section 134.2: Playing Media Using AVPlayerViewController 654 ............................................................................... Section 134.3: AVPlayer Example 654 ............................................................................................................................. Chapter 135: Deep Linking in iOS 656 ...................................................................................................................... Section 135.1: Adding a URL scheme to your own app 656 .......................................................................................... Section 135.2: Opening an app based on its URL scheme 657 .................................................................................... Section 135.3: Setting up deeplink for your app 658 ..................................................................................................... Chapter 136: Core Graphics 660 ................................................................................................................................. Section 136.1: Creating a Core Graphics Context 660 ................................................................................................... Section 136.2: Presenting the Drawn Canvas to User 660 ............................................................................................ Chapter 137: Segues 662 ................................................................................................................................................ Section 137.1: Using Segues to navigate backwards in the navigation stack 662 ..................................................... Section 137.2: An Overview 662 ....................................................................................................................................... Section 137.3: Preparing your view controller before a triggering a Segue 663 ........................................................ Section 137.4: Deciding if an invoked Segue should be performed 663 ..................................................................... Section 137.5: Trigger Segue Programmatically 663 .................................................................................................... Chapter 138: EventKit 665 ............................................................................................................................................. Section 138.1: Accessing dierent types of calendars 665 ........................................................................................... Section 138.2: Requesting Permission 665 ..................................................................................................................... Section 138.3: Adding an event 666 ................................................................................................................................ Chapter 139: SiriKit 668 ................................................................................................................................................... Section 139.1: Adding Siri Extension to App 668 ............................................................................................................. Chapter 140: Contacts Framework 670 ................................................................................................................. Section 140.1: Adding a Contact 670 ............................................................................................................................... Section 140.2: Authorizing Contact Access 670 ............................................................................................................. Section 140.3: Accessing Contacts 671 ........................................................................................................................... Chapter 141: iOS 10 Speech Recognition API 673 ............................................................................................... Section 141.1: Speech to text: Recognize speech from a bundle contained audio recording 673 ............................ Chapter 142: StoreKit 675 ............................................................................................................................................. Section 142.1: Get localized product information from the App Store 675 ................................................................. Chapter 143: Code signing 676 ................................................................................................................................... Section 143.1: Provisioning Profiles 676 ...........................................................................................................................
📄 Page
16
Chapter 144: Create .ipa File to upload on appstore with Applicationloader 677 .......................... Section 144.1: create .ipa file to upload app to appstore with Application Loader 677 ............................................. Chapter 145: Size Classes and Adaptivity 681 .................................................................................................... Section 145.1: Size Classes and Adaptivity through Storyboard 681 ........................................................................... Chapter 146: MKDistanceFormatter 687 ............................................................................................................... Section 146.1: String from distance 687 .......................................................................................................................... Section 146.2: Distance units 687 .................................................................................................................................... Section 146.3: Unit style 687 ............................................................................................................................................. Chapter 147: 3D Touch 689 ........................................................................................................................................... Section 147.1: 3D Touch with Swift 689 ............................................................................................................................ Section 147.2: 3 D Touch Objective-C Example 690 ...................................................................................................... Chapter 148: GameCenter Leaderboards 692 .................................................................................................... Section 148.1: GameCenter Leaderboards 692 .............................................................................................................. Chapter 149: Keychain 694 ........................................................................................................................................... Section 149.1: Adding a Password to the Keychain 694 ................................................................................................ Section 149.2: Keychain Access Control (TouchID with password fallback) 695 ....................................................... Section 149.3: Finding a Password in the Keychain 696 ............................................................................................... Section 149.4: Updating a Password in the Keychain 697 ............................................................................................ Section 149.5: Removing a Password from the Keychain 697 ..................................................................................... Section 149.6: Keychain Add, Update, Remove and Find operations using one file 698 .......................................... Chapter 150: Handle Multiple Environment using Macro 701 ..................................................................... Section 150.1: Handle multiple environment using multiple target and macro 701 .................................................. Chapter 151: Set View Background 716 .................................................................................................................. Section 151.1: Fill background Image of a UIView 716 ................................................................................................... Section 151.2: Creating a gradient background view 716 ............................................................................................. Section 151.3: Set View backround with image 716 ....................................................................................................... Section 151.4: Set View background 716 ........................................................................................................................ Chapter 152: Block 718 .................................................................................................................................................... Section 152.1: Custom completion block for Custom Methods 718 ............................................................................. Section 152.2: UIView Animations 718 ............................................................................................................................ Section 152.3: Modify captured variable 718 ................................................................................................................. Chapter 153: Content Hugging/Content Compression in Autolayout 720 ........................................... Section 153.1: Definition: Intrinsic Content Size 720 ....................................................................................................... Chapter 154: iOS Google Places API 721 ................................................................................................................ Section 154.1: Getting Nearby Places from Current Location 721 ............................................................................... Chapter 155: Navigation Bar 723 ............................................................................................................................... Section 155.1: SWIFT Example 723 .................................................................................................................................. Section 155.2: Customize default navigation bar appearance 723 ............................................................................. Chapter 156: App wide operations 724 ................................................................................................................... Section 156.1: Get the top most UIViewController 724 .................................................................................................. Section 156.2: Intercept System Events 724 ................................................................................................................... Chapter 157: CoreImage Filters 725 ......................................................................................................................... Section 157.1: Core Image Filter Example 725 ................................................................................................................ Chapter 158: Face Detection Using CoreImage/OpenCV 731 .................................................................... Section 158.1: Face and Feature Detection 731 ............................................................................................................. Chapter 159: MPMediaPickerDelegate 734 ........................................................................................................... Section 159.1: Load music with MPMediaPickerControllerDelegate and play it with AVAudioPlayer 734 ...............
📄 Page
17
Chapter 160: Graph (Coreplot) 736 ........................................................................................................................... Section 160.1: Making graphs with CorePlot 736 ........................................................................................................... Chapter 161: FCM Messaging in Swift 738 .............................................................................................................. Section 161.1: Initialize FCM in Swift 738 .......................................................................................................................... Chapter 162: Create a Custom framework in iOS 740 .................................................................................... Section 162.1: Create Framework in Swift 740 ............................................................................................................... Chapter 163: Custom Keyboard 741 ......................................................................................................................... Section 163.1: Custom KeyBoard Example 741 .............................................................................................................. Chapter 164: AirDrop 748 .............................................................................................................................................. Section 164.1: AirDrop 748 ................................................................................................................................................ Chapter 165: SLComposeViewController 749 ...................................................................................................... Section 165.1: SLComposeViewController for Twitter, facebook, SinaWelbo and TencentWelbo 749 .................... Chapter 166: AirPrint tutorial in iOS 751 ................................................................................................................. Section 166.1: AirPrint printing Banner Text 751 ............................................................................................................ Chapter 167: Carthage iOS Setup 753 ..................................................................................................................... Section 167.1: Carthage Installation Mac 753 ................................................................................................................. Chapter 168: Healthkit 754 ............................................................................................................................................ Section 168.1: HealthKit 754 ............................................................................................................................................. Chapter 169: Core SpotLight in iOS 757 .................................................................................................................. Section 169.1: Core-Spotlight 757 .................................................................................................................................... Chapter 170: Core Motion 759 ..................................................................................................................................... Section 170.1: Accessing Barometer to get relative altitude 759 ................................................................................. Chapter 171: QR Code Scanner 760 ........................................................................................................................... Section 171.1: Scanning QR code with AVFoudation framework 760 ........................................................................... Section 171.2: UIViewController scanning for QR and displaying video input 761 ..................................................... Chapter 172: plist iOS 763 .............................................................................................................................................. Section 172.1: Example: 763 .............................................................................................................................................. Section 172.2: Save and edit/delete data from Plist 765 .............................................................................................. Chapter 173: WCSessionDelegate 767 ..................................................................................................................... Section 173.1: Watch kit controller (WKInterfaceController) 767 ................................................................................. Chapter 174: AppDelegate 768 ................................................................................................................................... Section 174.1: All States of Application through AppDelegate methods 768 .............................................................. Section 174.2: AppDelegate Roles: 769 ........................................................................................................................... Section 174.3: Opening a URL-Specified Resource 769 ................................................................................................ Section 174.4: Handling Local and Remote Notifications 769 ...................................................................................... Chapter 175: App Submission Process 771 ........................................................................................................... Section 175.1: Setup provisioning profiles 771 ................................................................................................................ Section 175.2: Archive the code 771 ................................................................................................................................ Section 175.3: Export IPA file 771 ..................................................................................................................................... Section 175.4: Upload IPA file using Application Loader 772 ....................................................................................... Chapter 176: FileHandle 774 ......................................................................................................................................... Section 176.1: Read file from document directory in chunks 774 ................................................................................ Chapter 177: Basic text file I/O 776 .......................................................................................................................... Section 177.1: Read and write from Documents folder 776 .......................................................................................... Chapter 178: iOS TTS 778 ............................................................................................................................................... Section 178.1: Text To Speech 778 ................................................................................................................................... Chapter 179: MPVolumeView 779 ..............................................................................................................................
📄 Page
18
Section 179.1: Adding a MPVolumeView 779 .................................................................................................................. Chapter 180: Objective-C Associated Objects 780 ............................................................................................ Section 180.1: Basic Associated Object Example 780 .................................................................................................... Chapter 181: Passing Data between View Controllers (with MessageBox-Concept) 781 .............. Section 181.1: Simple Example Usage 781 ...................................................................................................................... Chapter 182: MVVM 782 .................................................................................................................................................. Section 182.1: MVVM Without Reactive Programming 782 .......................................................................................... Chapter 183: Cache online images 785 ................................................................................................................... Section 183.1: AlamofireImage 785 ................................................................................................................................. Chapter 184: Chain Blocks in a Queue (with MKBlockQueue) 786 ............................................................ Section 184.1: Example Code 786 .................................................................................................................................... Chapter 185: Simulator 788 .......................................................................................................................................... Section 185.1: Launching Simulator 788 .......................................................................................................................... Section 185.2: 3D / Force Touch simulation 788 ........................................................................................................... Section 185.3: Change Device Model 789 ....................................................................................................................... Section 185.4: Navigating Simulator 790 ........................................................................................................................ Chapter 186: Background Modes 791 ...................................................................................................................... Section 186.1: Turning on the Background Modes capability 791 ............................................................................... Section 186.2: Background Fetch 791 ............................................................................................................................. Section 186.3: Testing background fetch 792 ................................................................................................................ Section 186.4: Background Audio 794 ............................................................................................................................ Chapter 187: OpenGL 795 .............................................................................................................................................. Section 187.1: Example Project 795 ................................................................................................................................. Chapter 188: MVP Architecture 796 .......................................................................................................................... Section 188.1: Dog.swift 797 ............................................................................................................................................. Section 188.2: DoggyService.swift 797 ........................................................................................................................... Section 188.3: DoggyPresenter.swift 797 ....................................................................................................................... Section 188.4: DoggyView.swift 798 ................................................................................................................................ Section 188.5: DoggyListViewController.swift 798 ......................................................................................................... Chapter 189: Configure Beacons with CoreBluetooth 800 ............................................................................ Section 189.1: Showing names of all Bluetooth Low Energy (BLE) 800 ....................................................................... Section 189.2: Connect and read major value 801 ....................................................................................................... Section 189.3: Write major value 802 .............................................................................................................................. Chapter 190: Core Data 804 ......................................................................................................................................... Section 190.1: Operations on core data 804 ................................................................................................................... Chapter 191: Profile with Instruments 805 ............................................................................................................. Section 191.1: Time Profiler 805 ........................................................................................................................................ Chapter 192: Application rating/review request 814 ...................................................................................... Section 192.1: Rate/Review iOS Application 814 ............................................................................................................ Chapter 193: MyLayout 815 .......................................................................................................................................... Section 193.1: A Simple Demo to use MyLayout 815 ..................................................................................................... Chapter 194: Simulator Builds 817 ............................................................................................................................ Section 194.1: Installing the build manually on simulator 817 ...................................................................................... Chapter 195: Simulating Location Using GPX files iOS 818 .......................................................................... Section 195.1: Your .gpx file: MPS_HQ.gpx 818 ............................................................................................................... Section 195.2: To set this location: 818 ........................................................................................................................... Chapter 196: SqlCipher integration 820 ..................................................................................................................
📄 Page
19
Section 196.1: Integration of code: 820 ........................................................................................................................... Chapter 197: Security 821 .............................................................................................................................................. Section 197.1: Securing Data in iTunes Backups 821 ..................................................................................................... Section 197.2: Transport Security using SSL 822 ........................................................................................................... Chapter 198: App Transport Security (ATS) 824 ................................................................................................ Section 198.1: Load all HTTP content 824 ....................................................................................................................... Section 198.2: Selectively load HTTP content 824 ......................................................................................................... Section 198.3: Endpoints require SSL 825 ....................................................................................................................... Chapter 199: Guideline to choose best iOS Architecture Patterns 826 .................................................. Section 199.1: MVP Patterns 826 ...................................................................................................................................... Section 199.2: MVVM Pattern 827 ................................................................................................................................... Section 199.3: VIPER Pattern 828 .................................................................................................................................... Section 199.4: MVC pattern 829 ....................................................................................................................................... Chapter 200: Multicast Delegates 830 ................................................................................................................... Section 200.1: Multicast delegates for any controls 830 .............................................................................................. Chapter 201: Using Image Aseets 834 ..................................................................................................................... Section 201.1: LaunchImage using Image Assets 834 ................................................................................................... Section 201.2: App Icon using Image Assets 837 .......................................................................................................... Chapter 202: Runtime in Objective-C 842 ............................................................................................................. Section 202.1: Using Associated Objects 842 ................................................................................................................ Chapter 203: ModelPresentationStyles 844 ......................................................................................................... Section 203.1: Exploring ModalPresentationStyle using Interface Builder 844 .......................................................... Chapter 204: CydiaSubstrate tweak 853 .............................................................................................................. Section 204.1: Create new tweak using Theos 853 ....................................................................................................... Chapter 205: Create a video from images 855 .................................................................................................. Section 205.1: Create Video from UIImages 855 ........................................................................................................... Chapter 206: Codable 857 ............................................................................................................................................. Section 206.1: Use of Codable with JSONEncoder and JSONDecoder in Swift 4 857 ............................................... Chapter 207: Load images async 859 ..................................................................................................................... Section 207.1: Easiest way 859 ........................................................................................................................................ Section 207.2: Check that the cell is still visible after download 859 .......................................................................... Chapter 208: Adding a Swift Bridging Header 860 .......................................................................................... Section 208.1: How to create a Swift Bridging Header Manually 860 ......................................................................... Section 208.2: Xcode create automatically 860 ............................................................................................................ Chapter 209: Creating an App ID 862 ...................................................................................................................... Section 209.1: Creating In-App Purchase Products 862 ............................................................................................... Section 209.2: Creating a Sandbox User 864 ................................................................................................................ Chapter 210: Swift: Changing the rootViewController in AppDelegate to present main or login/onboarding flow 865 ........................................................................................................................................... Section 210.1: Option 1: Swap the Root View Controller (Good) 865 ............................................................................ Section 210.2: Option 2: Present Alternative Flow Modally (Better) 865 ..................................................................... Credits 867 ............................................................................................................................................................................ You may also like 874 ......................................................................................................................................................
📄 Page
20
GoalKicker.com – iOS® Developer Notes for Professionals 1 About Please feel free to share this PDF with anyone for free, latest version of this book can be downloaded from: https://goalkicker.com/iOSBook This iOS® Developer Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA, see credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified This is an unofficial free book created for educational purposes and is not affiliated with official iOS® Developer group(s) or company(s) nor Stack Overflow. All trademarks and registered trademarks are the property of their respective company owners The information presented in this book is not guaranteed to be correct nor accurate, use at your own risk Please send feedback and corrections to web@petercv.com
The above is a preview of the first 20 pages. Register to read the complete e-book.