Apple WebObjects 3.5 Manual de usuario Pagina 172

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 218
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 171
Chapter 10 The WebScript Language
172
automatically defines two accessor methods: one to retrieve the instance
variable’s value, and one to change the value.
For example, the
Application.wos script in the Visitors example declares this
instance variable, which keeps track of the number of visitors:
id visitorNum;
When WebScript parses this file, it sees this declaration and implicitly defines
two methods that work like this:
- visitorNum {
return visitorNum;
}
- setVisitorNum:newValue {
visitorNum = newValue;
}
(You don’t see these methods in the script file.) The Main.wos script access the
application’s
visitorNum variable using these statements:
number = [[self application] visitorNum];
...
[[self application] setVisitorNum:number];
Note: self is a keyword that represents the current object. For more information,
see “Reserved Words” (page 178).
You can also access an instance variable declared in one component script from
another component script. This is something you commonly do right before you
navigate to a new page, for example:
id anotherPage = [[self application] pageWithName:@"Hello"];
[anotherPage setNameString:newValue];
The current script uses the statement [anotherPage setNameString:newValue];
to set the value of
nameString, which is declared in the page named Hello.
Sending a Message to a Class
Usually, the object receiving a message is an instance of a class. For example, in
this statement the variable
aString is an instance of the class NSString:
[aString length];
You can also send messages to a class. You send a class a message when you want
to create a new instance of that class. For example this statement tells the class
NSString to invoke its
stringWithString: method, which returns an instance
of NSString that contains the specified string:
Vista de pagina 171
1 2 ... 167 168 169 170 171 172 173 174 175 176 177 ... 217 218

Comentarios a estos manuales

Sin comentarios

Aqua-pure Cyst-FF manuales

Manuales del propietario y guías del usuario para Equipos De Agua Aqua-pure Cyst-FF.
Ofrecemos 1 manuales en pdf Aqua-pure Cyst-FF para descargar gratis por tipos de documentos: Manual de usuario






Más productos y manuales para Equipos De Agua Aqua-pure

Modelos Tipo de documento
CWS150MECJ Manual de usuario   Aqua-Pure CWS150MECJ User Manual, 32 paginas
CSX200 Manual de usuario   Aqua-Pure CSX200 User Manual, 28 paginas
APIF100 Manual de usuario   Aqua-Pure APIF100 User Manual [en] , 36 paginas
3MFF100 Manual de usuario   Aqua-Pure 3MFF100 User Manual, 8 paginas
APUN101 Manual de usuario   Aqua-Pure APUN101 User Manual, 12 paginas
NWS200 Manual de usuario   Aqua-Pure NWS200 User Manual, 24 paginas
CSM1501 Manual de usuario   Aqua-Pure CSM1501 User Manual, 24 paginas
Complete Manual de usuario     Aqua-Pure Complete User Manual, 20 paginas
CBW1001 Manual de usuario   Aqua-Pure CBW1001 User Manual [en] , 20 paginas
APPM150 Manual de usuario   Aqua-Pure APPM150 User Manual [en] , 32 paginas
CBF150 Manual de usuario   Aqua-Pure CBF150 User Manual [en] , 24 paginas