How To Make an App – Ep 12 – Randomizing the cards

[ad_1]
How To Make iPhone Apps with NO Programming Experience!
Lesson 12: Randomizing the cards
In this lesson, we learn how to produce random numbers and change the card images when the button is tapped!

This video series uses the latest and greatest from Apple (Xcode 6, Swift, iOS 8) and will teach a beginner with no programming experience how to make iPhone apps. I’m creating these videos with the assumption that the student has no prior knowledge and is starting from scratch.

The lesson plan for the How To Make an App series can be found on my site here:

For more tutorials on how to build iPhone apps, make sure you subscribe and visit my site where you’ll find a community of like minded learners! Learning something new is always more fun with other people!

Youtube:
Website:
Facebook:
Twitter:

CodeWIthChris is dedicated to teaching beginners and non-programmers all about building iOS apps. On the site, you’ll find a ton of free resources and tutorials to aid you on your journey to learn iOS development. Many people have successfully picked up Swift, Objective-C, Xcode and app building from my course and materials!

Intro & Outro music
“Heartbreaker” by Jahzzar (


Posted

in

by

Tags:

Comments

22 responses to “How To Make an App – Ep 12 – Randomizing the cards”

  1. michel garlandat Avatar

    i don't succeed to get the files of the cards i get only .ai .eps .svg
    thanks for your answer

  2. ptrchovan Avatar

    Hi Chris. How do you know witch function to chose. Is there any function reference documentation with ability to search for one. For example if I wouldn't see this video then how would I find the arc4random_uniform function for random number? I didn't even find it in UIKIT when search for "random" so where to look for a function?

  3. kenneth Pon Avatar

    I follow the steps but I got this warning
    Initialization of immutable value ‘RandomNo’ was never used; consider replacing with assignment to ‘_’ or removing it.
    Thanks Chris.

  4. kenneth Pon Avatar

    Where's the image from ImageView came from?.

  5. UglyTV Avatar

    good tutorial , how do we get it to not repeat the same number

  6. FBlakey Gaming Avatar

    I used your tutorial but 4 5 images. But my app does not show all the cards do u know y?:D

  7. Darji Dhruvil Avatar

    First of all thanks for your great lessons.
    I use xcode 7 and even if I write the same codes as yours I get errors. for example, when you enter a new variable under the @IBAction for button, such as firstRandomNumber then the randomizer code, it works well for you but when I try the same thing, it gives me error saying "variable 'firstRandomNumber' was never mutated; consider changing it to 'let' constant."
    Can you help plz?

  8. Mustafa Shams Avatar

    First of all thanks for your great lessons.
    I use xcode 7 and even if I write the same codes as yours I get errors. for example, when you enter a new variable under the @IBAction for button, such as firstRandomNumber then the randomizer code, it works well for you but when I try the same thing, it gives me error saying "variable 'firstRandomNumber' was never mutated; consider changing it to 'let' constant."
    Can you help plz?

  9. Fernando Rocha Avatar

    in a previous video (Episode 10, minute 6) you said that in a method call, the first parameter should not have the label, and the following ones should. Now u said the oposite (3:50). I'm confused..

  10. Irra Foxy Avatar

    Hey Chris, why do I only see a green background when I run the application? In my main story board I can see everything though.

  11. Ibrahim Omer Avatar

    Learned methods from your lessons and used this for randomizing cards 
    func Randmo ()->String{
            
            let CardNum = arc4random_uniform(13) + 1
            let CardSelect:String = String  (format: "Card%i", CardNum)
            return CardSelect
        }

  12. Blake Schreiner Avatar

    My backgroundImageView does have the circle next to it but it is not filled in for some reason…this is resulting in "signal SIGABRT"…debug->network->thread 1..any help would be great.

    Thanks!

  13. amal khalid Avatar

    You are a great teacher
    thanks alot

  14. Hugo - Avatar

    Can anyone tell me why my cards dont change when I press the PLAY button in the visualizer ? It stays at the back. THANKS

  15. Jingle Jeff Avatar

    Hi Chris,  I've bought your beginners course but am stuck on lesson 28.  I've copied everything perfectly and gone through the code for over a week now, but I still can't get the scrollview to scroll.  I'm using the simulator and not a real device.  Please help.  I want to move on with the course but can't until this part works.

    Best wishes

    Jingle Jeff

  16. Jingle Jeff Avatar

    Hi Chris,  I've bought your beginners course but am stuck on lesson 28.  I've copied everything perfectly and gone through the code for over a week now, but I still can't get the scrollview to scroll.  I'm using the simulator and not a real device.  Please help.  I want to move on with the course but can't until this part works.

    Best wishes

    Jingle Jeff

  17. Sergio Lozano Garza Avatar

    Hey Chris, when i typed "arc4random_uniform(100)" instead of getting a 40 i got a 97…im stuck and getting insane, please help!!!…just kidding! so far im loving your tutorials they are excellent and easy to follow, im actually learning a lot, many thanks!

  18. MAAS Gaming Avatar

    Yeah i'm getting invisible cards..?

  19. Peter Marchut Avatar

    Is there a reason not to use:
    self.firstCardImageView.image = UIImage( named: String(format: "card%i", arc4random_uniform(13) + 1))

  20. Dane Jordan Avatar

    at 3:48 you say in a method call the first parameter needs a label and the following don't, isn't that the exact opposite of the one we use in the last episode (or maybe 10) with a.UpdateNameAndAge("Bryan", ageToSet: 15) ?

  21. Henry Schlierkamp Avatar

    Hi Chris, I noticed a few people below with the same issue. When I run the app and hit play, for some reason an "invisible" card will be included in the randomization for both first and second image views. After reviewing everything, it appears I did everything identical to you. Any suggestions anyone? 

Leave a Reply

Your email address will not be published. Required fields are marked *