• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: nubie: help return an object from another class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nubie: help return an object from another class


  • Subject: Re: nubie: help return an object from another class
  • From: ChrisB <email@hidden>
  • Date: Fri, 7 Apr 2006 11:13:24 -0700

Wain, that was it. I was almost there... That just made a lot of other things make since.
Thank you.


On Apr 7, 2006, at 11:02 AM, Wain wrote:

Hi,

You need to create an instance of the class Functions,

something like

Functions *myfucntions;
myfucntions = [[Functions alloc] init];
[myfucntions createPictureFromPath:[NSString stringWithFormat:@"file://localhost/Users/me/Desktop/image.1.png"]];

don't forget to release myfucntions if your not going to use it again.

[myfucntions release];

Wain


On 7 Apr 2006, at 18:33, ChrisB wrote:

I have a controller class that needs to send a file path (NSString) to function in another class that in turn returns a NSImage. I am trying to learn how to return objects properly.

Functions.h has prototype:

- (NSImage *)createPictureFromPath:(NSString *)filePath;

Functions.m has the implementation:

- (NSImage *)createPictureFromPath:(NSString *)filePath
{
	NSImage		*picture;
	/* do the work */
	return picture;
}

Controller.m has the following:

#import "Controller.h"
#import "Functions.h"

@implementation Controller
- (IBAction)loadMySlidePicture:(id)sender
{

NSImage *returnedPicture;
returnedPicture = [self createPictureFromPath:[NSString stringWithFormat:@"file://localhost/Users/me/Desktop/image.1.png"]];


}
@end

I get a compiler warning that 'Controller' may not respond to '- createPictureFromPath:'
so then I tried:
Functions *myfucntions;
[myfucntions createPictureFromPath:[NSString stringWithFormat:@"file://localhost/Users/me/Desktop/image.1.png"]];




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40tekuris.com


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >nubie: help return an object from another class (From: ChrisB <email@hidden>)

  • Prev by Date: Re: Annoying ToolTip difficulty
  • Next by Date: Cocoa bindings performance
  • Previous by thread: Re: nubie: help return an object from another class
  • Next by thread: Re: nubie: help return an object from another class
  • Index(es):
    • Date
    • Thread