Cocoa - calling a VIEW method from the CONTROLLER

Posted by eemerge on Stack Overflow See other posts from Stack Overflow or by eemerge
Published on 2010-06-17T20:22:55Z Indexed on 2010/06/17 21:53 UTC
Read the original article Hit count: 238

Filed under:
|
|

Hello everyone, Got a little problem i asked about it before but maybe i didnt ask properly. I have a cocoa application, which amongst other things, must do the following task: - load some images from the disk, store them in an array and display them in a custom view.

In the Interface Builder i have a CustomView and an OBJECT that points to TexturesController.h

The custom view is a custom class, TextureBrowser. Below is the code for the controller and view:

TexturesController

#import <Cocoa/Cocoa.h>

@class TextureBrowser;

@interface TexturesController : NSObject {  
  IBOutlet NSTextField *logWindow;  
  IBOutlet TextureBrowser *textureView;
  NSMutableArray *textureList; 
} 
@property textureView;
-(IBAction)loadTextures:(id)sender;
-(IBAction)showTexturesInfo:(id)sender;
@end

TextureBrowser

@interface TextureBrowser : NSView {
  NSMutableArray *textures;
}
@property NSMutableArray *textures;
-(void)loadTextureList:(NSMutableArray *)source;
@end

These are just the headers. Now , what i need to do is:

  • when loadTextures from the TexturesController is called, after i load the images i want to send this data to the view (TextureBrowser), for example, store it in the NSMutableArray *textures.

I tried using the -(void)loadTextureList:(NSMutableArray*)source method from the view, but in the TextureController.m i get a warning : No -loadTextureList method found

This is how i call the method :

[textureView loadTextureList: textureList];

And even if i run it with the warning left there, the array in the view class doesnt get initialised.

Maybe im missing something...maybe someone can give a simple example of what i need to do and how to do it (code).

Thanks in advance.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about view