FROM : Mike Blaguszewski
DATE : Fri Jul 21 23:22:25 2006
On Jul 21, 2006, at 4:51 PM, Trygve Inda wrote:
> -(QTMovie *)generate:(NSMutableDictionary *)dict is invoked as:
>
>
> QTMovie = [[pluginInstances objectAtIndex:0] generate:dict]
>
> So [pluginInstances objectAtIndex:0] is an instance of a class that
> conforms
> to my protocol (in which generate returns a QTMovie).
>
> I don't know how to cast [pluginInstances objectAtIndex:0] since I
> can't do
> it to a specific class - only to a protocol since many classes can/
> will
> conform to the protocol.
If your protocol is named, say TPPlugin, then you can declare an
variable of type
id <TPPlugin> plugin;
Assigning to such a variable, or directly casting to id <TPPlugin>,
ought to give the compiler the info it needs, though I haven't tested
it.
--
Mike Blaguszewski / Cocoa Hacker / Ambrosia Software, Inc.
DATE : Fri Jul 21 23:22:25 2006
On Jul 21, 2006, at 4:51 PM, Trygve Inda wrote:
> -(QTMovie *)generate:(NSMutableDictionary *)dict is invoked as:
>
>
> QTMovie = [[pluginInstances objectAtIndex:0] generate:dict]
>
> So [pluginInstances objectAtIndex:0] is an instance of a class that
> conforms
> to my protocol (in which generate returns a QTMovie).
>
> I don't know how to cast [pluginInstances objectAtIndex:0] since I
> can't do
> it to a specific class - only to a protocol since many classes can/
> will
> conform to the protocol.
If your protocol is named, say TPPlugin, then you can declare an
variable of type
id <TPPlugin> plugin;
Assigning to such a variable, or directly casting to id <TPPlugin>,
ought to give the compiler the info it needs, though I haven't tested
it.
--
Mike Blaguszewski / Cocoa Hacker / Ambrosia Software, Inc.
| Related mails | Author | Date |
|---|---|---|
| Trygve Inda | Jul 21, 14:09 | |
| Rob Ross | Jul 21, 16:38 | |
| Trygve Inda | Jul 21, 22:51 | |
| Mike Blaguszewski | Jul 21, 23:22 | |
| Uli Kusterer | Jul 22, 19:46 |






Cocoa mail archive

