Month: October 2015

Is there any way to change app layout from LTR into RTL programmatically

October 24, 2015

Hi, I’m developing an application with localization (English & Arabic), and the requirements is that user can select language at the start of the app rather than device own language selection. Currently I’m following two different storyboards …

Read More

Xcode 7.1 crashes when opening Organizer (Dispatch queue: Cache and App Store Product Source Lock)

October 21, 2015

I just installed Xcode 7.1 GM and OS X 10.11.1. When I tried to archive one of my projects to submit it to the App Store, it crashed upon finishing the archive right as the Organizer window was opening. Now I can’t open the Organizer window at all. The…

Read More

FoodTracker Tutorial – Tap Gesture

October 14, 2015

So I’m having issues with the tap gesture for the “Work with View Controllers” section of the tutorial.  I’m not getting the image picker to show up when i sumlate or run the app on an iPhone.  I think the code is right, because its nearly identical to the sample.  I’ve also rebuilt the app from the beginning of that section 4 or 5 times.  I’m pretty sure the @IBOutlet and @IBAction are correctly connected because they have the filled grey circles next to them, but for some reason it won’t work.  However, I can correctly run the sample.  Can anyone think of some issues that might be throwing me off?


import UIKit
class ViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

     // MARK: Properties

    @IBOutlet weak var nameTextField: UITextField!
    @IBOutlet weak var mealNameLabel: UILabel!
    @IBOutlet weak var photoImageView: UIImageView!

    override func viewDidLoad() {

        // Handle the text field’s user input through delegate callbacks.
          nameTextField.delegate = self

// MARK: UITextFieldDelegate
    func textFieldShouldReturn(textField: UITextField) -> Bool {

          // Hide the keyboard.

        return true

    func textFieldDidEndEditing(textField: UITextField) {
        mealNameLabel.text = textField.text

    // MARK: UIImagePickerControllerDelegate
    func imagePickerControllerDidCancel(picker: UIImagePickerController) {
          // Dismiss the picker if the user canceled.
           dismissViewControllerAnimated(true, completion: nil)

    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {

          // The info dictionary contains multiple representations of the image, and this uses the original.
          let selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
          // Set photoImageView to display the selected image.
           photoImageView.image = selectedImage
          // Dismiss the picker.
          dismissViewControllerAnimated(true, completion: nil)

     // MARK: Actions
     @IBAction func selectImageFromPhotoLibrary(sender: UITapGestureRecognizer) {

          // Hide the keyboard.
          // UIImagePickerController is a view controller that lets a user pick media from their photo library.
          let imagePickerController = UIImagePickerController()
          // Only allow photos to be picked, not taken.
          imagePickerController.sourceType = .PhotoLibrary
          // Make sure ViewController is notified when the user picks an image.
          imagePickerController.delegate = self
          presentViewController(imagePickerController, animated: true, completion: nil)

    @IBAction func setDefaultLabelText(sender: UIButton) {
        mealNameLabel.text = "Default Text"


Read More