Guru's writing
  • Guru's blogging
  • Welcome!
  • NEW RELEASE!
  • Books
  • Ten Twisted Tales
  • Boogadooga Stories for Children
  • Letting go of Ganapathy
  • How to create your e-commerce website in a day
  • All My Apps
  • Ramana Nool Thirattu Urai
  • Ramana Stuthi Panchakam
  • Ramana Maharishi Translated
  • Bob Dylan and Kannadasan
  • RamanaMaharishiApp
  • MahaPeriyava
  • SingaporeDrivingQuiz
  • Advaita Masters
  • Ramana Maharishi Android App
  • GlucoTrak
  • gurucodes
  • IAMGRATEFUL

Swift and iOS with Udacity, part II.

30/10/2015

0 Comments

 
Things got more interesting in this segment. In section 3a, we learnt to navigate between screens, add more buttons and actions and some hardcore stuff I couldn't manage on my own like converting string to url among others, but the instructor (a cheerful guy named Kunal) addressed those issues in the next video. To break it down, here's what we learned:
First, we added a navigation control by embedding it from the drop down menu, created a second interface controller, and created a new  Cocoa Touch class file and named it playSoundsViewController and connected it from the Record button on the main screen. So that when you click on the record button it takes you to the next screen. [NOTE: Make sure you name the file properly or it won't let y ou drag outlets or actions. Once you create a new screen and file, click on the new screen and go to the Identity Inspector and type in the new file's name, it will auto fill.]
Then we learnt how to add an mp3 file to the project and access using AV Foundation. We created a path to the audio file in the viewDidLoad section by creating a var filepath and using NSBundle with its subclass mainBundle. 
We created an instance of the AVAudio player and converted NSString to NSUrl.
We added two buttons, playfast and playslow and connected them to the interface so they play the embedded audio file at the corresponding speeds by using the rate method in the AVAudioPlayer class.
We make sure the file, when accessed either plays the mp3 or returns an error message if the entry is invalid. Also, we need to have the variable audioPlayer needs to be a global variable so it can be accessed from other functions. [NOTE: I was redoing the lesson so I could take down all the steps, and was stuck on this error I didn't get before 'EXC_BAD_INSTRUCTION code=EXC_1386_INVOP'. Spent over an hour fixing this, then while comparing to the earlier working code, realised I had put - instead of _ in the mp3 file name. So in case you get that error, it could be this.]
We are supposed to take the common pieces of code and create a new function butI'm not sure where to add the function to, so I'll see if that gets addressed in the next lesson. 
0 Comments

    Author

    This is a chronicle of my journey into coding. I'll post where I am at on the road to learning Ruby with One month Rails and HTML/CSS with Teamtreehouse, and Python which I'm learning on my own. Ambitious for a writer? You bet!

    Archives

    October 2017
    October 2015
    May 2015
    December 2014
    November 2014
    September 2014
    August 2014
    July 2014

    Categories

    All
    Amazon S3
    Amazon Web Services
    AWS Keys
    Beginner Ruby
    Beginner's Ruby
    Beginning Ruby
    Codecademy
    Coding
    Css
    Github
    Gurucodes
    Guruswriting
    Html
    IOS9
    Novice Coding Journey
    Onemonth Rails
    Pragmatic Studio
    Python
    Rails
    Rails5
    Rails 5.0
    Ruby
    Ruby Newbie
    Ruby On Rails
    Ruby Prgramming
    Ruby Programming
    Shor Stories Guru
    Shorstories Guru
    Shortstories Guru
    Swift
    Tealeaf Academy
    Tealeaf Acdemy Ruby
    Teamtreehouse
    Treehouse
    Udacity
    Udemy

    RSS Feed

My other sites:  Music is about memories: http://radiomemories.blogspot.com, http://radiomemories.weebly.com/
A site dedicated to the genius of Kannadasan:http://kannadasansongs.blogspot.com 
 A travel blog: http://guruwanders.blogspot.com