Coding Explorer Blog

Exploring how to code for iOS in Swift and Objective-C

  • Home
  • Apps
  • About
  • Contact

Segue from UITableViewCell Taps in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

In many apps that use a UITableView, when a UITableViewCell is tapped, the screen will segue over to another view, such as how choosing a song in the Music app goes to the Now Playing screen, and plays that song, shows the album art, and other metadata about the song.  This can be done programmatically in tableView:didSelectRowAtIndexPath:, but with Storyboards, it is even easier.  All we have to do is set up a segue, and treat it pretty much exactly like we did in Segue between Swift View Controllers.

To avoid an even longer setup section, and to not cover things we already covered, we’re going to start with the result of the previous post Getting Started With UITableView in Swift.

Anyway, starting from where we left off, let’s set up the storyboard.
[Read more…]

Filed Under: Tutorial Tagged With: optionals, properties, Swift

How to Dismiss UITextField’s Keyboard in your Swift App

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

If you need to take text input in your Swift app, you will probably need a UITextField.  It is exactly what it sounds like, just a field on the screen where the user types something in.  When the user taps on it, the keyboard comes up from the bottom of the screen, and allows the user to start typing.  Then, usually, when the user clicks outside of the UITextField, the keyboard is dismissed, and the cursor is no longer in that UITextField.

However, a common issue for many iOS programming beginners is that the last part of that story isn’t built in.  If you just plop on a UITextField, and try tapping somewhere else…. nothing happens.  That’s what we’re here to fix today.
[Read more…]

Filed Under: Tutorial Tagged With: Swift

Getting Started With UITableView in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

One of the most common Views used in iOS apps is the UITableView.  In the default iPhone apps alone, the only ones that I didn’t easily find what is PROBABLY a UITableView was in Newsstand, Videos, Camera, and the Calculator.  Even then, the first two of those appear to use UITableView’s close cousin UICollectionView.  With the exception of the Settings app itself, I wasn’t even counting their settings pages (which probably all of them have, and show up as a UITableView either in their own app or via the Settings app).

You probably want to know how to use such an important view?  There is too much to go into all of it today, but let’s start out with how to get one working and fill it with data.
[Read more…]

Filed Under: Tutorial Tagged With: optionals, Swift

How to Create a UIColor in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

There comes a time in many iOS developers’s careers that they will need to save a reference to a color itself.  Maybe it is just to change the background color of a view, maybe it is for custom drawing, or any number of other reasons.

This is where UIColor comes in.  UIColor is particularly optimized to work on iOS devices, so while there are older similar classes like CGColor or CIColor, you should probably use UIColor, unless you are working on some app that needs to translate between different colorspaces.
[Read more…]

Filed Under: Class Reference Tagged With: Swift

Segue between Swift View Controllers

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

So, last time we learned how to make a simple Hello World app on a single view controller.  As fancy as it was, you probably want more than one screen in your app, right?

Perhaps you want a way to segue into the next screen?

That’s what we’re going to go over today, as well as one of the simple ways to share data between view controllers.
[Read more…]

Filed Under: Tutorial Tagged With: Access Controls, optionals, properties, Swift

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page »

Subscribe to the Coding Explorer Newsletter

* indicates required

Follow Us

Facebooktwitterrss

Recent Posts

  • Error Handling in Swift
  • Creating and Modifying a URL in your Swift App
  • Watch Connectivity in Swift — Application Context
  • watchOS Hello World App in Swift
  • API Availability Checking in Swift

Categories

  • Class Reference
  • General
  • Interface Builder
  • My Apps
  • Objective-C
  • Swift
  • Syntax
  • Tutorial
  • Uncategorized

Archives

  • May 2016
  • March 2016
  • February 2016
  • December 2015
  • July 2015
  • June 2015
  • April 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013
  • July 2013
  • Terms Of Use
  • Privacy Policy
  • Affiliate Disclaimer

Subscribe to the Coding Explorer Newsletter

* indicates required

Copyright © 2025 Wayne Media LLC · Powered by Genesis Framework · WordPress