Amazon.com Widgets problem to understand page 200
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2013, 04:07:14 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Programming in Objective-C, 4th edition
| |-+  Chapter 10
| | |-+  problem to understand page 200
Pages: [1]   Go Down
Print
Author Topic: problem to understand page 200  (Read 665 times)
Cretan1986
Newbie
*
Posts: 4






« on: May 30, 2012, 10:34:02 AM »

In page 200 we have the following code:

Code: (Objective-C)
[_window makeKeyAndVisible]

I really find difficult to understand this code. Page 25 says that the concept is
Code: (Objective-C)
[receiver message]
and as far as I know the receiver must be a class or an instance, but in this case the receiver is an instance variable. What am I missing?
Logged
Cretan1986
Newbie
*
Posts: 4






« Reply #1 on: June 02, 2012, 09:01:17 AM »

could someone explain this to me?  Roll Eyes Thanks in advance  Smiley
Logged
stuartjj
Newbie
*
Posts: 11






« Reply #2 on: June 15, 2012, 11:31:04 AM »

An answer to part of your question:

A receiver can be a method that returns an instance variable.  From page 200:
Code: (Objective-C)
[self.window makeKeyAndVisible];
In this case self.window returns the instance variable _window. 

Logged
afterDark
Global Moderator
Full Member
*****
Posts: 126






« Reply #3 on: November 28, 2012, 03:21:07 PM »

I think what is meant here, is that _window is an instance variable of data type <some object>. That is not really a clear sentence, but I mean something along these lines:

in .h file:
@property Rectangle * niceBigRectangle;

in .m file:
@synthesize niceBigRectangle = _niceBigRectangle;

then it is perfectly logical to have somewhere in the methods in the .m file:
[_niceBigRectangle setWidth:10 andHeight:6];

Hope this helps (for the future readers, since Cretan1986 probably moved on as it is so long ago... but this same topic confused me too at first. At least this answer now serves as a memory aid to myself when I have the same question later again)
Logged

I am just an amateur with Objective-C, don't let the moderator label fool you. Working my way through the book slowly.
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.