Re: -[NSColor setBackgroundColor:] not working in 10.6

2010-10-08 Thread Manfred Schwind
 - (void)drawRect:(NSRect)rect {
   [...]
   [img drawInRect:rect ...];
 }

Not related to your original problem, but please note that the NSRect passed to 
drawRect is the dirty area that needs to be redrawn. In many cases this matches 
self.bounds, but not always. So using this rect as position to draw your image 
is a bug in this case and might result in unexpected drawing errors.

Regards,
Mani
--
http://mani.de - friendly software
iVolume - listen to music hands-free
LittleSecrets - the encrypted notepad
Sahara - sand in your pocket
Watchdog - baffle the curious

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: init returns nil or raises exception?

2010-10-08 Thread Remco Poelstra

Op 7-10-2010 18:12, Jean-Daniel Dupas schreef:


Le 7 oct. 2010 à 18:04, Kyle Sluder a écrit :


On Thu, Oct 7, 2010 at 12:47 AM, Remco Poelstrare...@beryllium.net  wrote:

While still in the process of cleaning up my code, I read in the documentation 
of NSObject that -init should return nil if it fails to initialize. But a 
paragraph lower it's stated that -init should always return a functional 
instance or raise an exception. Isn't that in conflict with the allowance of 
returning nil?


File a documentation bug. I would imagine the paragraph about the
exception is saying that an exception must be raised rather than
returning a half-constructed instance of the object.




I agree. The must raise an exception  is a bug in the documentation IMHO.
There is a lot of recent API that used the 'return nil' pattern (especially 
methods design to return an NSError by ref).


Ah, I see. I hoped it was 'the new way to go'. I like to more than 
checking for nil, but I might be a bit lazy :)

I'll file a bug to get the docs updated.

Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: init returns nil or raises exception?

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 12:04 AM, Remco Poelstra re...@beryllium.net wrote:
 Ah, I see. I hoped it was 'the new way to go'. I like to more than checking
 for nil, but I might be a bit lazy :)

Checking for nil and assigning to self should be reflexes. You can
combine the two if you like. Whenever I write an -init method, I
always follow the same pattern. I don't even need to think about it:

- (id)init {
  if (!(self = [super init]))
return nil;

  // do other initialization

  return self;
}

To my brain, it might as well be required syntax.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: init returns nil or raises exception?

2010-10-08 Thread Remco Poelstra

Op 8 okt 2010, om 09:57 heeft Kyle Sluder het volgende geschreven:

 On Fri, Oct 8, 2010 at 12:04 AM, Remco Poelstra re...@beryllium.net wrote:
 Ah, I see. I hoped it was 'the new way to go'. I like to more than checking
 for nil, but I might be a bit lazy :)
 
 Checking for nil and assigning to self should be reflexes. You can
 combine the two if you like. Whenever I write an -init method, I
 always follow the same pattern. I don't even need to think about it:
 
 - (id)init {
  if (!(self = [super init]))
return nil;
 
  // do other initialization
 
  return self;
 }
 
 To my brain, it might as well be required syntax.

Yes, but in the rest of my code I've to do the check as well, so this is 
actually not a good thing to do:
[someObject doSomethingWithObject:[CustomClass 
customClassObjectThatMightBeNil]];

Assuming there is also a convenience class method that calls that same init as 
above.

Regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling maincontroller

2010-10-08 Thread Hans van der Meer

On 7 okt 2010, at 22:13, Quincey Morris wrote:

 On Oct 7, 2010, at 11:58, Hans van der Meer wrote:
 
 In my application I instantiate a MainController (the delegate having 
 awakeFromNib) from where all actions are dispatched. In order to send 
 messages to the displaywindow residing in MainController, there is the 
 problem how to find this MainController from other callers (possibly on 
 other threads). Now it is coded as follows:
 
 In MainController.c: 
 static MainController *controller = nil;
 controller = self; /* in its init method */
 + (void) message:(NSString *)msg;
   { dispatch_async(dispatch_get_main_queue(), ^{[controller message:msg];});}
 - (void) message:(NSString *)msg;
 
 I am not very happy with the static variable but do not see another way to 
 accomplish this. I fear my solution is not as much in the spirit of Cocoa 
 programming as it should be. 
 Is there a better way?
 
 If it's your application delegate, other objects can find it as [NSApp 
 delegate] or [[NSApplication sharedAppplication] delegate].

That is exactly what I needed. My code now is:
- (void) message:(NSString *)message;
{
  dispatch_async(dispatch_get_main_queue(), 
^{[[NSApp delegate] message:message];});
}
And this will get rid of the static variable and the class function in the 
MainController. It is of course a matter of which style one prefers. For me 
this coding most clearly expresses what goes on and shows it at exactly the 
point where the action is invoked.

Thanks!

Hans van der Meer

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Problem using dictionary

2010-10-08 Thread Remco Poelstra
Hi,

I've the following code:

NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle 
mainBundle] pathForResource:@Indexes ofType:@plist]]; //This is actually a 
global initialized in +initialize.
NSString *key=[NSString stringWithFormat:@%...@.%@,page,property];
NSLog(@%@,key);
NSLog(@%@,[[dict valueForKey:key] description]);
NSLog(@%@,[[[dict valueForKey:page] valueForKey:property] description]);

The result from the code is:

page1.fwRevCode
(null)
6

The first and last are exactly what I expect. But why can't the dictionary find 
the value with the full key?

Thanks in advance.

Regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Remco Poelstra
Ah, I should use valueForKeyPath:. Is there a reason valueForKey: is documented 
directly but valueForKeyPath: is not?

Kind regards,

Remco Poelstra

Op 8 okt 2010, om 13:34 heeft Remco Poelstra het volgende geschreven:

 Hi,
 
 I've the following code:
 
 NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle 
 mainBundle] pathForResource:@Indexes ofType:@plist]]; //This is actually 
 a global initialized in +initialize.
 NSString *key=[NSString stringWithFormat:@%...@.%@,page,property];
 NSLog(@%@,key);
 NSLog(@%@,[[dict valueForKey:key] description]);
 NSLog(@%@,[[[dict valueForKey:page] valueForKey:property]   description]);
 
 The result from the code is:
 
 page1.fwRevCode
 (null)
 6
 
 The first and last are exactly what I expect. But why can't the dictionary 
 find the value with the full key?
 
 Thanks in advance.
 
 Regards,
 
 Remco Poelstra___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/remco%40beryllium.net
 
 This email sent to re...@beryllium.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Where is SimpleTextInput sample code project?

2010-10-08 Thread Ross Carter
Text and Web Programming Guide for iOS 
(http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/CustomTextProcessing/CustomTextProcessing.html)
 says:

The code was taken from the SimpleTextInput sample code project.

Does that sample code project exist? Where?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Question about MPMusicPlayerController

2010-10-08 Thread Eric E. Dolecki
I have an app I am playing around with to play my music on my Touch. When I
select a genre that is in a table, I construct a query to get all the tracks
for that genre, start that queue, build UI in a scrollview.

However if I choose a Genre like Rock that is available and has a lot of
tracks in it, my app crashes. Works for less-populated genres. Am I doing
something really stupid here?

In my -tableView:didSelectRowAtIndexPath

MPMediaQuery *query = [[MPMediaQuery alloc] init];

[query addFilterPredicate:[MPMediaPropertyPredicate

   predicateWithValue:[liveGenresArray
objectAtIndex:indexPath.row]


forProperty:MPMediaItemPropertyGenre]];

NSArray *songs = [query items];

if([songs count]0){

selectedNowPlayingRow = 0;

[myPlayer setQueueWithQuery:query];

[nowPlayingSongs removeAllObjects];

for(MPMediaItem *song in songs){

NSString *songTitle = [song
valueForProperty:MPMediaItemPropertyTitle];

[nowPlayingSongs addObject:songTitle];

}

songTitleLabel.text = [nowPlayingSongs objectAtIndex:0];

[self updateNowPlayingScroller:query];

[myPlayer play];

 [query release]

///...









  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Release autoreleased object now

2010-10-08 Thread Jonny Taylor
Is there a way of forcing an autoreleased object to be released right now? I am 
encountering problems in my image processing code where I am receiving (and 
later discarding) a lot of large blocks of autoreleased memory in a loop. This 
is not getting cleaned up until the end of the loop (when I drop back into the 
run loop) and I am running out of memory.

The problem is coming from OS functions such as [image TIFFRepresentation] that 
return autoreleased objects, so it is obviously considered ok to autorelease 
large chunks of memory. My question is whether I can tell the OS to release the 
memory *now* rather than waiting until the pool is drained. At the moment I am 
bracketing the relevant parts with my own autorelease pools, but that is 
getting a bit tedious. I would like just to be able to call [imageRep 
releaseNow] or something. I suspect that just calling 'release' on the 
autoreleased memory would be a Bad Idea.

Any suggestions very welcome!
Cheers
Jonny___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Release autoreleased object now

2010-10-08 Thread Kyle Sluder
On Oct 8, 2010, at 9:58 AM, Jonny Taylor j.m.tay...@durham.ac.uk wrote:

 The problem is coming from OS functions such as [image TIFFRepresentation] 
 that return autoreleased objects, so it is obviously considered ok to 
 autorelease large chunks of memory. My question is whether I can tell the OS 
 to release the memory *now* rather than waiting until the pool is drained. At 
 the moment I am bracketing the relevant parts with my own autorelease pools, 
 but that is getting a bit tedious. I would like just to be able to call 
 [imageRep releaseNow] or something. I suspect that just calling 'release' on 
 the autoreleased memory would be a Bad Idea.

No, you cannot force an autorelease pool to release its contents without 
calling -drain. Wrapping the autorelease-intensive portions of your code is the 
correct approach.

--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] Changing iPhone Application Language Programatically.

2010-10-08 Thread Jeff Kelley
Tharindu,

    We had to do something similar and decided to eschew .lproj files
entirely; we simply created an ivar in our app delegate to store the
current language and switched out strings (stored in strings files)
based on the current language. There’s no reason you couldn't do the
same in your app.

-Jeff Kelley


On Monday, October 4, 2010, Tharindu Madushanka tharindu...@gmail.com wrote:
 Hi,

 I would like to know whether its possible to change to a language other than
 provided list of languages in iPhone Settings. By default using localized
 .lproj folders  .strings files we could make applicaton localized into
 selected language.

 For example, Languages like Sinhala are not in those set of languages in
 Settings. And there also does not have Sinhala Keyboard on iPhone. But
 Sinhala unicode font is available from iOS 4 onwards which is nice even it
 has some rendering issues.

 If I want to build a localized app for that language, is it legal and
 whether its possible that I will create si.lproj directory and
 programatically forcing the app to use strings in that folder ??


 Thanks and Kind Regards,

 Tharindu.
 tharindufit.wordpress.com

-- 
Jeffrey R. Kelley
slauncha...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


confused about floats

2010-10-08 Thread Amy Heavey
I've got two float values (x and y) that I'm using to change the  
coordinates of a drawing action that is being looped through. I can  
add a value to x and it draws the next image along, but I want to test  
the value of x and if it is out of bounds I want to reset it to zero  
and increase y, so I get a grid of images drawn.


For some reason, even though I can do
x = x+128;
and it moves the image accross, x seems to be null so I can't test  
against it, my if statement ' if (x  300){' always fails.


This must be something really simple I just can't see it this morning?  
I'd appreciate any help.


Many Thanks

Amy

Full code being used:
- (IBAction)generateKitImages:(id)sender;
{
NSObject *kit;
kit = [[kits selectedObjects] objectAtIndex:0];

	NSString* fileName = [[kit valueForKey:@kitName]  
stringByAppendingString:@.jpg];
	NSString* kitimagePath = self applicationSupportFolder]  
stringByAppendingPathComponent:@images]  
stringByAppendingPathComponent:@kit]  
stringByAppendingPathComponent:fileName];	

//NSLog(@Kit Image Path: %@, kitimagePath);
//create new image 300px square
 NSImage *targetImage;
 NSSize targetSize = NSMakeSize (300, 300);
 targetImage = [[NSImage alloc] initWithSize:targetSize];


//select all images for kit
	 NSArray* kitImages = [kit  
valueForKeyPath:@kitItems.kitItemProduct.productImage];


//set coordinates to x,y - 0,0 to start
float x = 0;
float y = 0;
//for each image
NSEnumerator *imageLoop = [kitImages objectEnumerator];
NSString *imgPath;
while ((imgPath = [imageLoop nextObject])) {
NSImage *img = [[NSImage alloc]initWithContentsOfFile:imgPath];
//NSLog(@Image: %@,img);
//resize to 100px high
//get original size
//NSSize *origSize;
//origSize = [img size];
//calculate scale factor
//[img setScalesWhenResized: YES];
//[img setSize: NSMakeSize (100., 100.)];

//apply image to view
[targetImage lockFocus];
[img drawInRect:NSMakeRect(x,y,100,100)
  fromRect:NSMakeRect(x,y,100,100)
 operation:NSCompositeCopy
  fraction:1];

[targetImage unlockFocus];

//set new coordinates
x = x+100;

		//if coordinates are too wide, start new row - if x300, reset x to  
0 and add 100 to y

if(x  300){
x = 0;
y = y+100;
}

}
//apply kit logo to view
//apply kit date (text) to view
//save files out
//create a NSBitmapImageRep
	NSBitmapImageRep *bmpImageRep = [[NSBitmapImageRep alloc]initWithData: 
[targetImage TIFFRepresentation]];

//add the NSBitmapImage to the representation list of the target
[targetImage addRepresentation:bmpImageRep];

//get the data from the representation
NSData *data = [bmpImageRep representationUsingType: NSJPEGFileType

 properties: nil];

//write the data to a file
[data writeToFile: kitimagePath
   atomically: NO];
//link images to kit
[kit setValue:kitimagePath forKey:@kitImage];
}

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Not understanding NSString's compare:options:range:locale: method

2010-10-08 Thread Derek Huby
This method isn't doing what I expect it to do (which probably means that I'm 
expecting the wrong thing.)

//=
NSRange range = NSMakeRange(0,1);

NSString *s1 = @ab;
NSString *s2 = @ac;

//Just compare the first character
NSComparisonResult result1 = [s1 compare:s2 options:NSLiteralSearch range:range 
locale:[NSLocale currentLocale]];
NSLog(@Result 1 = %d, result1);

//Now swap the order of the strings
NSComparisonResult result2 = [s2 compare:s1 options:NSLiteralSearch range:range 
locale:[NSLocale currentLocale]];
NSLog(@Result 2 = %d, result2);
//=

I get a result of -1 both times. Since we are only comparing the first 
character, shouldn't the result be 0?

Thanks for any illumination,

Derek Huby


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


create multiple Custom Views

2010-10-08 Thread N!K
I know this should be really easy, but I've been unsuccessful finding an 
explanation or tutorial in Apple's documentation or in Google. A couple terse 
examples did show up, but I did not understand them or they didn't seem to 
apply.
In simplest form, I need to put two Custom Views onto the one window in 
Interface Builder along with two buttons to control them. Each button should 
cause a new Bezier line to be drawn on its associated window. The buttons are 
no problem, but controlling the two Custom Views individually is.
Lots of material covers a single Custom View. I have no difficulty creating one 
and using it, although I do not understand specifically what assigns the Custom 
View pointer to in -(void)drawRect:(NSRect)rect or 
–(id)initWithFrame:(NSRect)frameRect. I'm accepting on faith that the system 
“knows” because there is only one Custom View in the one NSView subclass in 
these examples.
However, I think I need to know how to assign the arguments when there is more 
than one Custom View, in order to direct the init and draw to the correct 
Custom View. When I naively drag a second Custom View and AppController onto 
the window, make the connections, and attempt to associate the two Custom Views 
and use two IBOutlets to control them, I fail completely. Maybe I'm barking up 
the wrong tree, trying to do this with only one subclass of NSView for both 
Custom Views.
Questions:
Where can I find out how to assign the init and draw arguments to one Custom 
View or the other? Or is this the wrong approach?
Is one subclass required for each Custom View? This seems cumbersome when there 
are several Custom Views.
Are IBOutlets for each Custom View the right approach?
Is this the place for lockFocus, to draw on only the correct Custom View?
And most important of all, is there a good example with explanation that I can 
follow?


Thanks in advance,

Nick___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Return value of performSelector:onThread:?

2010-10-08 Thread Abhi Beckert
Hi,

I have a background thread which needs the main thread to create an object 
(because part of the initializer isn't thread safe).

The performSelector: methods don't expose the return value of the message, even 
with waitUntilDone:YES. I'm not happy with my workaround, which is to use an 
instance variable:

@interface MyClass : NSObject {
id tmpObj;
}
@end

@implementation MyClass

- (void)foobar
{
[self performSelectorOnMainThread:@selector(createMyObj) withObject:nil 
waitUntilDone:YES];
id myObj = tmpObj;
[tmpObj autorelease];
tmpObj = nil;

// do stuff with myObj
}

- (void)createMyObj
{
tmpObj = // create object

[tmpObj retain]; // retain object, so it doesn't get auto-released
}

@end

Has anyone else got a cleaner technique? Perhaps provide an NSMutableDictionary 
to withObject: ?

- Abhi

- - -

Kind Regards,
Abhi Beckert

Senior Programmer
Precedence - Websites. Hosting. Marketing.
1300 363 160
http://precedence.com.au

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Quincey Morris
On Oct 8, 2010, at 04:47, Remco Poelstra wrote:

 Is there a reason valueForKey: is documented directly but valueForKeyPath: is 
 not?

They're both documented, but it requires familiarity with how to read the Cocoa 
documentation, which is an important point that goes beyond just this example.

The methods are documented as part of the NSKeyValueCoding protocol here:


http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html

It's briefly mentioned, in that document and slightly more definitively in:


http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Overview.html

that there's a default implementation of NSKeyValueCoding in NSObject. 
NSDictionary inherits this behavior from NSObject, but because the default 
'valueForKeyPath:' is documented as operating in terms of 'valueForKey:', 
NSDictionary only needs to override the latter, and its own documentation only 
needs to document the override.

The point is to keep in mind that the behavior of objects is documented in 
their reference guides *and* those of their superclasses.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Not understanding NSString's compare:options:range:locale: method

2010-10-08 Thread Stephen J. Butler
On Tue, Oct 5, 2010 at 4:48 AM, Derek Huby dh...@mac.com wrote:
 This method isn't doing what I expect it to do (which probably means that I'm 
 expecting the wrong thing.)

 //=
 NSRange range = NSMakeRange(0,1);

 NSString *s1 = @ab;
 NSString *s2 = @ac;

 //Just compare the first character
 NSComparisonResult result1 = [s1 compare:s2 options:NSLiteralSearch 
 range:range locale:[NSLocale currentLocale]];
 NSLog(@Result 1 = %d, result1);

 //Now swap the order of the strings
 NSComparisonResult result2 = [s2 compare:s1 options:NSLiteralSearch 
 range:range locale:[NSLocale currentLocale]];
 NSLog(@Result 2 = %d, result2);
 //=

 I get a result of -1 both times. Since we are only comparing the first 
 character, shouldn't the result be 0?

From the docs:

range
The range of the receiver over which to perform the comparison. The
range must not exceed the bounds of the receiver.

So you are comparing @a to @ac in the first case, and @a to
@ab in the second.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Not understanding NSString's compare:options:range:locale: method

2010-10-08 Thread Aki Inoue
Hi Derek,

The range argument only applies to the receiver of the message.
So, with your first example, you're comparing @a against @ac.

Aki

On 2010/10/05, at 2:48, Derek Huby wrote:

 This method isn't doing what I expect it to do (which probably means that I'm 
 expecting the wrong thing.)
 
 //=
 NSRange range = NSMakeRange(0,1);
   
 NSString *s1 = @ab;
 NSString *s2 = @ac;
   
 //Just compare the first character
 NSComparisonResult result1 = [s1 compare:s2 options:NSLiteralSearch 
 range:range locale:[NSLocale currentLocale]];
 NSLog(@Result 1 = %d, result1);
 
 //Now swap the order of the strings
 NSComparisonResult result2 = [s2 compare:s1 options:NSLiteralSearch 
 range:range locale:[NSLocale currentLocale]];
 NSLog(@Result 2 = %d, result2);
 //=
 
 I get a result of -1 both times. Since we are only comparing the first 
 character, shouldn't the result be 0?
 
 Thanks for any illumination,
 
 Derek Huby
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com
 
 This email sent to a...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Return value of performSelector:onThread:?

2010-10-08 Thread Kyle Sluder
On Thu, Oct 7, 2010 at 10:49 PM, Abhi Beckert a...@precedence.com.au wrote:
 I have a background thread which needs the main thread to create an object 
 (because part of the initializer isn't thread safe).

 The performSelector: methods don't expose the return value of the message, 
 even with waitUntilDone:YES. I'm not happy with my workaround, which is to 
 use an instance variable:

 Has anyone else got a cleaner technique? Perhaps provide an 
 NSMutableDictionary to withObject: ?

Using GCD:

id myObj;
dispatch_sync(dispatch_get_main_queue(), ^{ myObj = CreateTheObject(); });

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Return value of performSelector:onThread:?

2010-10-08 Thread Seth Willits
On Oct 7, 2010, at 10:49 PM, Abhi Beckert wrote:

 The performSelector: methods don't expose the return value of the message, 
 even with waitUntilDone:YES. I'm not happy with my workaround, which is to 
 use an instance variable:

Use the withObject: parameter. If you use a mutable dictionary, you can shove 
multiple parameters into it for the method to use, and the method can add the 
return value. Whatever gets triggered after the method is done can examine the 
dictionary to see the result. Just make sure you do the memory management 
correctly.

--
Seth Willits



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: confused about floats

2010-10-08 Thread Murat Konar
A stripped down version of  your code works as expected here.


- (IBAction) test:(id) sender
{
//set coordinates to x,y - 0,0 to start
float x = 0;
float y = 0;

while (YES) {

NSLog(@x = %f, y = %f, x, y);
x = x+100;

//if coordinates are too wide, start new row - if x300, reset x to 0 
and add 100 to y
if(x  300){
x = 0;
y = y+100;
}
}
}

I have in the past run into spooky code generation bugs.

http://www.mailinglistarchive.com/xcode-us...@lists.apple.com/msg07399.html

I wonder if you've run into one too. Does it misbehave in both Debug and 
Release builds?

Also, are you sure x is getting past 300?

_murat


On Oct 5, 2010, at 2:07 AM, Amy Heavey wrote:

 I've got two float values (x and y) that I'm using to change the coordinates 
 of a drawing action that is being looped through. I can add a value to x and 
 it draws the next image along, but I want to test the value of x and if it is 
 out of bounds I want to reset it to zero and increase y, so I get a grid of 
 images drawn.
 
 For some reason, even though I can do
 x = x+128;
 and it moves the image accross, x seems to be null so I can't test against 
 it, my if statement ' if (x  300){' always fails.
 
 This must be something really simple I just can't see it this morning? I'd 
 appreciate any help.
 
 Many Thanks
 
 Amy
 
 Full code being used:

[snipped]___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: confused about floats

2010-10-08 Thread Kyle Sluder
Just wanted to confirm that this is a repost of the previous thread?

http://lists.apple.com/archives/cocoa-dev/2010/Oct/msg00117.html

--Kyle Sluder

On Tue, Oct 5, 2010 at 2:07 AM, Amy Heavey a...@willowtreecrafts.co.uk wrote:
 I've got two float values (x and y) that I'm using to change the coordinates
 of a drawing action that is being looped through. I can add a value to x and
 it draws the next image along, but I want to test the value of x and if it
 is out of bounds I want to reset it to zero and increase y, so I get a grid
 of images drawn.

 For some reason, even though I can do
 x = x+128;
 and it moves the image accross, x seems to be null so I can't test against
 it, my if statement ' if (x  300){' always fails.

 This must be something really simple I just can't see it this morning? I'd
 appreciate any help.

 Many Thanks

 Amy

 Full code being used:
        - (IBAction)generateKitImages:(id)sender;
 {
        NSObject *kit;
        kit = [[kits selectedObjects] objectAtIndex:0];

        NSString* fileName = [[kit valueForKey:@kitName]
 stringByAppendingString:@.jpg];
        NSString* kitimagePath = self applicationSupportFolder]
 stringByAppendingPathComponent:@images]
 stringByAppendingPathComponent:@kit]
 stringByAppendingPathComponent:fileName];
        //NSLog(@Kit Image Path: %@, kitimagePath);
        //create new image 300px square
         NSImage *targetImage;
         NSSize targetSize = NSMakeSize (300, 300);
         targetImage = [[NSImage alloc] initWithSize:targetSize];


        //select all images for kit
         NSArray* kitImages = [kit
 valueForKeyPath:@kitItems.kitItemProduct.productImage];

        //set coordinates to x,y - 0,0 to start
        float x = 0;
        float y = 0;
        //for each image
        NSEnumerator *imageLoop = [kitImages objectEnumerator];
        NSString *imgPath;
        while ((imgPath = [imageLoop nextObject])) {
                NSImage *img = [[NSImage
 alloc]initWithContentsOfFile:imgPath];
                //NSLog(@Image: %@,img);
                //resize to 100px high
                        //get original size
                //NSSize *origSize;
                //origSize = [img size];
                        //calculate scale factor
                        //[img setScalesWhenResized: YES];
                        //[img setSize: NSMakeSize (100., 100.)];

                //apply image to view
                [targetImage lockFocus];
                [img drawInRect:NSMakeRect(x,y,100,100)
                                  fromRect:NSMakeRect(x,y,100,100)
                                 operation:NSCompositeCopy
                                  fraction:1];

                [targetImage unlockFocus];

                //set new coordinates
                x = x+100;

                //if coordinates are too wide, start new row - if x300,
 reset x to 0 and add 100 to y
                if(x  300){
                        x = 0;
                        y = y+100;
                }

        }
        //apply kit logo to view
        //apply kit date (text) to view
        //save files out
        //create a NSBitmapImageRep
        NSBitmapImageRep *bmpImageRep = [[NSBitmapImageRep
 alloc]initWithData:[targetImage TIFFRepresentation]];
        //add the NSBitmapImage to the representation list of the target
        [targetImage addRepresentation:bmpImageRep];

        //get the data from the representation
        NSData *data = [bmpImageRep representationUsingType: NSJPEGFileType

             properties: nil];

        //write the data to a file
        [data writeToFile: kitimagePath
                   atomically: NO];
        //link images to kit
        [kit setValue:kitimagePath forKey:@kitImage];
 }

 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kyle.sluder%40gmail.com

 This email sent to kyle.slu...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[iOS] NSUserDefaults-backed Properties

2010-10-08 Thread Carter Allen
Hello everyone!

I'm working on cleaning up an app that was written by a colleague of mine a 
while ago, and one of the things that he did quite a bit was use properties 
(declared as @properties, with custom getters/setters) that are actually backed 
by NSUserDefaults. Seemingly, this was to provide excellent persistence - no 
matter how the app closed or crashed, it always remembered exactly what was 
going on. This is still important even with the advent of multi-tasking, as I 
am still targeting 3.x, as well as users without multi-tasking.

Here's an example of one of his properties:

- (BOOL)gameShouldBeCounted { return [[NSUserDefaults standardUserDefaults] 
boolForKey:@gameShouldBeCounted]; }
- (void)setGameShouldBeCounted:(BOOL)shouldBeCounted {
[[NSUserDefaults standardUserDefaults] setBool:shouldBeCounted 
forKey:@gameShouldBeCounted];
[[NSUserDefaults standardUserDefaults] synchronize];
}

Calling synchronize that often can't possibly be efficient, but it seems to be 
the only way to make sure that defaults actually get written right away. Does 
anyone have any recommendations of how to make this better? I was thinking 
about some sort of KVC/O system, where actual ivars were used and 
NSUserDefaultsController was set to observe them and update asynchronously, but 
I have no idea where to start with a system like that.

Any advice is welcome!

Sincerely,
Carter Allen___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Return value of performSelector:onThread:?

2010-10-08 Thread Bill Bumgarner

On Oct 8, 2010, at 11:52 AM, Kyle Sluder wrote:

 Using GCD:
 
 id myObj;
 dispatch_sync(dispatch_get_main_queue(), ^{ myObj = CreateTheObject(); });

__block id myObj;

 dispatch_sync(dispatch_get_main_queue(), ^{ myObj = CreateTheObject(); });
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Remco Poelstra

Op 8 okt 2010, om 20:34 heeft Quincey Morris het volgende geschreven:


On Oct 8, 2010, at 04:47, Remco Poelstra wrote:

Is there a reason valueForKey: is documented directly but  
valueForKeyPath: is not?


They're both documented, but it requires familiarity with how to  
read the Cocoa documentation, which is an important point that goes  
beyond just this example.


The methods are documented as part of the NSKeyValueCoding protocol  
here:


	http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/ 
Reference.html


It's briefly mentioned, in that document and slightly more  
definitively in:


	http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Conceptual/KeyValueCoding/Concepts/Overview.html


that there's a default implementation of NSKeyValueCoding in  
NSObject. NSDictionary inherits this behavior from NSObject, but  
because the default 'valueForKeyPath:' is documented as operating in  
terms of 'valueForKey:', NSDictionary only needs to override the  
latter, and its own documentation only needs to document the override.


That seems reasonable, but makes the documentation harder to read. In  
the old days where I used Delphi, the inherited methods were all shown  
as such and it gives a direct overview of what is available.  
Especially in this case, where the valueForKey* methods are neither  
mentioned in the NSObject docs, not that NSObject  
followsNSKeyValueCoding. Well, maybe Apple adds such functionality  
someday to their doc browser.


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


CPP reference operator

2010-10-08 Thread koko

can parms be passed to obj-c methods by reference as in

name:(type)parm
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread koko

Thanks.

I am compiling Objective-C++;


-koko


On Oct 8, 2010, at 2:57 PM, Dave Carrigan wrote:


On Oct 8, 2010, at 1:45 PM, k...@highrolls.net wrote:

can parms be passed to obj-c methods by reference as in

name:(type)parm


Yes, as long as you're compiling as Objective-C++ (i.e., your file  
extension is .mm).


--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread Nick Zitzmann

On Oct 8, 2010, at 2:45 PM, k...@highrolls.net wrote:

 can parms be passed to obj-c methods by reference as in
 
 name:(type)parm

Yes, but only if you use ObjC++.

Nick Zitzmann
http://www.chronosnet.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Fritz Anderson
On 8 Oct 2010, at 3:14 PM, Remco Poelstra wrote:

 That seems reasonable, but makes the documentation harder to read. In the old 
 days where I used Delphi, the inherited methods were all shown as such and it 
 gives a direct overview of what is available. Especially in this case, where 
 the valueForKey* methods are neither mentioned in the NSObject docs, not that 
 NSObject followsNSKeyValueCoding. Well, maybe Apple adds such functionality 
 someday to their doc browser.

In Xcode, Project  Class Browser, in the Configure Options sheet, turn on Show 
Inherited Members. Good luck.

— F

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 1:45 PM,  k...@highrolls.net wrote:
 can parms be passed to obj-c methods by reference as in

 name:(type)parm

You know, you can try these things out before you ask the mailing list.

http://gist.github.com/617545

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread koko
I did and was getting, and still am, invalid results. So, I asked to  
be sure I was not violating something and thereby getting invalid  
results.


I ain't that lame ...

-koko


On Oct 8, 2010, at 3:07 PM, Kyle Sluder wrote:


On Fri, Oct 8, 2010 at 1:45 PM,  k...@highrolls.net wrote:

can parms be passed to obj-c methods by reference as in

name:(type)parm


You know, you can try these things out before you ask the mailing  
list.


http://gist.github.com/617545

--Kyle Sluder



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 2:09 PM,  k...@highrolls.net wrote:
 I did and was getting, and still am, invalid results. So, I asked to be sure
 I was not violating something and thereby getting invalid results.

 I ain't that lame ...

In that case, be more forthcoming in describing your specific problem.

Can I do X? is far less helpful than When I try to do X, the
compiler complains about Y and then my cat coughs up a hairball, even
though the latter might contain a red herring.

So what's the specific problem you're having with using reference
types as arguments to Objective-C methods? Include code demonstrating
the problem for best results.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Making Java Calls from Objective-C !!

2010-10-08 Thread Naresh Kongara
Hi,

I want to know how to make java calls from Obj-C. (Java Bridge Seems to be 
deprecated).
Is it possible with out bridge ? If yes , Can any body help me on Where to 
start ?

Thanks,
Kongara___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Making Java Calls from Objective-C !!

2010-10-08 Thread Nick Zitzmann

On Oct 8, 2010, at 3:25 PM, Naresh Kongara wrote:

 Hi,
 
 I want to know how to make java calls from Obj-C. (Java Bridge Seems to be 
 deprecated).
 Is it possible with out bridge ? If yes , Can any body help me on Where to 
 start ?

Under normal circumstances I would be tempted to say STFW, except that, as 
you pointed out, a lot of the information out there on the Web is obsolete. The 
Java Bridge, for instance, was removed from Snow Leopard. So this is actually a 
good question.

So I found this, which has an answer that is not use the bridge but I haven't 
tried it myself: 
http://stackoverflow.com/questions/1822549/calling-java-library-from-objective-c-on-mac

Nick Zitzmann
http://www.chronosnet.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Making Java Calls from Objective-C !!

2010-10-08 Thread Naresh Kongara
Hi,

I think rococoa is for making Objective-C calls from Java, not in opposite way 
(making Java Calls from Objective-C).

Thanks.
Kongara


On Oct 8, 2010, at 2:34 PM, Rui Pacheco wrote:

 Just Objective-C or Cocoa? 
 
 Try this: https://rococoa.dev.java.net/
 
 On 8 October 2010 22:25, Naresh Kongara nkong...@apple.com wrote:
 Hi,
 
 I want to know how to make java calls from Obj-C. (Java Bridge Seems to be 
 deprecated).
 Is it possible with out bridge ? If yes , Can any body help me on Where to 
 start ?
 
 Thanks,
 Kongara___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rui.pacheco%40gmail.com
 
 This email sent to rui.pach...@gmail.com
 
 
 
 -- 
 Best regards,
 Rui Pacheco

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Making Java Calls from Objective-C !!

2010-10-08 Thread Daryl Thachuk
Hi

Yes, it can be done but you need to become good friends with JNI.

http://developer.apple.com/library/mac/#technotes/tn2005/tn2147.html

Good luck!

-daryl

--
Daryl Thachuk
Montage Technologies Inc.
http://www.montagetech.com


On Oct 8, 2010, at 3:25 PM, Naresh Kongara wrote:

 I want to know how to make java calls from Obj-C. (Java Bridge Seems to be 
 deprecated).
 Is it possible with out bridge ? If yes , Can any body help me on Where to 
 start ?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread koko

Well, it appears that the problem is not a language problem.

I was passing a reference to a CPP object instance, doing some work  
and then setting member variables in the CPP object instance. Upon  
inspecting the CPP object instance member variables upon return they  
were displaying 'garbage' in the debugger.  This is what prompted the  
question.


Letting the code run and using NSLog to see the values they are good.

Ergo, this seem to be a 'bug' in the Xcode debugger.

Cost me lots of time though.

-koko

On Oct 8, 2010, at 3:16 PM, Kyle Sluder wrote:


On Fri, Oct 8, 2010 at 2:09 PM,  k...@highrolls.net wrote:
I did and was getting, and still am, invalid results. So, I asked  
to be sure

I was not violating something and thereby getting invalid results.

I ain't that lame ...


In that case, be more forthcoming in describing your specific problem.

Can I do X? is far less helpful than When I try to do X, the
compiler complains about Y and then my cat coughs up a hairball, even
though the latter might contain a red herring.

So what's the specific problem you're having with using reference
types as arguments to Objective-C methods? Include code demonstrating
the problem for best results.

--Kyle Sluder



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem connecting to Oracle with app run from XCode

2010-10-08 Thread Timothy Mowlem
 Greg Guerin wrote:

 Timothy Mowlem wrote:
 
 I can run the XCode built app as well from the command line after  
 setting LD_LIBRARY_PATH (as a non-admin user and without using sudo).

 If that env-var is the cause, then printf() the value of it in both  
 cases, and manually compare them.  Use the getenv() C function.
 
 You might also read the Mac OS X man page for 'dyld', if you haven't  
 done so yet.
 Xcode  Help  Open man Page...
 
  -- GG


Thanks for the input. I might have been slightly misleading but I think 
LD_LIBRARY_PATH is fine. For a while I was getting a link error at runtime 
until I read the XCode documentation and found the correct place to set the env 
var to run it within XCode, by selecting the executable under the Executables 
group, choosing GetInfo and adding the env var under the environment area of 
the Arguments tab.

I confirmed that it is finding and using the library using printfs.

I have also discovered that if I start XCode from the terminal, which means it 
WILL pick up the environment from the shell, that the application DOES then run 
successfully when launched from XCode. So the conclusion is that something in 
my shell environment that is not present in XCode when it is launched normally 
is causing the problem.

Has anyone seen anything similar?


Thanks.

Tim___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Making Java Calls from Objective-C !!

2010-10-08 Thread Greg Guerin

Naresh Kongara wrote:

I want to know how to make java calls from Obj-C. (Java Bridge  
Seems to be deprecated).
Is it possible with out bridge ? If yes , Can any body help me on  
Where to start ?



Use JNI.

Also see this Java-Dev message:
http://lists.apple.com/archives/java-dev/2009/Oct/msg00497.html

Google this:
JavaNativeFoundation

And you might get a better answer by asking on Java-Dev:
http://lists.apple.com/mailman/listinfo/java-dev

  -- GG



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITableViewCell Display Issue

2010-10-08 Thread Jason Barker
In my table view, when a user touches a row, I want to change the alpha
value of a subview within the row's content view via animation as well as
insert some rows below that one or remove some rows from below that one. I'm
able to animate the insertion and deletion of the rows from under the
touched row. But I can't seem to animate the alpha value for a subview. The
crazy part about it all is even though the subview doesn't appear when I
touch the row, if I slide the row out of view and back in view again, it
looks the right way. Can anyone tell me what I'm doing wrong?

Thanks!
Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Making Java Calls from Objective-C !!

2010-10-08 Thread Greg Guerin

Nick Zitzmann wrote:

So I found this, which has an answer that is not use the bridge  
but I haven't tried it myself: http://stackoverflow.com/questions/ 
1822549/calling-java-library-from-objective-c-on-mac


One of its answers is use TCP/IP.  I have done that, and it works  
well.  Same-process JVM via JNI's invocation API, or different  
process running /usr/bin/java via NSTask.  For security, confine the  
network to loopback interface (lo0), which is quite easy to do in Java.


I chose JSON as the data format: simple, compact, readily available  
libs for Cocoa and Java.  I also used CocoaAsyncSocket on the  
Objective-C side, which simplified use of sockets and streams.  YMMV.


  -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Freeing the property list returned by class_copyPropertyList()?

2010-10-08 Thread Rick Mann
How do I free the array I get back from class_copyPropertyList()?

TIA,

-- 
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Freeing the property list returned by class_copyPropertyList()?

2010-10-08 Thread Dave DeLong
free().

Dave

On Oct 8, 2010, at 5:22 PM, Rick Mann wrote:

 How do I free the array I get back from class_copyPropertyList()?
 
 TIA,
 
 -- 
 Rick
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
 
 This email sent to davedel...@me.com



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
I'm trying to add an ivar to a (sub)class in the base class' +initialize 
method. I'm not sure if it's too late to do it at this point or not. If I can't 
do it here, i don't know where to make the call.

I'm calling it like this:

char const* ivarNameCString = ivarName.UTF8String;

size_t size = sizeof (NSData*);
uint8_t align = log2(size);
bool success = class_addIvar(self.class, ivarNameCString, size, align, 
@);

The values for the parameters end up being:

ivarNameCString:mOutputDataCacheChannel1
size:   8
align:  3

The documentation doesn't specify what the last parameter should be, other than 
to name it types. I assumed that was supposed to be a type string, although I 
don't know why you would specify more than one.

Anyway, this returns false, but I have no idea why.

Can anyone help me out? Thanks!

-- 
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble calling class_addIvar()

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 4:39 PM, Rick Mann rm...@latencyzero.com wrote:
 I'm trying to add an ivar to a (sub)class in the base class' +initialize 
 method. I'm not sure if it's too late to do it at this point or not. If I 
 can't do it here, i don't know where to make the call.

From the documentation:

Adding an instance variable to an existing class is not supported.

http://developer.apple.com/library/ios/#documentation/cocoa/reference/ObjCRuntimeRef/Reference/reference.html

Use objc_setAssociatedObject instead.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble calling class_addIvar()

2010-10-08 Thread Dave DeLong
I think you can only use class_addIvar() in between corresponding calls to 
objc_allocateClassPair() and objc_registerClass().

Docs: 
http://developer.apple.com/library/ios/documentation/cocoa/reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/doc/uid/TP40001418-CH1g-SW10

Dave

On Oct 8, 2010, at 5:39 PM, Rick Mann wrote:


 I'm trying to add an ivar to a (sub)class in the base class' +initialize 
 method. I'm not sure if it's too late to do it at this point or not. If I 
 can't do it here, i don't know where to make the call.
 
 I'm calling it like this:
 
   char const* ivarNameCString = ivarName.UTF8String;
   
   size_t size = sizeof (NSData*);
   uint8_t align = log2(size);
   bool success = class_addIvar(self.class, ivarNameCString, size, align, 
 @);
 
 The values for the parameters end up being:
 
 ivarNameCString:  mOutputDataCacheChannel1
 size: 8
 align:3
 
 The documentation doesn't specify what the last parameter should be, other 
 than to name it types. I assumed that was supposed to be a type string, 
 although I don't know why you would specify more than one.
 
 Anyway, this returns false, but I have no idea why.
 
 Can anyone help me out? Thanks!
 
 -- 
 Rick
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
 
 This email sent to davedel...@me.com



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann

On Oct 8, 2010, at 16:42:18, Kyle Sluder wrote:

 On Fri, Oct 8, 2010 at 4:39 PM, Rick Mann rm...@latencyzero.com wrote:
 I'm trying to add an ivar to a (sub)class in the base class' +initialize 
 method. I'm not sure if it's too late to do it at this point or not. If I 
 can't do it here, i don't know where to make the call.
 
 From the documentation:
 
 Adding an instance variable to an existing class is not supported.
 
 http://developer.apple.com/library/ios/#documentation/cocoa/reference/ObjCRuntimeRef/Reference/reference.html

Yes, I read that. I had hoped that I'd be able to add ivars before the class 
was instantiated. In this case, the class is being loaded dynamically at run 
time. Is there no way to get in the middle of the load and add an ivar?

In any case, sure seems like I ought to be able to do it in +initialize.

I'll try objc_setAssociatedObject(). Thanks.

-- 
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble calling class_addIvar()

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 5:00 PM, Rick Mann rm...@latencyzero.com wrote:
 Yes, I read that. I had hoped that I'd be able to add ivars before the class 
 was instantiated. In this case, the class is being loaded dynamically at run 
 time. Is there no way to get in the middle of the load and add an ivar?

 In any case, sure seems like I ought to be able to do it in +initialize.

The documentation states you can't add ivars to classes that have
already been registered. In order for a class to receive +initialize,
it logically must already have been registered with the runtime.
Therefore, it's quite apparent why class_addIvar() can't be called
from +initialize.

The fact that you want to add instance variables to a class at all is
a terrible code smell. Like Fresh Kills Landfill bad. What are you
trying to achieve?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann
Oh. I can't even really use this. I don't know what I need to associate at 
runtime, at which point I know what it is by a string value. Since I can't use 
a string value as a key, I can't really make the association. I could associate 
an NSMutableDictionary, but if I do that, I may as well just make that a member 
of my base class.

On Oct 8, 2010, at 17:12:28, Kyle Sluder wrote:

 On Fri, Oct 8, 2010 at 5:00 PM, Rick Mann rm...@latencyzero.com wrote:
 Yes, I read that. I had hoped that I'd be able to add ivars before the class 
 was instantiated. In this case, the class is being loaded dynamically at run 
 time. Is there no way to get in the middle of the load and add an ivar?
 
 In any case, sure seems like I ought to be able to do it in +initialize.
 
 The documentation states you can't add ivars to classes that have
 already been registered. In order for a class to receive +initialize,
 it logically must already have been registered with the runtime.
 Therefore, it's quite apparent why class_addIvar() can't be called
 from +initialize.
 
 The fact that you want to add instance variables to a class at all is
 a terrible code smell. Like Fresh Kills Landfill bad. What are you
 trying to achieve?
 
 --Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble calling class_addIvar()

2010-10-08 Thread Rick Mann

On Oct 8, 2010, at 17:12:28, Kyle Sluder wrote:

 The documentation states you can't add ivars to classes that have
 already been registered. In order for a class to receive +initialize,
 it logically must already have been registered with the runtime.
 Therefore, it's quite apparent why class_addIvar() can't be called
 from +initialize.

Hmm...thinking about it a bit more...how do dynamically-synthesized property 
ivars work (where you just @synthesize them without declaring an ivar)? Do they 
use class_addIvar()? That suggests I'm wrong about class layout.

-- 
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


main window disappears on resize

2010-10-08 Thread Shane
I have a document based application with a main window that, when I
try to resize the window, the window just completely disappears. The
application doesn't crash and I can open up another window by 'Project
-- New' in the main menu. And of course if I try to resize it, it
will disappear. And my debugger doesn't show anything when it
disappears. Any idea how to help track this problem down?

Any help much appreciated.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: main window disappears on resize

2010-10-08 Thread Kyle Sluder
On Fri, Oct 8, 2010 at 5:28 PM, Shane
software.research.developm...@gmail.com wrote:
 I have a document based application with a main window that, when I
 try to resize the window, the window just completely disappears. The
 application doesn't crash and I can open up another window by 'Project
 -- New' in the main menu. And of course if I try to resize it, it
 will disappear. And my debugger doesn't show anything when it
 disappears. Any idea how to help track this problem down?

Break on -[NSWindow orderOut:]?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ivars and fundamental types

2010-10-08 Thread Rick Mann
Can I not use the objective-C runtime to get and set an objects ivar's if they 
are of primitive types like int and float?

-- 
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


SRV record lookup

2010-10-08 Thread Jeremy Matthews
In one of my apps (Cocoa Desktop 10.6+ - not iOS) I need to perform some SRV 
lookups; I know there are a few ways to do this, but I'd like to know if anyone 
can speak from experiencefrom this link I can see that there are indeed a 
few different methodsany ideas?

http://stackoverflow.com/questions/258284/srv-record-lookup-with-iphone-sdk

Thanks,
jeremy

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Trouble calling class_addIvar()

2010-10-08 Thread Bill Bumgarner

On Oct 8, 2010, at 5:27 PM, Rick Mann wrote:

 Hmm...thinking about it a bit more...how do dynamically-synthesized property 
 ivars work (where you just @synthesize them without declaring an ivar)? Do 
 they use class_addIvar()? That suggests I'm wrong about class layout.

It be compilation time code generation  with the new runtime(s), the 
compiler can generate the storage during compilation of the class's 
implementation

b.bum

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CPP reference operator

2010-10-08 Thread Scott Ribe
On Oct 8, 2010, at 4:20 PM, k...@highrolls.net wrote:

 Ergo, this seem to be a 'bug' in the Xcode debugger.
 
 Cost me lots of time though.

Sorry, but if you're going to use Objective-C++, you're going to have get used 
to that. The debugger ***SUX*** at display of C++ types, so when you see 
something that you can't understand, step 1 is nearly always to add some 
logging so that you can see the real values. Although most of the time this is 
not really a problem, since most of the time instead of displaying garbage, it 
just refuses to display any values.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ivars and fundamental types

2010-10-08 Thread Sherm Pendley
On Fri, Oct 8, 2010 at 9:50 PM, Rick Mann rm...@latencyzero.com wrote:
 Can I not use the objective-C runtime to get and set an objects ivar's if 
 they are of primitive types like int and float?

Of course you can - it would be useless otherwise. Where did you get
the idea you can't?

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ivars and fundamental types

2010-10-08 Thread Rick Mann

On Oct 8, 2010, at 20:04:13, Sherm Pendley wrote:

 On Fri, Oct 8, 2010 at 9:50 PM, Rick Mann rm...@latencyzero.com wrote:
 Can I not use the objective-C runtime to get and set an objects ivar's if 
 they are of primitive types like int and float?
 
 Of course you can - it would be useless otherwise. Where did you get
 the idea you can't?

object_setIvar() takes type id.

-- 
Rick


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ivars and fundamental types

2010-10-08 Thread Dave Keck
 object_setIvar() takes type id.

object_getInstanceVariable()?

outValue: On return, contains a pointer to the value of the instance variable.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ivars and fundamental types

2010-10-08 Thread Dave DeLong
And its inverse, object_setInstanceVariable, which takes a void* to the new 
value of the ivar.

Cheers,

Dave

On Oct 8, 2010, at 10:18 PM, Dave Keck wrote:

 object_setIvar() takes type id.
 
 object_getInstanceVariable()?
 
 outValue: On return, contains a pointer to the value of the instance 
 variable.


smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com