Learn Objective C Tutorial For Beginners - Episode 3 - Methods

preview_player
Показать описание
Get a customized roadmap for your app and start building it in 7 days:

Learn Objective C Tutorial For Beginners is a series that introduces the Objective C programming language and teaches you how to write code to build iPhone apps.

Learning Objective C doesn't have to be hard! In these tutorials, you will learn Objective C programming syntax, classes and software design patterns so that you can program iOS apps.

Combined with the Learn XCode 4 Tutorial series, you'll be making iPhone apps in no time!

In this episode, we talk about Method Declaration and Invoking Methods

For the all the episodes in this Learn Objective C Tutorial For Beginners series, visit the playlist:

My channel, CodeWIthChris, is about all the aspects of building iOS apps. I'll post video tutorials on Objective C, XCode, how to submit apps to the Apple App Store, and tutorials on building various types of apps or integrating things like analytics, advertisements etc. You might even find the odd app review here or there!

If you want to see more ObjectiveC and XCode Video Tutorials, please SUBSCRIBE so that you don't miss an episode and remember to LIKE and COMMENT if you have questions.

Intro & Outro music
Рекомендации по теме
Комментарии
Автор

Comment below for questions and to discuss the fact of the day! Remember to LIKE and SUBSCRIBE :)

CodeWithChris
Автор

Hey Brad! I'm glad you asked because I always thought i was strange myself (coming from the C# syntax) but never bothered to dig into it. What we recognize as the method name isn't really the name. So for example the Obj-C method declaration looks like:

-(void) A:(int)a B:(int)b C:(int)c

All 3 parameters, a, b, c each have their own label A, B, C respectively. The method signature/name is ACTUALLY "A:B:C:" but for label A, we just write it in a way that also indicates what the method does.

CodeWithChris
Автор

Hey Tye, yes! So your method call would be:
[object sampleMethodWithParameter:8 withBool:YES]; (The 8 and YES are just example inputs. You can substitute with any number or NO for the bool)

CodeWithChris
Автор

Hey Vanmathi, please check out another one of my videos: HD
How To Build iPhone Apps - S01E04: Your XCode Project Files Demystified to find out!

CodeWithChris
Автор

Hey Scott, what you've got there is that you're trying to call the "doSomething" method on the classname. Instead you should be calling it on the variable name. So for example, this is should be your declaration:
MyClass *variablename = [[MyClass alloc] init];
[variablename dosomething];

If you still get an error, then i would check if the "dosomething" method declared in MyClass.h and implemented in MyClass.m?

CodeWithChris
Автор

Hello! Thanks! Do you have a programming background?

The "Basics" series is the way i'm focused on teaching people who have no experience with programming but i can see how someone would find the objective-c series useful if they already have basic object oriented programming concepts!

CodeWithChris
Автор

Thanks for the videos. Very helpful and I like that you type when you are explaining rather than showing it already typed out.

Cheers!

mallorysteele
Автор

Thanks Evan, hope to see more of you around!

CodeWithChris
Автор

Thanks for these videos! They are very helpful. Keep up the good work!

robmccaughey
Автор

Thanks for asking questions Scott! It also helps others learn. And welcome :) You make it sound like a cult! lol

CodeWithChris
Автор

Hey Chris, nice tutorials!
However as you read through these comments you can see that there are many confused people and this is why:
It may be good to note especially when talking to people who know nothing of Objective C that you are assuming the method you created called "sampleMethodWithParameter" is being called somewhere else like in the AppDelegate. It was confusing to me because I thought you were writing a method call for this method but in fact you were only using that method to call another method you wrote called "doSomething" in the myClass class.

Perhaps what you should consider doing at the end of all your videos is to go back and point out exactly how your code is executed; showing where your code starts and which methods call which methods to get a result.

gaactic_muffin
Автор

We're calling the doSomething method of MyClass from another method in another class!

You can definitely call methods from within methods!

CodeWithChris
Автор

Hey Scott, the "+" symbol you got there should be a "*". Let me know what you see after changing that!

CodeWithChris
Автор

Thanks Chris, your videos are clear and understandable

evanchukz
Автор

Good stuff. Thanks for your effort doing this!

kondencuotas
Автор

so why when you have two parameters, do you suddenly give the parameter a label along with it's name? can you give the parameter a label that is the same as it's name and what is the use of the label?

espaach
Автор

I learned some objective C in past, so this syntax does not shock me as it did when I first saw it. My question is (It has been a while since I first saw this) what's the story with the first param on a method definition not having a label. So, the first one is built in, but all other params need their own label? Are there any exceptions to this declaration I just described?

bradsatz
Автор

You can do it in the HTML5 player, but since ads only work in the flash player,

and you have ads enabled, it doesn't show up :)

tekgorilla
Автор

I still haven't been able to find a video or series that explains objective-C from the basics... everyone just starts typing code and assumes I know what it means. I've watched a million objective-C tutorials and I still feel like I haven't learned anything and I'm still hopelessly confused.

Dylan_Marshall
Автор

Thanks for the videos ! Why can't I play your video at 1.5x/2x? I am able to play other videos at increased speeds?

TheNandumenon
visit shbcf.ru