I'd like to use a CALayer object as a key in a dictionary. The reason is that
when my app detects a hit in a layer, I need to quickly determine which object
I've associated with it. Since I can't store a reference to an arbitrary object
in the CALayer, a dictionary seems to be the most expedient
Because NSDictionary requires keys to be copyable because it copies them
(it's in the documentation). Use a CFDictionary() instead, you can set
it up to retain the keys and do what you want.
Rick Mann wrote:
I'd like to use a CALayer object as a key in a dictionary. The reason is that
when my
On Feb 1, 2010, at 00:10:11, Roland King wrote:
> Because NSDictionary requires keys to be copyable because it copies them
> (it's in the documentation). Use a CFDictionary() instead, you can set it up
> to retain the keys and do what you want.
Oh! I thought NSDictionary and CFDictionary were
Not at all!
The bug comes from the fact that it is called twice, first when the document's
nib is loaded (and everything is ok) and secondly when the panel opens in which
case yes it crashes becaus e initialization already took place and it shouldn't
be called however.
regards.
On Feb 1, 2010,
On Mon, Feb 1, 2010 at 6:55 AM, Jens Alfke wrote:
>
> On Jan 31, 2010, at 7:39 AM, slasktrattena...@gmail.com wrote:
>
>> This looks like a bug in AppKit but I'm not sure. Any ideas? (I cannot
>> reproduce the problem.)
>
> No, it's a bug in 'myProject' — it's calling AppKit from a background thre
Tollfree Bridging is a little more complicated than that. They may end
up being the same object under the covers, but even if they are, the
NSDictionary version doesn't come with the range of options that the
CFDictionary does. Just make a CFDictionary(), the default for it is to
retain keys (a
I tried doing this:
const void*
retainCallback(CFAllocatorRef inAlloc, const void* inValue)
{
NSObject* val = (NSObject*) inValue;
[val retain];
return val;
}
void
releaseCallback(CFAllocatorRef inAlloc, const void* inValue)
{
NSObject* val = (NSObject*) inValue;
Don't bother with custom callback, CFType one works with any objects.
Le 1 févr. 2010 à 09:32, Rick Mann a écrit :
> I tried doing this:
>
> const void*
> retainCallback(CFAllocatorRef inAlloc, const void* inValue)
> {
> NSObject* val = (NSObject*) inValue;
> [val retain];
> r
On Feb 1, 2010, at 00:40:28, Jean-Daniel Dupas wrote:
> Don't bother with custom callback, CFType one works with any objects.
Well, that was the one I tried first, but it failed with the same error.
> Le 1 févr. 2010 à 09:32, Rick Mann a écrit :
>
>> I tried doing this:
>>
>> const void*
>> re
As I said in my earlier mail, if I set up a CFDictionary() which is not
copy for keys and retain for values, then I don't use tollfree bridging
and use the NSMutableDictionary mutators because they don't work. (in my
experience)
I use CFDictionaryAddValue() instead.
When checking for keys or
Oh I see. Have to use "pure" CFDictionary.
Well, it's all moot, since I can just story the object with the CALayer. Thanks
for that!
--
Rick
On Feb 1, 2010, at 00:49:23, Roland King wrote:
> As I said in my earlier mail, if I set up a CFDictionary() which is not copy
> for keys and retain fo
Alternatively you could wrap the CALayer in an NSValue: [NSValue
valueWithNonretainedObject:].
___
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-de
On Feb 1, 2010, at 01:38:17, Dave Keck wrote:
> Alternatively you could wrap the CALayer in an NSValue: [NSValue
> valueWithNonretainedObject:].
Ah, something else to keep in mind. Thanks!
--
Rick
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.c
Hello list,
I'm using NSDocument default undoManager but want to override it's change
counting behaviour
(I want the black modifed dot to not show when some minor changes are done, but
still have them undoable)
I've discovered it's internally handled by these methods observing the
undoManager'
On 01/02/2010, at 9:27 PM, Ernesto Giannotta wrote:
> Hello list,
>
> I'm using NSDocument default undoManager but want to override it's change
> counting behaviour
> (I want the black modifed dot to not show when some minor changes are done,
> but still have them undoable)
>
> I've discovere
Hi
I've been playing around with the idea of making a simple bridge between
Objective-C (running under Cocoa) and a script language. Not for the API, that
is, but for user defined classes and methods. For this reason, I'd like to know
whether there are any other ways than NSInvocation to send a
On Jan 31, 2010, at 19:03, Matt Neuburg wrote:
> There's a common misconception here, and I see a lot of nonsense written
> about it, to which I with difficulty restrain myself from responding. It's
> all very simple.
>
> (1) There is no such thing as a bidirectional binding; all bindings are
> u
On Jan 31, 2010, at 9:53 PM, Jens Alfke wrote:
> No. You don't want to pass a null terminated string to anything but the
> methods that explicitly take a C string. Anything else just wants the
> characters, with no nulls.
>
> --Jens {via iPhone}
NSString's +stringWithCString:encoding: does
On Jan 31, 2010, at 9:49 PM, Kyle Sluder wrote:
> On Sun, Jan 31, 2010 at 6:28 PM, Stuart Malin wrote:
>> If I use +dataWithBytes:length: then I need to specify a length 1 greater,
>> and that additional byte must be set to 0 (to null terminate the string).
>> So, I could use NSMutableData, th
Hello fellow Cocoa-devs,
Does anyone know where to find a good tutorial or more information about
writing a bindings-compatible subclass of NSView? I've seen Apple's example
code on the subject, but it looks like it's a lot more complicated than it
should be. I don't need Interface Builder supp
Hello all:
I have a string with the html I created, i the following:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>
Untitled Document
when parsing Im doing the following:
NSXMLDocument * xmlDoc = [[[NSXMLDocument alloc] initWithXMLString:[webD
I read the following passage (reproduced verbatim) in a book ..
"Weak references were added in Mac OS X Leopard and effectively zero out the
reference if the referenced object is released. This is primarily used when the
garbage collector is turned on, but it is a helpful flag to use when doing
Half Activist wrote:
> On Feb 1, 2010, at 8:54 AM, Alexey Zakhlestin wrote:
>
>> On 01.02.2010, at 10:13, Half Activist wrote:
>>
>>> Hello,
>>> In a NSDocument based application, my document class handles 3
>>> different kinds of documents, 1 as a viewer and 2 as an editor.
>>> Actuall
I have followed the following steps properly. And I used PushMeBaby
application as the server to test push notifications since I not having much
experience in implementing server side code my self for push notification.
Using my adHoc Distribution profile..
PushMeBaby source code -
http://stefan.h
You're going at it backwards. Do your UI work on the main thread, and
run your importer on the background thread. Or better yet use Grand
Central Dispatch.
--Kyle Sluder
On Jan 31, 2010, at 8:02 PM, Patrick Cusack
wrote:
As I understand then, all drawRect methods must be made from the
Ooh. So you need to perform this operation synchronously but still
pole the main thread (performing UI work is actually irrelevant; you
need to run the runloop to avoid the spinning beachball anyway).
So in your override of -writeToURL:…, spin off the background thread
like I suggested, the
On 2010-02-01 03:26, Roland King wrote:
By the way, CALayer is a KVC compliant class so you can in fact just
store a reference to an arbitrary object in it with
[ layer setValue:value forKey:@"KeyForObjectAssociatedWithLayer" ];
Roland, I'm a noob and I'm not sure I've got a good handle o
> On Mon, 2010/02/01, Ernesto Giannotta wrote:
> From: Ernesto Giannotta
> Subject: NSDocument override Undo's default handling of changes count
> To: "Cocoa List"
> Date: Monday, 2010 February 1, 04:27
> I'm using NSDocument default undoManager but want to
> override it's change counting behavi
On 1 feb 2010, at 06.08, Roland King wrote:
> I understand that __weak references are zeroing in GC code but in memory
> managed code I didn't think they did anything at all. Is the text I quoted
> incorrect?
Yes, __weak doesn't do anything for RC.
j o a r
_
Do you really really have to lock the UI? Are you sure?
--
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator c
Am 01.02.2010 um 16:35 schrieb Charles Jenkins:
> On 2010-02-01 03:26, Roland King wrote:
>>
>> By the way, CALayer is a KVC compliant class so you can in fact just store a
>> reference to an arbitrary object in it with
>>
>> [ layer setValue:value forKey:@"KeyForObjectAssociatedWithLayer" ];
yes I just picked a totally random key name tied to the question the original
poster was asking, it was supposed to be illustrative (he wanted to associate
an object with the layer so I picked a name to attempt to show that).
No sorry in general it doesn't work that way, it's possible, probably
Quick followup: is it safe to set the token field's object value from
the background thread, or do I need to do it on the main thread as
well? Or to put it in more general terms: are _all_ calls to AppKit
from a background thread disallowed, or only those regarding updating
the UI?
Also, is it thr
[SOVED]
Hello, sometimes I curse myself for not trying harder before posting.
I just initialized the xmlDoc with options NSXMLPreserveCDATA and
NSXMLDCocument TidHML..
then I was accessing nodes from the rootNode, and I could see in debug all.
Gustavo
On Feb 1, 2010, at 3:01 PM, Gustavo Pizan
You're not allowed to do *anything* on non-main threads unless the
documentation *explicitly* says that it's OK. You should approach this subject
with great caution and restraint. If you can't prove that something is safe,
assume that it's not, and stay away from it.
j o a r
On 1 feb 2010, at
On Mon, 1 Feb 2010 08:43:27 -0500, Alexander Heinz
said:
>Hello fellow Cocoa-devs,
>
>Does anyone know where to find a good tutorial or more information about
writing a bindings-compatible subclass of NSView?
Did you even *try* google? Searching on "bindings tutorial nsview subclass"
led almost d
On Feb 1, 2010, at 6:08 AM, Roland King wrote:
> I read the following passage (reproduced verbatim) in a book ..
>
> "Weak references were added in Mac OS X Leopard and effectively zero out the
> reference if the referenced object is released. This is primarily used when
> the garbage collecto
On Feb 1, 2010, at 3:30 AM, Per Bull Holmen wrote:
> I've been playing around with the idea of making a simple bridge between
> Objective-C (running under Cocoa) and a script language. Not for the API,
> that is, but for user defined classes and methods. For this reason, I'd like
> to know whe
On Mon, Feb 1, 2010 at 8:16 AM, slasktrattena...@gmail.com
wrote:
> Quick followup: is it safe to set the token field's object value from
> the background thread, or do I need to do it on the main thread as
> well? Or to put it in more general terms: are _all_ calls to AppKit
> from a background t
On Feb 1, 2010, at 3:58 AM, Stuart Malin wrote:
> My code worked fine with NSString's +stringWithCString:length: even though
> the string was not NULL terminated.
Ah, you're right, I'd forgotten that method. It doesn't look for a NUL
terminator because the length is given explicitly.
You st
On Feb 1, 2010, at 7:20 AM, Kyle Sluder wrote:
> So in your override of -writeToURL:…, spin off the background thread like I
> suggested, then set up your UI, and then start running the runloop in a
> special modal mode until your background thread is done.
Nested runloops like this are usuall
On Mon, Feb 1, 2010 at 8:38 AM, Matt Neuburg wrote:
> Did you even *try* google? Searching on "bindings tutorial nsview subclass"
> led almost directly to this.
The OP explained that he was confused by the sample code.
--Kyle Sluder
___
Cocoa-dev mail
Hello,
I am forwarding a job request I was sent recently. It's from a
technical recruiter, Bob Wallace. Please contact him for any
information in regards to this job request.
Regards,
Lee
-
Job Description
We are looking for a talented individual to take over the future
development and mai
I'm not making any assumption on the number of documents that might exist at
one time.
Even if i have 10 documents opened, the one that i do a "save as" on has its
_instance method_ awakeFromNib called a second time:
The callstack shows that my document's awakeFromNib is being called during the
On Mon, Feb 1, 2010 at 9:16 AM, Half Activist wrote:
> Even if i have 10 documents opened, the one that i do a "save as" on has its
> _instance method_ awakeFromNib called a second time:
Are you sure it's the same instance? It really looks like you have
accidentally added an NSDocument instance
On Mon, Feb 1, 2010 at 5:28 PM, Joar Wingfors wrote:
> You're not allowed to do *anything* on non-main threads unless the
> documentation *explicitly* says that it's OK. You should approach this
> subject with great caution and restraint. If you can't prove that something
> is safe, assume that
On Feb 1, 2010, at 8:57 AM, Jens Alfke wrote:
>
> On Feb 1, 2010, at 7:20 AM, Kyle Sluder wrote:
>
>> So in your override of -writeToURL:…, spin off the background thread like I
>> suggested, then set up your UI, and then start running the runloop in a
>> special modal mode until your backgro
On Jan 30, 2010, at 5:11 AM, patrick machielse wrote:
> I've given animationImages a try, and although performance is good I run into
> memory warnings when the array contains about 30 full screen images (1 Sec.
> worth). I've tried to implement my own NSView subclass -- managing memory for
> U
On Feb 1, 2010, at 12:26 AM, James wrote:
> So, I expect someone give me some directions.
Don't expect anything from this list, because we're all volunteers.
> for example, which protocol should I use?
What protocol does the server use? If it uses WebDAV, then you should use HTTP
PUT. If it u
On Feb 1, 2010, at 11:38 AM, Matt Neuburg wrote:
> On Mon, 1 Feb 2010 08:43:27 -0500, Alexander Heinz
> said:
>> Hello fellow Cocoa-devs,
>>
>> Does anyone know where to find a good tutorial or more information about
> writing a bindings-compatible subclass of NSView?
>
> Did you even *try* goo
On Mon, Feb 1, 2010 at 3:05 AM, Rick Mann wrote:
> I'd like to use a CALayer object as a key in a dictionary. The reason is that
> when my app detects a hit in a layer, I need to quickly determine which
> object I've associated with it. Since I can't store a reference to an
> arbitrary object i
On Jan 29, 2010, at 6:44 PM, Chunk 1978 wrote:
> i'm almost 100% sure it's not possible to return a nil on basic data
> types, but just incase i'll post the question.
>
> --
> - (float)panForSoundWithName:(NSString *)soundName
> {
>
On Mon, Feb 1, 2010 at 10:20 AM, Kyle Sluder wrote:
> Ooh. So you need to perform this operation synchronously but still pole the
> main thread (performing UI work is actually irrelevant; you need to run the
> runloop to avoid the spinning beachball anyway).
>
> So in your override of -writeToURL:
add a
Person or Game to an Event.
How can i manage this?
http://idisk.me.com/andreasgrauel/Public/Pictures/Skitch/Kegeln-20100201-184547.png
there you see my interface. I would like to add a
person(Spieler)/game(Spiel) to the event with the + Button but how? I have
the autogenerated accessor Method
On Feb 1, 2010, at 12:16 PM, Half Activist wrote:
> I'm not making any assumption on the number of documents that might exist at
> one time.
> Even if i have 10 documents opened, the one that i do a "save as" on has its
> _instance method_ awakeFromNib called a second time:
> The callstack show
Le 1 févr. 2010 à 19:17, Michael Gardner a écrit :
> On Jan 29, 2010, at 6:44 PM, Chunk 1978 wrote:
>
>> i'm almost 100% sure it's not possible to return a nil on basic data
>> types, but just incase i'll post the question.
>>
>> --
>> - (floa
On Mon, Feb 1, 2010 at 6:30 AM, Per Bull Holmen wrote:
> Hi
>
> I've been playing around with the idea of making a simple bridge between
> Objective-C (running under Cocoa) and a script language. Not for the API,
> that is, but for user defined classes and methods. For this reason, I'd like
> t
On Feb 1, 2010, at 3:30 AM, Per Bull Holmen wrote:
> I've been playing around with the idea of making a simple bridge between
> Objective-C (running under Cocoa) and a script language. Not for the API,
> that is, but for user defined classes and methods. For this reason, I'd like
> to know wheth
So, let me clarify further:
Someone asked why a save operation would take a few seconds. I can answer that
I have an object model that is stored in ram and then serialized to disk. I
should have started the data model as a Coredata project, but decided not to
since my datasets would never be th
On Feb 1, 2010, at 08:00:45, Alexander Spohr wrote:
> This is a wrong assumption.
> Most classes are KVC compliant but you can not invent keys. You just use
> existing keys - properties and methods.
Ah! That's the key piece of information. Now I feel better that I didn't
totally misunderstand
On Feb 1, 2010, at 12:11 PM, Patrick Cusack wrote:
As for NSRunLoop, let me see if I understand. I have created a new
Thread with [NSThread detachNewThreadSelector:toTarget:withObject:].
The selector is a do loop that periodically calls a custom NSView's
redisplay method that invokes [NSVi
Dear cocoa-ites,
I have multiple linked NSTableViews in an app. Depending on which one
is clicked in the others change their contents. Now normally if
someone clicks on table 1 they should not be allowed to have multiple
selections; but if they click in table 2, the application needs to be
What I am trying to accomplish is displaying a menu (perhaps with
NSPopUpButtonCell's performClickWithFrame method) after a user clicks on a
sublass of NSButton and holds the left mouse button for >= 1 second.
Is anyone aware of any sample code doing this?
I imagine I will need to customize the
An alternative technique would be roughly:
1. Detect mouse down, set state down
2. Call performSelectorAfterDelay 1 second with a test method
3. If the mouse goes up, set state up
4. In the test method, test if the state is down...
On Feb 1, 2010, at 4:42 PM, Eric Gorr wrote:
> What I am trying
Eric Hi, What Richar said its what Im actually doing to achieve such a
behaviour, using the performSelectorAfterDelay, will be your best shot but what
I do is that if the mouse goes up you just call the the NSObject method
cancelPreviousPerformRequestsWithTarget. then the selector will not be
p
Sadly, that does not work.
performSelector:withObject:afterDelay: will only perform the selector after a
delay after the mouse button goes up. I had actually tried doing this manually
with the code
NSTimer *mouseStillDownTimer = [NSTimer timerWithTimeInterval:1 target:self
selector:@selector(
Strange, I just replied to Richard saying that my selector is not performed
until after the mouse button goes up. I can hold the mouse button down for
several seconds and not see the selector performed.
Of course, this may actually be due to the fact that my core event loop is
based around Rece
Might try pausing execution after the mouse down to see what's preventing the
run loop from pumping. PerformSelector... puts an event on the run loop, so it
must not be getting to future events. When you let your finger off the mouse,
the selector is performed with no delay correct?
On Feb 1,
I am actually not sure how to pause the execution while holding the mouse
button down.
It appears there is a delay...the delay I specified in
performSelector:withObject:afterDelay: ... however, the selector is always
performed.
On Feb 1, 2010, at 5:15 PM, Richard Penwell wrote:
> Might try p
Hi Eric,
Consider using a single-segment NSSegmentedControl. If the NSSegmentedControl
has both an action and a menu, then you will get the behavior you describe.
Furthermore, it will use the system-standard menu delay, plus make the menu
available to accessibility clients.
-Peter
On Feb 1,
On Feb 1, 2010, at 2:11 PM, Eric Gorr wrote:
> Strange, I just replied to Richard saying that my selector is not performed
> until after the mouse button goes up. I can hold the mouse button down for
> several seconds and not see the selector performed.
>
> Of course, this may actually be due
I like this. I shall have to play around with it a bit. Although, I
don't think it will have other features I need from NSButton like
setShowsBorderOnlyWhileMouseInside. But, I could probably have my subclass
implement that, which may be easier then getting the NSButton to show a menu
Hi,
is there NSView method, maybe delegate, that is called only when a view is
changed size, like -reshape NSOpenGLView?
--
best regards
Ariel
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comment
On Mon, Feb 1, 2010 at 2:49 PM, Ariel Feinerman wrote:
> is there NSView method, maybe delegate, that is called only when a view is
> changed size, like -reshape NSOpenGLView?
Read up on NSViewFrameDidChangeNotification.
--Kyle Sluder
___
Cocoa-dev ma
On 02/02/2010, at 9:49 AM, Ariel Feinerman wrote:
> is there NSView method, maybe delegate, that is called only when a view is
> changed size
-setFrame:
--Graham
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requ
Graham,
my implementation
- (void) setFrame: (NSRect) frame {
[super setFrame: frame];
// set sizes
}
2010/2/2 Graham Cox
>
> On 02/02/2010, at 9:49 AM, Ariel Feinerman wrote:
>
> > is there NSView method, maybe delegate, that is called only when a view
> is
> > changed size
>
>
> -se
On Feb 1, 2010, at 2:42 PM, Eric Gorr wrote:
> What I am trying to accomplish is displaying a menu (perhaps with
> NSPopUpButtonCell's performClickWithFrame method) after a user clicks on a
> sublass of NSButton and holds the left mouse button for >= 1 second.
>
> Is anyone aware of any sample
Very cool. Thank you!
I shall have to bookmark that page.
On Feb 1, 2010, at 6:18 PM, Nathan Kinsinger wrote:
> On Feb 1, 2010, at 2:42 PM, Eric Gorr wrote:
>
>> What I am trying to accomplish is displaying a menu (perhaps with
>> NSPopUpButtonCell's performClickWithFrame method) after a user
OK, first, thanks to Quincey for pointing out the document on KVO/KVB key
requirements. Since I've made several mistakes along the way, I figured I'd ask
if this seems adequate to ensure conversion of arbitrary strings (keyboard
entered) into compliant keys. The code subsequently checks to ensur
the selector is always performed because you don’t cancel it when the mouse is
let up in < 1 second.
that’s the missing part.
you need to remove the call.
check almost any iPhone touch stuff that does double taps for an example.
On Feb 1, 2010, at 5:19 PM, Eric Gorr wrote:
> I am actually not
On Feb 1, 2010, at 2:08 PM, Eric Gorr wrote:
> performSelector:withObject:afterDelay: will only perform the selector after a
> delay after the mouse button goes up. I had actually tried doing this
> manually with the code
>
> NSTimer *mouseStillDownTimer = [NSTimer timerWithTimeInterval:1 targ
Hi Kyle,
the problem is my save panel doesn't have an accessory view :S
Regards.
On Feb 1, 2010, at 6:28 PM, Kyle Sluder wrote:
> On Mon, Feb 1, 2010 at 9:16 AM, Half Activist wrote:
>> Even if i have 10 documents opened, the one that i do a "save as" on has its
>> _instance method_ aw
> On Jan 29, 2010, at 9:38 AM, Jerry Krinock wrote:
>
>>
>> The problem is that when a subclass A is selected, the UI elements bound to
>> subclass B no longer have valid bindings so generate an error. How can I
>> solve this?
>
> You can also uncheck the "Raises For Not Applicable Keys" in th
Hi Gregory,
thanks for your support, I was a bit upset because I'm pretty sure the
same instance fails. Because when the crashes began to happen after adding the
second document type, I put a breakpoint in awakeFromNib, and by giving a look
at the document, I knew that this was a documen
On Feb 1, 2010, at 12:58 PM, Jean-Daniel Dupas wrote:
>
> Le 1 févr. 2010 à 19:17, Michael Gardner a écrit :
>
>> On Jan 29, 2010, at 6:44 PM, Chunk 1978 wrote:
>>
>>> i'm almost 100% sure it's not possible to return a nil on basic data
>>> types, but just incase i'll post the question.
>>>
>>
85 matches
Mail list logo