Can any one explain briefly about Objects,Classes,Methods and Instances in Objective C.Since i'm a beginner to learn Objective C i want to know the basic things...

Recommended Answers

All 6 Replies

look on itunesU for iPhone programming by Paul Hegarty of Standford University. His on-line lectures are free and explain this well.

I must agree, I only found them after Chris mentioned them in a previous post and I've started to get through them. I knew objective C already (self taught to an adequate intermediate level) but I still learnt a lot about iOS stuff I thought I understood.

commented: see rules and regulations -1

look on itunesU for iPhone programming by Paul Hegarty of Standford University. His on-line lectures are free and explain this well.

Thanks Mr.Chrispadgham for ur reply...

Let us consider an example task in IOS.If i'm designing a program for placing a button and text field..my target is if i press the button the button have to be disappear and the value of the button should be displayed in a text box...In this case what is the object,class,method and instance...?

Thanks in advance...

I must agree, I only found them after Chris mentioned them in a previous post and I've started to get through them. I knew objective C already (self taught to an adequate intermediate level) but I still learnt a lot about iOS stuff I thought I understood.

Thanks Mr.Hericles for ur reply...

Let us consider an example task in IOS.If i'm designing a program for placing a button and text field..my target is if i press the button the button have to be disappear and the value of the button should be displayed in a text box...In this case what is the object,class,method and instance...?

Thanks in advance...

you would put a method in the view controller for the view that contains the button and that is linked to the touch up inside event. In this piece of code set the hidden property of the button to YES and the value of the button to the text box.

Thanks Mr.Hericles for ur reply...

Let us consider an example task in IOS.If i'm designing a program for placing a button and text field..my target is if i press the button the button have to be disappear and the value of the button should be displayed in a text box...In this case what is the object,class,method and instance...?

Thanks in advance...

- Your objects would be the text box and the button.
- Your class would be your application delegate containing 2 additional methods

- (IBOutlet)connectionToTextBox:(id)sender;

and

- (IBAction)buttonPress:(id)sender;

- An instance is when your write a class and invoke that class. So take NSString for instance and instance of NSString would be written as

//Not a complete code block
NSMutableString *theNameOfMyStringPointer;  //Declaration of your pointer to class of type NSMutableString
[theNameOfMyStringPointer alloc]init]; //you are now creating the instance of NSMutableString by sending the messages alloc and init.

In this example your creating an instance of the class through the pointer of theNameOfMyStringPointer.

You should also be aware of what a message is. A message uses the bracketed syntax which looks like this [objectName messageName];

You also need to understand how to connect the Text Box and Button to the Application Delegate Class and the methods you created to make it work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.