Xcode – convert iPhone storyboard to iPad storyboard

How to convert an iPhone storyboard into an iPad storyboard:

Also see this answer — to convert an iPhone storyboard to an iPad storyboard, do the following:

  1. From Xcode, right-click on the storyboard and choose Open As → Source code
  2. Search for targetRuntime=”iOS.CocoaTouch” and change it to targetRuntime=”iOS.CocoaTouch.iPad”
  3. Right-click on the storyboard again and choose Open As → iOS Storyboard

The storyboard will now show all views in the correct size.

XCode – Rename Scheme

You need to click on the scheme button, then hit “Manage Schemes”. Once you do so, you’ll have a window like this:

enter image description here

Select the scheme you want to change, and hit Return.

Now the scheme name will be editable, and you can change it to your hearts desire. Then hit Return again to save it.

UIAlertView – creating and detecting button tap

Declare the UIAlertView delegate in the yourViewController.h:

 

Create the alertView:

 

Detect which alertView button was tapped:

 

UIBarButtonItem – setting retina display and non-retina display toolBar icons

I can never remember how to handle retina display images versus non-retina display images in the toolbar so here’s a reminder:

Add the 2 files to your project:

Then call it the same way on all screen densities:

UIImage will determine the right one to use. If using Interface Builder, point to the image.png and not the @2x image.

UIActivityIndicatorView – add activity indicator to navigation bar

Add an activity indicator as shown here:

Remove the spinner and stop animating: