O'Reilly logo

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

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

Start Free Trial

No credit card required

Xamarin Mobile Application Development for iOS

Book Description

If you want to develop iOS apps with Xamarin, and this comprehensive tutorial has it all. Covering everything from the UI to using TestFlight, it’s your fast route to the App Store.

  • A clear and concise look at how to create your own apps building on what you already know of C#
  • Create advanced and elegant apps by yourself
  • Ensure that the majority of your code can also be used with Android and Windows Mobile 8 devices

In Detail

Before the release of monotouch, development on iOS was purely in Objective C. There was nothing wrong with that except for one thing – it’s very unpleasant to write code in! The release of Xamarin changed all of that, and with it brought cross-platform development to the mobile world.

Xamarin Mobile Application Development for iOS is not just your normal everyday book on iOS app development. Everything is written for a point and not for effect, and therefore you will learn everything you need to know quickly and efficiently without getting bogged down in needless information. The code has been taken from fully tested apps, so you can just drop it into your code and it will work out of the box.

In this clear and informative guide, you will be taken on a whirlwind tour of iOS application development with Xamarin, from setting up a development environment on your PC or Mac to testing and distribution through the Apple Store with plenty of practical examples along the way.

The book begins by discussing the installation of the IDE (for both PC and Mac) as well as how to set up your PC so it can be used to develop for iOS. From there, successive chapters cover the user interface, views, view controllers, customisation of controls, animation, events and event handling, getting the most from your app using threading, creating your own settings system, the internal database system and LINQ, sending texts, making calls, taking photos, videos, and audio recordings as well as using the mapping system. The book culminates by showing you how to test your app using testflight and finally how to release your app on the Apple Store. It is an all-encompassing book that leaves nothing out.

Table of Contents

  1. Xamarin Mobile Application Development for iOS
    1. Table of Contents
    2. Xamarin Mobile Application Development for iOS
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Installing the Xamarin Product Range for Android and iOS
      1. Installing Xamarin.iOS and Xamarin.Android
        1. Downloading the software
        2. Installing the software
      2. Enabling Visual Studio to build and run iOS applications
        1. On the Mac
        2. On the PC
      3. Installing additional code for Android development
        1. For iOS users
      4. Summary
    10. 2. The User Interface
      1. Creating the User Interface with Xcode
        1. Screen origins and sizes
      2. MonoTouch.Dialog (MT.D)
        1. Changing the keyboard type
          1. Using ShouldReturn
          2. Using ResignFirstResponder
          3. Adding a toolbar to the keyboard
            1. For an MT.D
            2. For a standard UITextField
        2. Creating your own Pickers on MT.D
        3. UITableView and UITableViewCell
        4. Colors, buttons, and labels
          1. Ensuring you have the correct size bounding boxes
          2. UIColor
          3. UIButton
          4. UIControlStates
      3. Summary
    11. 3. Views and Layouts
      1. Selection of the project type
        1. Application types and their view types
      2. The iOS layout
        1. The Canvas model
        2. How to avoid some of these problems
      3. Views and View Controllers
        1. Other Views
          1. Activity Indicator and Progress View
          2. UIImageView
          3. UICollectionView
            1. Cells
            2. Supplementary Views
            3. Decoration View
            4. Data source
            5. Cell Reuse
          4. UIWebView
          5. MapView
          6. UIScrollView
          7. AdBannerView
        2. Implementing a view with multiple View Controllers
      4. Summary
    12. 4. Controllers
      1. UITableView and UITableViewCell
        1. Creating a read-only table
        2. UITableViewCell
          1. Reusable cells within a table
          2. Sections and Rows
          3. Indexes on a TableView
        3. Navigation with UITableView
          1. Within code
          2. With Xcode
        4. Navigation using UITableView
          1. Returning to the RootView
      2. TabBars
        1. Handling the Tab Bar in code
      3. PageControl
      4. GLKit
      5. Summary
    13. 5. UI Controls
      1. Controls and widgets
      2. UI Controls
        1. Control selection
          1. UIButton
        2. UIStepper
        3. The other controls
      3. Comparing Android to iOS UI controls
      4. Summary
    14. 6. Events
      1. Handling events
        1. Delegates
          1. Attaching an event to multiple controls
        2. Synchronous versus asynchronous event handling
          1. Synchronous walk
          2. Asynchronous walk
          3. In a programming context
      2. Events and controls reference
        1. Other significant control events
          1. AVAudioPlayer and AVRecordClass
          2. AVAudioSession
          3. ABAddressBook
          4. ABNewPersonViewController
          5. ABPeoplePickerNavigationController
          6. ABPersonViewController
          7. ABUnknownPersonViewController
          8. AudioConverter
          9. AudioSession
          10. InputAudioQueue
          11. OutputAudioQueue
          12. AUGraph and AudioUnit
          13. AudioConverter
          14. CAAnimation
          15. CBCentralManager
          16. CBPeripheral
          17. CBPeripheralManager
          18. CFSocket
          19. CFStream
          20. CLLocationManager
          21. MidiClient
          22. MidiEndpoint and MidiPort
          23. Monotouch.Dialog
          24. BadgeElement, BaseBooleanImageElement, GlassButton, LoadMoreElement, MessageElement, and StringElement
          25. BoolElement
          26. DateTimeElement
          27. DialogViewController
          28. EntryElement
          29. StyledStringElement
          30. EKCalendarChooser
          31. EKEventEditViewController and EKEventViewController
          32. EAAccessory
        2. The NS classes
          1. NSCache
          2. NSKeyedArchiver
          3. NSKeyedUnarchiver
          4. NSNetService
          5. NSNetServiceBrowser
          6. NSStream
          7. GLKView
          8. GK classes
          9. GKAchievementViewController, GKFriendRequestComposeViewController, and GKLeaderboardViewController
          10. GKGameCenterViewController
          11. GKMatch
          12. GKMatchmakerViewController
          13. GKSession
          14. MKMapView
          15. MPMediaPickerController
          16. MFMailComposeViewController and MFMessageComposeViewController
          17. PKAddPassesViewController
          18. QLPreviewController
        3. SK classes
          1. SKProductsRequest
          2. SKRequest
          3. SKStoreProductViewController
        4. UIClasses
          1. UIAccelerometer
          2. UIActionSheet and UIAlertView
          3. UIButtonBarItem
          4. UIImagePickerController
          5. UIPageViewController
          6. UIPopoverController
          7. UIPrintInteractionController
          8. UIScrollView
          9. UISearchBar
          10. UISplitViewController
          11. UITabBar
          12. UITabBarController
          13. UITextField
          14. UITextView
          15. UIView
          16. UIWebView
        5. Ad classes
          1. AdBannerView
          2. AdInterstitialAd
          3. OpenTK
          4. IGameWindow
          5. IPhoneOSGameView
        6. Summary
    15. 7. Gestures
      1. Gestures
        1. Gesture code
        2. Types
        3. Adding a gesture in code
        4. Continuous types
          1. Other UIGestureRecognizerState values
      2. Handling drag-and-drop
      3. Summary
    16. 8. Threading
      1. Threading Concepts
      2. The main UI thread
        1. Deadlocking
        2. Avoiding deadlocks for synchronized accessors
      3. Starting a new thread from the main UI thread
        1. Using locks
      4. The AppDelegate class
      5. Summary
    17. 9. Threading Tasks
      1. A brief introduction to threading
        1. Using background threading within your app
          1. BackgroundWorker
          2. ThreadPool.QueueUserWorkItem
        2. Using System.Threading.Tasks
        3. Problems while using Tasks on threads
      2. Using Asynchronous code
        1. Tasks and EventHandlers
        2. A more practical example
      3. Summary
    18. 10. Animation
      1. Handling bitmaps
        1. Scaling the image
        2. Rotating the image – Part 1
          1. Underpinning bindings
        3. Analysis of the code
      2. Freeing memory after use
        1. Rotating the image – Part 2
      3. Summary
    19. 11. Handling Data
      1. Using SQLite
        1. Installing and setting up SQLite
        2. Database basics
          1. A simple database class
          2. Create a connection to the database
      2. Setting up an SQLite helper class
        1. Writing helper class methods
        2. Adding data to the database
      3. Data manipulation using LINQ
        1. LINQ – a whistle-stop tour
          1. SELECT and WHERE in LINQ – a common cause of confusion
          2. Using Select in LINQ
          3. Replacing SQL with LINQ
      4. Summary
    20. 12. Peripherals
      1. Using the camera
        1. Accessing the camera (Xamarin.Mobile)
        2. Accessing the camera (Native)
        3. Saving to the Photo album (Native)
      2. GPS and Mapping
        1. GPS with Xamarin.Mobile
          1. Calculating your speed
        2. Using Core Location
          1. Setting up Core Location and delegate
          2. Finding where the user is
          3. Adding a map
          4. Adding a pin
      3. Storage on the phone
      4. Making a phone call
      5. Sending and receiving a text message
      6. Accessing the Internet
      7. Multimedia
        1. Playing a video
          1. External URL
          2. Internal source
          3. From the photo library
        2. Recording a video
          1. To record a video
          2. Saving the video
        3. The audio system
          1. Playback
            1. Short files
            2. Long (and compressed) files
            3. Setting the power levels
            4. Playing the audio file
            5. Altering the volume
        4. Recording Audio
          1. Setting up the audio NSDictionary
            1. Setting up to record
            2. Recording the audio file
      8. Summary
    21. 13. User Preferences
      1. The built-in system
        1. Reading and writing to the .plist file
      2. Rolling your own settings system
        1. Serializing and deserializing data
        2. Setting up the Settings file
          1. The handler class
            1. Adding an accessor
          2. The data class
      3. Summary
    22. 14. Testing and Publishing
      1. Provisioning and signing your app
      2. TestFlight
        1. Provisioning
          1. Registering the app
          2. Creating the developer profile
          3. Creating your certificate
          4. Back to registering your app
          5. Enabling TestFlight within Xamarin Studio
        2. Registering on TestFlight
        3. Inviting and registering devices
        4. Building to TestFlight
        5. Releasing your app
          1. App checklist
          2. Icon sizes
      3. Preparing to package
        1. Packaging your app
        2. Creating the build configuration
      4. The App Store Submission Process
        1. Creating an archive
        2. Submission via Xcode
        3. The submission wizard
      5. Summary
    23. Index