• 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: Obj-C header-file becoming C header-file, & NSImage problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C header-file becoming C header-file, & NSImage problem


  • Subject: Re: Obj-C header-file becoming C header-file, & NSImage problem
  • From: Marcel Weiher <email@hidden>
  • Date: Mon, 19 Jul 2004 18:59:29 +0100

typedef struct
{
double t;
id intersectedObject;
}PMIntersectionStruct;

This structure is passed all over the place, and eventually comes back with
intersectedObject pointing at the lucky object. This had been working
perfectly, until I added PMTypes.c (for doing the vector manipulation
stuff), and included a C function prototype in PMTypes.h. Now, the compiler
always generates errors for the line 'id intersectedObject' in PMTypes.h. If
I change this to 'void *intersectedObject', it compiles and I can send
messages just fine, but I need to cast the void* to id in message sends to
avoid warnings. Its like the H file has been demoted from ObjC to C and the
compiler doesnt understand 'id' anymore. Is there some other way around
this?

I am pretty sure this has nothing to do with the "type" of the file, because a header file is a header file, but rather with the context the file is included into.

My guess is that all the .m files you compile are pulling in Cocoa/Objective-C headers before they include PMTypes.h, whereas your PMTypes.c is not doing this. Since you only need the definition of 'id', the following should suffice:

#include <objc/objc.h>


2. I've got an NSImageView, made with an NSImage from a NSBitmapImageRep,
and a pointer to the bitmap data. If I change the data, the NSImageView only
updates to show the changes if the window (and view) is resized. How can I
get the NSImage view to update programmatically? Ive tried display: and
setNeedsDisplay: and various other methods on all the objects without
success :( Upon calling caching methods, I get an NSImageCacheException.

Just throw away the NSImage and create a new one with the NSBitmapImageRep in question. Or don't use an NSImageView/NSImage combo.

Marcel

--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Obj-C header-file becoming C header-file, & NSImage problem (From: Oliver Donald <email@hidden>)

  • Prev by Date: Re: Creating an EPS file from an NSImage
  • Next by Date: Re: cocoa app from scratch
  • Previous by thread: Re: Obj-C header-file becoming C header-file, & NSImage problem
  • Next by thread: Re: Obj-C header-file becoming C header-file, & NSImage problem
  • Index(es):
    • Date
    • Thread