Why get my constraints broken?
I have a xib-file with an NSView (content view of a tab of an NSTabView) called TabTextView. Inside this TabTextView I have an NSScrollView (containing an NSTextView) called ScrollText which: - has a top vertical distance to it's superView (TabTextView) of 12 - has a height of 33 or more - has a bottom vertical distance to it's superView (TabTextView) of 17. Sounds quite reasonable to me. But when I load this xib file I get some strange messages (hex addresses edited for readability): ... Unable to simultaneously satisfy constraints: ( "=33)] (Names: ScrollText:0XB )>", "", "", "" ) Will attempt to recover by breaking constraint =33)] (Names: ScrollText:0XB )> ... Unable to simultaneously satisfy constraints: ( "", "", "" ) Will attempt to recover by breaking constraint What am I doing wrong? I don't like these warnings, and I resent the breaking of my constraint V:[ScrollText(>=33)] which I put there for a good reason. Kind regards Gerriet. P.S. 10.7.3, Xcode 4.3.2 ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Recursive call-back block
Hello, The (prototype) code below updates a number of objects of a NSManagedObject-sublass (Progenitor) from a remote host. As the number of objects to update is unknown I would like to use a call-back passed to the updater class invoked by startParserWithObjectId: completionBlock: to recursively call returnblock on the next progenitor-object, so serially, when the update-task has completed. However, the static analyser gives me the warning : "Variable 'returnblock' is uninitialized when captured by block". It is unclear to me how to interpret the message. Can anyone shed light on it? NSEnumerator __block *collectionEnum = [progenitors objectEnumerator]; Progenitor *firstProgenitor = [collectionEnum nextObject]; void (^returnblock)(Progenitor *) = ^(Progenitor *aProgenitor) { if (aProgenitor == nil) return; CellUpdater *aCellUpdater = [[CellUpdater alloc] init]; [aCellUpdater setThisPersistentStoreCoordinator:thisPersistentStoreCoordinator]; [aCellUpdater startParserWithObjectId:[aProgenitor objectID] completionBlock:^(NSManagedObjectID *anID) { [[NSNotificationCenter defaultCenter] postNotificationName:@"updateExistsForProgenitor" object:anID]; returnblock([collectionEnum nextObject]); }]; }; returnblock(firstProgenitor); Thanks, Mikkel ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to bind to NSMutableArray that may contain zero objects?
The problem I'm trying solve is that I have a crashing bug in the UI when an underlying array managed by an NSArrayController contains zero objects. The controls bound to the array-controller include an NSPopUpButton, an NSTextField, and four NSButtons. -Michael On Apr 3, 2012, at 6:53 PM, Quincey Morris wrote: > On Apr 3, 2012, at 15:29 , Michael Crawford wrote: > >> Using and NSArrayController I'd like to bind the controller to an instance >> of NSMutableArray, which under certain circumstances may contain zero >> objects. I don't have any real experience with NULL placeholders but I >> assume this situation is what they are for. Can someone give me some >> guidance regarding how to leverage NULL placeholders in this situation or >> better yet, point me to an example? >> >> Alternatively, I'm thinking I can create my own dummy (placeholder) object >> and insert it into the array when there are no other real object instances >> to be accessed. If you have an opinion on this work-around, I'd like to >> hear from you, as well. > > There's nothing wrong with having an array of 0 elements, and no general need > to create a placeholder to deal with this situation. > > Presumably, the real issue is what to show in your user interface when the > array is empty, but you didn't give us much to go on for that. > > Note that array controllers automatically provide some placeholder objects > for various situations, including no selection, multiple selection, and a nil > object. Depending on what you're trying to do, these might provide a solution > without additional coding. > > Can you back up one step and describe the problem you're actually trying to > solve? > > ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to set the foreground and background colors of selected text in a field editor (NSTextView)?
I've tried two different approaches. The first thing I tried was to make may app-delegate the delegate for my window and then implement -windowWillReturnFieldEditor:toObject:. - (void)awakeFromNib { _fieldEditor = [NSTextView new]; [_fieldEditor setFieldEditor:YES]; NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSColor redColor], NSBackgroundColorAttributeName, /* something obvious so I can see it */ [NSColor yellowColor], NSForegroundColorAttributeName, nil]; [_fieldEditor setSelectedTextAttributes:attributes]; } - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client { if ( [client isKindOfClass:[NSTextField class]] ) { return _fieldEditor; } return nil; } Next, I tried something I found in a blog via Google at http://www.ff00aa.com/fr/archives/2009/02/28/9969-changing-the-selected-text-s-color-for-an-nstextfield/. - (void)viewDidMoveToWindow:(NSWindow *)window { if ( window != nil ) { NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSColor redColor], NSBackgroundColorAttributeName, [NSColor yellowColor], NSForegroundColorAttributeName, nil]; // object-shadow text-field NSTextView *fieldEditor = (NSTextView *)[window fieldEditor:YES forObject:_shadowTextField]; [fieldEditor setSelectedTextAttributes:attributes]; // vignette text-field fieldEditor = (NSTextView *)[window fieldEditor:YES forObject:_vignetteTextField]; [fieldEditor setSelectedTextAttributes:attributes]; // opacity text-field fieldEditor = (NSTextView *)[window fieldEditor:YES forObject:_opacityTextField]; [fieldEditor setSelectedTextAttributes:attributes]; } } End result: In both cases I get the default white on cyan or whatever color you call it. Anyone have a technique that works or some experience with this type of modification? -Michael ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Cannot autosave a TableView without headers
I have an NSTableView which should NOT show headers ( so I deselected in Xcode 4.3.2 the Headers checkbox. But now it no longer autosaves it's data. Checked the Headers checkbox again - now it autosaves as expected. Why? What is the magic connection between showing headers and autosaving? Kind regards, Gerriet. P.S. 10.7.3 ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Recursive call-back block
On 10 Apr 2012, at 9:13 AM, Mikkel Islay wrote: > Hello, > > The (prototype) code below updates a number of objects of a > NSManagedObject-sublass (Progenitor) from a remote host. As the number of > objects to update is unknown I would like to use a call-back passed to the > updater class invoked by startParserWithObjectId: completionBlock: to > recursively call returnblock on the next progenitor-object, so serially, when > the update-task has completed. > > However, the static analyser gives me the warning : "Variable 'returnblock' > is uninitialized when captured by block". It is unclear to me how to > interpret the message. Can anyone shed light on it? > >NSEnumerator __block *collectionEnum = [progenitors objectEnumerator]; >Progenitor *firstProgenitor = [collectionEnum nextObject]; > >void (^returnblock)(Progenitor *) = ^(Progenitor *aProgenitor) { >if (aProgenitor == nil) return; > CellUpdater *aCellUpdater = [[CellUpdater alloc] init]; >[aCellUpdater > setThisPersistentStoreCoordinator:thisPersistentStoreCoordinator]; > >[aCellUpdater startParserWithObjectId:[aProgenitor objectID] > completionBlock:^(NSManagedObjectID *anID) { > [[NSNotificationCenter defaultCenter] > postNotificationName:@"updateExistsForProgenitor" object:anID]; >returnblock([collectionEnum nextObject]); > }]; >}; > > returnblock(firstProgenitor); The block literal [ ^(Progenitor *aProgenitor) { ... ] is created first. Then the address of the created block is assigned to returnblock. But returnedblock is referenced in the block, before the assignment to returnblock gives it a value. — 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to bind to NSMutableArray that may contain zero objects?
On Apr 10, 2012, at 07:34 , Michael Crawford wrote: > The problem I'm trying solve is that I have a crashing bug in the UI when an > underlying array managed by an NSArrayController contains zero objects. The > controls bound to the array-controller include an NSPopUpButton, an > NSTextField, and four NSButtons. OK, but please also tell us what the crash is. An exception? What exception message is logged. Note that the bindings available for NSPopUpButton are a bit difficult to use: inflexible, unintuitive and incompletely documented. It's often much easier to manage pop up buttons directly through an outlet/delegate setup than it is to use bindings. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?
Interesting problem. I'm afraid one of the easier solutions is to use a NSTextView instead of a NSTextField. When you set the selectedAttributes of the field editor, I believe it will be forgotten as the field editor will try to mimick the way the text look like when not edited, (Sure the doc says these attributes are OK but they are for the NSTextView that will be edited AFAIK). Allowing rich text, subclassing NSTextField and add some methods from NSTextView did not work so far. No obvious private API for this in the AppKit. On Tue, Apr 10, 2012 at 7:51 AM, Michael Crawford wrote: > I've tried two different approaches. The first thing I tried was to make may > app-delegate the delegate for my window and then implement > -windowWillReturnFieldEditor:toObject:. > > - (void)awakeFromNib > { > _fieldEditor = [NSTextView new]; > [_fieldEditor setFieldEditor:YES]; > > NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: > [NSColor redColor], > NSBackgroundColorAttributeName, /* something obvious so I can see it */ > [NSColor yellowColor], > NSForegroundColorAttributeName, > nil]; > [_fieldEditor setSelectedTextAttributes:attributes]; > } > > - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client > { > if ( [client isKindOfClass:[NSTextField class]] ) > { > return _fieldEditor; > } > > return nil; > } > > Next, I tried something I found in a blog via Google at > http://www.ff00aa.com/fr/archives/2009/02/28/9969-changing-the-selected-text-s-color-for-an-nstextfield/. > > - (void)viewDidMoveToWindow:(NSWindow *)window > { > if ( window != nil ) > { > NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: > [NSColor redColor], > NSBackgroundColorAttributeName, > [NSColor yellowColor], > NSForegroundColorAttributeName, > nil]; > > // object-shadow text-field > NSTextView *fieldEditor = (NSTextView *)[window fieldEditor:YES > forObject:_shadowTextField]; > [fieldEditor setSelectedTextAttributes:attributes]; > > // vignette text-field > fieldEditor = (NSTextView *)[window fieldEditor:YES > forObject:_vignetteTextField]; > [fieldEditor setSelectedTextAttributes:attributes]; > > // opacity text-field > fieldEditor = (NSTextView *)[window fieldEditor:YES > forObject:_opacityTextField]; > [fieldEditor setSelectedTextAttributes:attributes]; > } > } > > End result: In both cases I get the default white on cyan or whatever color > you call it. Anyone have a technique that works or some experience with this > type of modification? > > -Michael > ___ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/dev.iceberg%40gmail.com > > This email sent to dev.iceb...@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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?
On Apr 10, 2012, at 11:29 AM, Stephane Sudre wrote: > Allowing rich text, subclassing NSTextField and add some methods from > NSTextView did not work so far. Subclassing NSTextField and implemented -setUpFieldEditor didn't do the trick? --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?
With the delegate method, you get the appropriate NSTextView field editor. The issue is that you're not editing this NSTextView, you're editing the NSTextField. At least that's my take on this. On Tue, Apr 10, 2012 at 12:09 PM, Kyle Sluder wrote: > On Apr 10, 2012, at 11:29 AM, Stephane Sudre wrote: > >> Allowing rich text, subclassing NSTextField and add some methods from >> NSTextView did not work so far. > > Subclassing NSTextField and implemented -setUpFieldEditor didn't do the trick? > > --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Converting between property names?
Are there functions provided in the Objective-C runtime to convert property names? For example, say I have a key name like "fooKey", and I want to get "FooKey", or the setter name "setFooKey" from it. I could do the name munging myself, but I wonder if there aren't edge cases. For example, "setURL" should covert to "URL", not "uRL". In my particular case, I'm trying to implement functionality like +keyPathsForValuesAffecting. It takes a key name (usually something that starts with a lower-case letter) and changes it to start with an upper-case letter, then appends it to "keyPathsForValuesAffecting" to create the selector name. Are those conversion methods provided anywhere? I looked through the Obj-C runtime and didn't see anything, but I didn't read every single page. 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?
My next move, I guess. Thanks, Kyle. -Michael On Apr 10, 2012, at 3:09 PM, Kyle Sluder wrote: > On Apr 10, 2012, at 11:29 AM, Stephane Sudre wrote: > >> Allowing rich text, subclassing NSTextField and add some methods from >> NSTextView did not work so far. > > Subclassing NSTextField and implemented -setUpFieldEditor didn't do the trick? > > --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?
Little confused by Stephane's comments. From what I've read, the text-field is swapped out with the field editor by the window containing the text-field. This happens when the text-field becomes the first-responder. So the actual control involved is an NSTextView instanced not an NSTextField instance. The trick seems to be to get the right instance of NSTextView and set its attributes in order to get desired the selected text colors. -Michael On Apr 10, 2012, at 4:44 PM, Stephane Sudre wrote: > With the delegate method, you get the appropriate NSTextView field > editor. The issue is that you're not editing this NSTextView, you're > editing the NSTextField. > > At least that's my take on this. > > On Tue, Apr 10, 2012 at 12:09 PM, Kyle Sluder wrote: >> On Apr 10, 2012, at 11:29 AM, Stephane Sudre wrote: >> >>> Allowing rich text, subclassing NSTextField and add some methods from >>> NSTextView did not work so far. >> >> Subclassing NSTextField and implemented -setUpFieldEditor didn't do the >> trick? >> >> --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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting between property names?
On Apr 10, 2012, at 1:49 PM, Rick Mann wrote: > Are there functions provided in the Objective-C runtime to convert property > names? For example, say I have a key name like "fooKey", and I want to get > "FooKey", or the setter name "setFooKey" from it. I could do the name munging > myself, but I wonder if there aren't edge cases. For example, "setURL" should > covert to "URL", not "uRL". > > In my particular case, I'm trying to implement functionality like > +keyPathsForValuesAffecting. It takes a key name (usually something that > starts with a lower-case letter) and changes it to start with an upper-case > letter, then appends it to "keyPathsForValuesAffecting" to create the > selector name. > > Are those conversion methods provided anywhere? I looked through the Obj-C > runtime and didn't see anything, but I didn't read every single page. The code to derive the default setter and getter method names from a property name is in the compiler somewhere. The runtime can tell you the setter and getter and ivar names for a particular class's property, but knows nothing about key paths or name to name conversion. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting between property names?
On Apr 10, 2012, at 1:49 PM, Rick Mann wrote: > Are there functions provided in the Objective-C runtime to convert property > names? For example, say I have a key name like "fooKey", and I want to get > "FooKey", or the setter name "setFooKey" from it. I could do the name munging > myself, but I wonder if there aren't edge cases. For example, "setURL" should > covert to "URL", not "uRL". > > In my particular case, I'm trying to implement functionality like > +keyPathsForValuesAffecting. It takes a key name (usually something that > starts with a lower-case letter) and changes it to start with an upper-case > letter, then appends it to "keyPathsForValuesAffecting" to create the > selector name. > > Are those conversion methods provided anywhere? I looked through the Obj-C > runtime and didn't see anything, but I didn't read every single page. > I've used keyPathsForValues.. and my own variants extensively and I've never needed to know the setFoo version of my key names. What are you doing that depends on setter names? Maybe there's a better way. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting between property names?
On Apr 10, 2012, at 15:09 , Lee Ann Rucker wrote: > > On Apr 10, 2012, at 1:49 PM, Rick Mann wrote: > >> Are there functions provided in the Objective-C runtime to convert property >> names? For example, say I have a key name like "fooKey", and I want to get >> "FooKey", or the setter name "setFooKey" from it. I could do the name >> munging myself, but I wonder if there aren't edge cases. For example, >> "setURL" should covert to "URL", not "uRL". >> >> In my particular case, I'm trying to implement functionality like >> +keyPathsForValuesAffecting. It takes a key name (usually something >> that starts with a lower-case letter) and changes it to start with an >> upper-case letter, then appends it to "keyPathsForValuesAffecting" to create >> the selector name. >> >> Are those conversion methods provided anywhere? I looked through the Obj-C >> runtime and didn't see anything, but I didn't read every single page. >> > > I've used keyPathsForValues.. and my own variants extensively and I've never > needed to know the setFoo version of my key names. What are you doing that > depends on setter names? Maybe there's a better way. In this case, I don't need it. I just listed that for completeness' sake. There should be routines that do the same thing the compiler and runtime do. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Save PDF disabled in Print Dialog?
I noticed just now that a Safari page has managed to disable, in the print dialog for the page, the Save as PDF, and other PDF options, but Save as Postcript and Fax PDF were still enabled. What's up with that? -- 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Save PDF disabled in Print Dialog?
Ugh, NVM. The content was already PDF. On Apr 10, 2012, at 15:47 , Rick Mann wrote: > I noticed just now that a Safari page has managed to disable, in the print > dialog for the page, the Save as PDF, and other PDF options, but Save as > Postcript and Fax PDF were still enabled. > > What's up with that? > > -- > 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: > https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com > > This email sent to rm...@latencyzero.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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting between property names?
Le 10 avr. 2012 à 23:40, Greg Parker a écrit : > On Apr 10, 2012, at 1:49 PM, Rick Mann wrote: >> Are there functions provided in the Objective-C runtime to convert property >> names? For example, say I have a key name like "fooKey", and I want to get >> "FooKey", or the setter name "setFooKey" from it. I could do the name >> munging myself, but I wonder if there aren't edge cases. For example, >> "setURL" should covert to "URL", not "uRL". >> >> In my particular case, I'm trying to implement functionality like >> +keyPathsForValuesAffecting. It takes a key name (usually something >> that starts with a lower-case letter) and changes it to start with an >> upper-case letter, then appends it to "keyPathsForValuesAffecting" to create >> the selector name. >> >> Are those conversion methods provided anywhere? I looked through the Obj-C >> runtime and didn't see anything, but I didn't read every single page. > > The code to derive the default setter and getter method names from a property > name is in the compiler somewhere. > > The runtime can tell you the setter and getter and ivar names for a > particular class's property, but knows nothing about key paths or name to > name conversion. > Note that @property do no have the same naming convention than KVC. For instance, if you declare the foo getter -isFoo that returns a BOOL value, it is valid to access it using -valueForKey:@"foo", but it will not work if you try to get it using the property's dot syntax. -- Jean-Daniel ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
window resizing advice
Hi, I have a small main window with a custom view that accepts drags, and once the drag is accepted I want it to resize larger and reveal a table view. In general I want to animate this but seems there might be a problem animating if the table view subview is already added? Should I: 1. Accepted drag and fade away old view 2. Use simple temporary view while window is resizing 3. Once window is resized fade in table view Is this the best approach? Any advice is appreciated thanks, rc ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com