Re: Core Data NSPredicate
On Mar 13, 2011, at 1:51 AM, Indragie Karunaratne wrote: Andreas, That predicate syntax (and block predicates) won't work in my case because I'm using them in a Core Data NSFetchRequest. This is true only if you use a sqlite store - but this is also most likely ;) If you were not using SQLite, this simple predicate should have worked with a fetch request: NSPredicate* pred = [NSPredicate predicateWithFormat:@ALL %@ IN {attr0, attr1}, terms]; where terms is an array (or better a set) of strings, and attr0 and attr1 are key paths for attributes of the managed object. Here, the values for the attributes for each candidate of the managed objects are used in the predicate. The predicate becomes true only if all search terms are found in any of the values of the attributes. You may have meant it the other way around, then the predicate would become: NSPredicate* pred = [NSPredicate predicateWithFormat:@ALL {attr0, attr1} IN %@, terms]; Anyway, as you already found out, this predicate would not work with a sqlite store type. The reason is, that a *fetch* predicate must be mapped to an equivalent sqlite query - which is not always possible. The error isn't a parser error, though. It is actually an Invalid Argument Exception whose reason is unsupported predicate which is thrown when you try to *execute the fetch*. So, the task is to find another form of the predicate which will work with the sqlite store. I did, however, manage to solve this issue by using subpredicates: This is fine, however I'm not completely confident that your compound predicate (below) actually expresses your original intent. Consider, the prediacte All tems IN attributes is equivalent to (term_0 IN attributes) AND (term_1 IN attributes) ... AND (term_n IN attributes) So the code for this would look like this: NSMutableArray* subPredicates = [[NSMutableArray alloc] initWithCapacity:[terms count]]; for (NSString* term in terms) { NSPredicate* p = [NSPredicate predicateWithFormat:@%@ IN {attr0, attr1}, term]; [subPredicates addObject:p]; } NSPredicate* pred = [NSCompoundPredicate andPredicateWithSubpredicates:subPredicates]; [subPredicates release], subPredicates = nil; [fetchRequest setPredicate:pred]; Regards Andreas NSPredicate *basePredicate = [NSPredicate predicateWithFormat:@(name CONTAINS[cd] $QUERY) OR (artist.name CONTAINS[cd] $QUERY)]; NSMutableArray *andPredicates = [NSMutableArray array]; for (NSString *term in terms) { NSDictionary *substitution = [NSDictionary dictionaryWithObjectsAndKeys:term, @QUERY, nil]; NSPredicate *andPredicate = [basePredicate predicateWithSubstitutionVariables:substitution]; [andPredicates addObject:andPredicate]; } NSPredicate *finalPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:andPredicates]; On 2011-03-12, at 6:17 AM, Andreas Grosam wrote: On Mar 12, 2011, at 3:36 AM, Indragie Karunaratne wrote: I have an NSManagedObject that has the following string attributes: artist, albumArtist, composer, comments, and lyrics I need to write an NSPredicate that will take an array of search terms, and check if all of the above string attributes COMBINED contains every term in the search term array. I tried the following predicate format: NSArray *searchTerms = [NSArray arrayWithObjects:@testing, @search, nil]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@ALL %@ IN { artist, albumArtist, composer, comments, lyrics }, searchTerms]; This triggered a parsing error and would not run. Is there any way I can do this in an NSPredicate, aside from creating a search string attribute in my data model containing a concatenated string of the above attributes? You should not include the object where the predicate is run against into the parameters of the format string. Otherwise, you would get a constant expression, rather a predicate. Furthermore, when specifying an embedded string-list you need to quote the string elements. This should work then: NSArray* terms = ... NSPredicate* pred = [NSPredicate predicateWithFormat:@ALL self IN {'artist', 'albumArtist', 'composer', 'comments'}]; BOOL test = [pred evaluateWithObject:terms]; Note: you can use a ^block for the predicate as well. Regards Andreas___ 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/cocoadev%40indragie.com This email sent to cocoa...@indragie.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
Re: Core Data NSPredicate
Thanks Andreas, I see your point, but as far as I know, IN looks for an exact match (in this case, the attribute would have to match the term for the predicate to return true) where as I need it to check if the attribute CONTAINS the term (which is more appropriate for Spotlight-style search). That said, I am by no means an expert with predicates so correct me if I am wrong. On 2011-03-14, at 3:45 AM, Andreas Grosam wrote: This is fine, however I'm not completely confident that your compound predicate (below) actually expresses your original intent. Consider, the prediacte All tems IN attributes is equivalent to (term_0 IN attributes) AND (term_1 IN attributes) ... AND (term_n IN attributes) ___ 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 with NSPredicate in core data fetch request
On Mar 13, 2011, at 3:08 PM, Gideon King wrote: I'm seeing a strange thing with a predicate. When I apply the predicate to a fetch request, it doesn't return any results, but when I do the fetch without the predicate and then use filteredArrayUsingPredicate to filter the results, it has the matching row that I expect. ... I am really mystified by this - I can't understand why it would not work when applied to a fetch request, but would work when applied to the array of results. Any suggestions? Well, in general, sending executeFetchRequest to the context and performing a predicate upon a result set, behaves not (always) the same, respectively certain requirements must be met. In case of SQLite as the datastore, if you sent executeFetchRequest to the context, the context constructs corresponding SQL Select commands which are sent to SQLite and performed by SQLite itself. First of all, fetch request including the predicate must be convertible to equivalent SQL statements. Then, the SQL statements must be valid of course, and this requires (for instance) that all attributes within the predicate exist as fields in the corresponding table in the database. Do you use a SQLite data store and is the attribute transient or is there a value transformer attached to it? Regards Andreas ___ 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: Core Data NSPredicate
On Mar 14, 2011, at 3:10 PM, Indragie Karunaratne wrote: Thanks Andreas, I see your point, but as far as I know, IN looks for an exact match (in this case, the attribute would have to match the term for the predicate to return true) Well, just to clarify the things: IN is a set operator, e.g. e IN R The left hand argument e is an element, and the right hand argument R is an array or set (or even a dictionary, but then the values are considered only). The predicate evaluates to TRUE if the element e is an element of R. If Objective-C code is involved to test the inclusion, I'm not sure which methods are applied, but my guess is it is equivalent to checking for each element with -isEqual. Otherwise the database backend will do the comparison, which requires an exact match. (btw: In case of a fetch request, we might imagine that each managed object in the specified entity is test separately against the predicate) Example: 'aaa' IN {'aaa', 'bbb', 'ccc'} = TRUE 'xxx' IN {'aaa', 'bbb', 'ccc'} = FALSE where as I need it to check if the attribute CONTAINS the term (which is more appropriate for Spotlight-style search). That said, I am by no means an expert with predicates so correct me if I am wrong. CONTAINS is a String Comparison operator. s1 CONTAINS s2 This predicate returns true if the left hand string contains the right hand string: 'aaaBBBccc' CONTAINS 'aaa' = TRUE 'aaaBBBccc' CONTAINS 'aaaccc' = FALSE And finally, ALL is an Aggregate Modifier ALL R1 IN R2 ALL is an aggregate operation which operates on a set or an array. Both arguments R1, and R2 are sets or arrays. Effectively, the above is equivalent to: (e0 IN R2) AND (e1 IN R2) ... AND (en IN R2) where R1 = {e0, e1, ... en} ALL {'a', 'b'} IN {'a', 'b', ācā, 'd'} = TRUE ALL {'a', 'b', 'x'} IN {'a', 'b', ācā, 'd'} = FALSE So, it just depends what you are actually going to achieve ;) Your solution was to evaluate this predicate: pred = (name CONTAINS 'term0' OR artist.name CONTAINS 'term0') AND (name CONTAINS 'term1' OR artist.name CONTAINS 'term1') ... OK, this might be very well the exact thing you want to achieve - but from the logic, namely to test if all of many terms (character strings) are contained (literally) in an artist's name - it seems otherwise ;) Andreas ___ 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 with NSPredicate in core data fetch request
Thanks for that information - that's an important distinction to understand. I guess that may be something to do with what I'm observing, but am not sure exactly how. In my case, I am using an NSAtomicStore subclass. The actual storage behind the scenes maps that attribute to an id attribute in an XML file, but that should all be completely hidden from the layers that actually do the fetch. Anything working with the atomic store cache node would be reading and writing it as nmObjectId - String, mandatory, no value transformer Regards Gideon On 14/03/2011, at 11:47 PM, Andreas Grosam wrote: On Mar 13, 2011, at 3:08 PM, Gideon King wrote: I'm seeing a strange thing with a predicate. When I apply the predicate to a fetch request, it doesn't return any results, but when I do the fetch without the predicate and then use filteredArrayUsingPredicate to filter the results, it has the matching row that I expect. ... I am really mystified by this - I can't understand why it would not work when applied to a fetch request, but would work when applied to the array of results. Any suggestions? Well, in general, sending executeFetchRequest to the context and performing a predicate upon a result set, behaves not (always) the same, respectively certain requirements must be met. In case of SQLite as the datastore, if you sent executeFetchRequest to the context, the context constructs corresponding SQL Select commands which are sent to SQLite and performed by SQLite itself. First of all, fetch request including the predicate must be convertible to equivalent SQL statements. Then, the SQL statements must be valid of course, and this requires (for instance) that all attributes within the predicate exist as fields in the corresponding table in the database. Do you use a SQLite data store and is the attribute transient or is there a value transformer attached to it? ___ 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
StoreKit sandbox question
We've previously integrated with iAds. While testing ADBannerView, I noticed in the sandbox that the bannerView:didFailToReceiveAdWithError: delegate method would intermittently be called. It would fail on one to two minute intervals and then start indicating content was available. I assumed that this was as designed for the sandbox to allow failure condition testing. In fact it was quite handy because I could use my proxy to blacklist the URL and force it to stop working. I was unable to find this in the docs to verify it would do this. Now that we are setting up in app purchases, I'm wondering if there is something similar. When I install a cleaned debug build on a device the SKProductsRequest works as expected. However after running for a while during testing the delegate method productsRequest:didReceiveResponse: starts getting invalidProductIdentifiers. The products are valid prior to this, with no changes in iTunes Connect. Cleaning the build device and rebooting the test device make this behavior go away. Am I running into something that is expect sandbox behavior? Is it documented? Should I file a bug report? -logan___ 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] How to animate the height of a UITableViewCell
Hello, in one of my projects, a UITableView instance displays a number of objects whose information is gathered from the web. As it turns out each of these objects can be in one of two states, with visual differences. In the loading state, only a minimal amount of information about the object (its name and a spinning UIActivityIndicatorView) is displayed, whereas in the loaded state (after the web access has been completed and information parsed) a more detailed amount of information is shown. When the object displayed in a given UITableViewCell is in the loading state, the cell's height is just a bit larger than a UILabel's height. When the object is in its loaded state, the cell is quite a bit taller, to accommodate the rest of the information. I already have all of this working just fine (including the fact that each cell's object updates its content asynchronously), but the transition from short cell to tall cell is abrupt and I would like to make it be a smooth animation. Can someone please offer some pointers on how to accomplish that? Thanks in advance. WT___ 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: CALayer drawing efficiency
On Mar 13, 2011, at 10:33 PM, Martin Hewitson wrote: I'm working on an app which will show a grid of CALayers (a few hundred in total), each layer is constrained so that its size scales up and down with the super layer. The super layer is then hosted by a view and resizes with the view. Each of the grid layers then has sublayers showing text. The problem is that resizing the main window is very slow due to the resizing of all the small layers. I was wondering if anyone has any hints or tips for dealing with large numbers of layers and making it faster to draw? It sounds like you nave needsDisplayOnBoundsChanged=YES, I would recommend you set it to NO, and call -setNeedsDisplay on your layers manually when the resizing is done. -- David Duncan ___ 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: [iOS] How to animate the height of a UITableViewCell
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 WT wrote: When the object displayed in a given UITableViewCell is in the loading state, the cell's height is just a bit larger than a UILabel's height. When the object is in its loaded state, the cell is quite a bit taller, to accommodate the rest of the information. I already have all of this working just fine (including the fact that each cell's object updates its content asynchronously), but the transition from short cell to tall cell is abrupt and I would like to make it be a smooth animation. Can someone please offer some pointers on how to accomplish that? I have found that using: - - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation works well, especially when used with UITableViewRowAnimationTop as the row animation. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAk1+UB0ACgkQaOlrz5+0JdXwsgCeN4smNOg0QkF392GBd4Iy4lpJ 6hsAnRIRi3UdN/4pOZ/e+zkoMCh5FULc =6cVn -END PGP 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
[Solved] [iOS] How to animate the height of a UITableViewCell
Duh... I should have searched the web before firing the question to the list. It turns out there are many references to this exact task and its solution. Here's one such: http://www.alexandre-gomes.com/?p=482 Basically, the idea is to call -reloadRowsAtIndexPaths: withRowAnimation: at the appropriate moment. Apologies for the unnecessary noise. WT___ 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: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]
On Sun, 13 Mar 2011 15:14:53 -0700, Steve Christensen puns...@mac.com said: On Mar 13, 2011, at 11:05 AM, Matt Neuburg wrote: On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen puns...@mac.com said: The setup has a MPMoviePlayerController instance that is playing a local audio file. There is also a UIWebView whose HTML contains an audio tag. When the play control is tapped, I see a MPMoviePlayerPlaybackDidFinishNotification notification with a reason of MPMovieFinishReasonPlaybackEnded, then gdb shows the assertion failure and exception and dumps the backtrace (below). What was the outcome on this? Thx - m. Well, I'm still not sure of the exact why for the assertion, but I figured out what I was doing that it didn't like. My MPMoviePlayerPlaybackDidFinishNotification handler is designed to queue up another audio file to play after the current one finishes. I NSLog'd the player initialization and all the notification handlers so I could watch the process more in realtime, and found that the next audio file was loaded and then very soon after got a MPMoviePlayerPlaybackDidFinishNotification. A bit after that is when the assertion failure and exception come along. After playing with it for a bit, I found that the player's loadState property is set to (MPMovieLoadStatePlayable | MPMovieLoadStatePlaythroughOK) when playback finishes normally or MPMovieLoadStateUnknown when it's stopped because another player instance has grabbed control. I've added a test that prevents the queueing if the loadState is MPMovieLoadStateUnknown and that seems to work just fine. I may have missed something in the docs that talks about this situation, but it's also probably true that I'm not using the player class in the most standard manner. Thanks, Steve - mostly I just wanted to make sure that this wasn't something I was likely to encounter, and you've made clear that it isn't, since the cause of the issue was really the automatic queuing behavior. This explains perfectly how you could be getting a didBecomeActive notification right after playback finishes: *you* were making the MPMoviePlayerController active once again. I guess I'm not surprised that the MPMoviePlayerController would not like your loading up an audio file while the UIWebView is already playing an audio file, since there is this rule that There Can Be Only One - for example, trying to put two MPMoviePlayerController views into your app and playing them both simultaneously won't work either. This is part of the price we pay for the simplicity of these ways of playing sound. Glad you got it straightened out - m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ A fool + a tool + an autorelease pool = cool! Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook___ 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: [iOS] How to animate the height of a UITableViewCell
On Mar 14, 2011, at 2:27 PM, Conrad Shultz wrote: WT wrote: When the object displayed in a given UITableViewCell is in the loading state, the cell's height is just a bit larger than a UILabel's height. When the object is in its loaded state, the cell is quite a bit taller, to accommodate the rest of the information. I already have all of this working just fine (including the fact that each cell's object updates its content asynchronously), but the transition from short cell to tall cell is abrupt and I would like to make it be a smooth animation. Can someone please offer some pointers on how to accomplish that? I have found that using: - - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation works well, especially when used with UITableViewRowAnimationTop as the row animation. Hi Conrad, thanks for your reply. As I posted subsequently to my original message, I found that very answer you recommended in several places online, but some of them suggest bracketing the call to -reloadRowsAtIndexPaths:withRowAnimation: with calls to -beginUpdates and -endUpdates, while others don't. Is this bracketing necessary? Thanks again. WT___ 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
Drag Drop in an NSOutlineView
I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Any help is greatly 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: Drag Drop in an NSOutlineView
Your custom cell needs to properly implement: - (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView NS_AVAILABLE_MAC(10_5); See the header for details or the AnimatedTableView demo. --corbin On Mar 14, 2011, at 12:20 PM, Carter R. Harrison wrote: I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Any help is greatly 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/corbind%40apple.com This email sent to corb...@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: Drag Drop in an NSOutlineView
The custom cell I'm using is a modification of ImageAndTextCell from the DragNDropOutlineView sample project. In that class they have some comments that describe how hitTestForEvent:inRect:ofView: works. It's my understanding that if I return anything other than NSCellHitTrackableArea a drag should be initiated. Here is my implementation of that method and I'm still not having any luck: - (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView { return NSCellHitContentArea; } On Mar 14, 2011, at 3:25 PM, Corbin Dunn wrote: Your custom cell needs to properly implement: - (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView NS_AVAILABLE_MAC(10_5); See the header for details or the AnimatedTableView demo. --corbin On Mar 14, 2011, at 12:20 PM, Carter R. Harrison wrote: I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Any help is greatly 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/corbind%40apple.com This email sent to corb...@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: Drag Drop in an NSOutlineView
On Mar 14, 2011, at 12:20, Carter R. Harrison wrote: I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Why are you (trying to) use tableView:writeRowsWithIndexes:toPasteboard:? Why not outlineView:writeItems:toPasteboard:? ___ 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: Drag Drop in an NSOutlineView
Ack! I can't believe I missed that. The correct method to implement is: - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard Once I changed the method declaration and a few of the implementation details drag and drop is now working! Thanks! On Mar 14, 2011, at 3:33 PM, Quincey Morris wrote: On Mar 14, 2011, at 12:20, Carter R. Harrison wrote: I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Why are you (trying to) use tableView:writeRowsWithIndexes:toPasteboard:? Why not outlineView:writeItems:toPasteboard:? ___ 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: Drag Drop in an NSOutlineView
On Mar 14, 2011, at 12:33 PM, Quincey Morris wrote: On Mar 14, 2011, at 12:20, Carter R. Harrison wrote: I'm having trouble getting drag and drop to work with an NSOutlineView. What I've done is below. The problem is that tableView:writeRowsWithIndexes:toPasteboard never gets called. I found a few people with the same issue and it seems that the cause of the problem is that I am using a custom cell that is a subclass of NSTextFieldCell, however I haven't been able to find a solution that fixes my problem. 1. Set the NSOutlineView's delegate and datasource outlets. 2. In the datasource's awakeFromNib method I call registerForDraggedTypes: on the outline view. 3. I implemented the following methods in my datasource: - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteBoard *)pboard - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id NSDraggingInfo )info item:(id)item - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id NSDraggingInfo )info proposedItem:(id)item proposedChildIndex:(NSInteger)index Why are you (trying to) use tableView:writeRowsWithIndexes:toPasteboard:? Why not outlineView:writeItems:toPasteboard:? Good catch! That slipped by my eyes... corbin ___ 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
CALayers in seperate, overlapping, NSViews don't overlap correctly
Greetings, I posted this question to the Mac OS X/Graphic/Core Animation forum several weeks ago and no one's been able to answer it, so I'm trying here. I have a fairly complex hierarchy of NSViews (window - split view - tab view, which hosts a variety of table, outline, browser, and matrix views). Many of these subviews host CALayers that perform a variety of animation. So far, so good. Now, there's a sister NSView that overlaps the split view (yes, it's above the split view, I create it programmatically with -addSubview:positioned:relativeTo: using NSWindowAbove). It too hosts an CALayer that's used to overlay semitransparent graphics on top of the other views, illustrating relationships between items in the other table views. Here's the weird thing: sometimes, but not all the time, the CALayers in the nested subviews draw ON TOP OF the CALayers in the top-level overlay view. It's almost as if whatever the last CALayer that gets drawn, draws on top of all of the other CAlayers in the window. This seems really strange, because within a single CALayer, sublayers appear to be strictly ordered and always draw over the layers behind them. Anyway, I'm looking for a solution that will get my overly graphics view to always draw it's CALayers on top of the images drawn by the nested views behind it. -- James Bucanek ___ 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
Drag image creation for NSView with CALayer in NSCollectionView calls drawRect:?
I have an NSCollectionView with NSCollectionViewItems that have, amongst other things, a layer-hosting NSView with CALayers. The collectionView has wantsLayers set, and everything there is working nicely - draw, scroll, reorder animation. The trouble comes when I try to drag them. The collectionView builds the drag image for me, and all the collectionViewItem's children draw except the one with the CALayers. Some digging and logging revealed that the drag image creation code is calling drawRect: on my layer-hosting NSView. I can work around it by implementing a drawRect: that creates a placeholder drag image, but the question I have is: Is there something I'm missing that would cause it to create the right drag image for me? Or is this an Apple bug? If so, is my workaround good or bad? Is there a case where it will call drawRect: for some other legit reason, or should it just never call it and so when it's fixed my drawRect: will be ignored?___ 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: Drag image creation for NSView with CALayer in NSCollectionView calls drawRect:?
On Mon, Mar 14, 2011 at 1:15 PM, Lee Ann Rucker lruc...@vmware.com wrote: Is there something I'm missing that would cause it to create the right drag image for me? If you think about it, you pretty much have to use the old raster drawing path to generate drag images. Even if you don't call -drawRect: (which NSCollectionView presumably does to insulate you from its implementation details), the drag image is a static bitmap. I suppose you could use a CARenderer to produce a static bitmap from within -drawRect:. I believe we've determined that the window update machinery does not call -drawRect: if you have set up your layer-hosting view correctly. Printing, and apparently NSCollectionView, will call it directly. --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: CALayers in seperate, overlapping, NSViews don't overlap correctly
On Mon, Mar 14, 2011 at 1:13 PM, James Bucanek subscri...@gloaming.com wrote: Here's the weird thing: sometimes, but not all the time, the CALayers in the nested subviews draw ON TOP OF the CALayers in the top-level overlay view. It's almost as if whatever the last CALayer that gets drawn, draws on top of all of the other CAlayers in the window. This seems really strange, because within a single CALayer, sublayers appear to be strictly ordered and always draw over the layers behind them. You're not putting subviews inside of layer-hosting views, are you? We have a simpler version of what you describe (a scroll view contains both a layer-hosting document view as well as a layer-backed view added with -addSubview:layerBackedView positioned:NSWindowAbove relativeTo:[scrollView documentView]) that works fine. But the layer-backed glue can be very fickle with view Z-ordering. --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: [iOS] How to animate the height of a UITableViewCell
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 3/14/11 12:01 PM, WT wrote: thanks for your reply. As I posted subsequently to my original message, I found that very answer you recommended in several places online, but some of them suggest bracketing the call to -reloadRowsAtIndexPaths:withRowAnimation: with calls to -beginUpdates and -endUpdates, while others don't. Is this bracketing necessary? No problem, happy to help, even if you independently found the solution. As for begin/endUpdates, what these do is synchronize animations that otherwise might be performed serially. If you are updating a single row there is no reason, AFAIK, to wrap the reload message. If you are updating multiple rows (which I don't do, so this is somewhat speculative... a test program should be pretty easy to write), wrapping the reload message with begin/endUpdates will ensure that all the rows animate simultaneously. What I am unsure on is whether you need to do this if you include all the row changes in the NSArray you pass to reloadRowsAtIndexPaths. Cocoa might take care of synchronizing all animations therein for you, but I'm not sure. Certainly if you need to perform other operations (e.g. adding/deleting cells) you will need to wrap the whole block as indicated in the documentation. A thorough discussion of these matters is available in the Table View Programming Guide for iOS: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW9 - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNfn0xaOlrz5+0JdURAjtUAJ9/fABpLBsURfTCfuDCgfyC/KXE0wCfZaH9 vVjANOLeIAy02hCxpY0xbuE= =5CsV -END PGP 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: [iOS] How to animate the height of a UITableViewCell
On Mar 14, 2011, at 5:40 PM, Conrad Shultz wrote: No problem, happy to help, even if you independently found the solution. As for begin/endUpdates, what these do is synchronize animations that otherwise might be performed serially. If you are updating a single row there is no reason, AFAIK, to wrap the reload message. If you are updating multiple rows (which I don't do, so this is somewhat speculative... a test program should be pretty easy to write), wrapping the reload message with begin/endUpdates will ensure that all the rows animate simultaneously. What I am unsure on is whether you need to do this if you include all the row changes in the NSArray you pass to reloadRowsAtIndexPaths. Cocoa might take care of synchronizing all animations therein for you, but I'm not sure. Sounds like a good exercise to write a test app to try it. I'll try and explore that issue when I find a bit more time. Meanwhile, I'll just do what I need without the beginUpdates/endUpdates calls since I, too, only need to animate one row at a time. Certainly if you need to perform other operations (e.g. adding/deleting cells) you will need to wrap the whole block as indicated in the documentation. A thorough discussion of these matters is available in the Table View Programming Guide for iOS: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW9 Yes, I've read the table view docs but I'll admit that the last time I did it was some time ago and now I was pressed for time so I skipped the docs at this time. Not a good excuse, I know. :) Thanks again for your help. WT___ 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: Drag image creation for NSView with CALayer in NSCollectionView calls drawRect:?
On Mar 14, 2011, at 1:29 PM, Kyle Sluder wrote: On Mon, Mar 14, 2011 at 1:15 PM, Lee Ann Rucker lruc...@vmware.com wrote: Is there something I'm missing that would cause it to create the right drag image for me? If you think about it, you pretty much have to use the old raster drawing path to generate drag images. Even if you don't call -drawRect: (which NSCollectionView presumably does to insulate you from its implementation details), the drag image is a static bitmap. I suppose you could use a CARenderer to produce a static bitmap from within -drawRect:. It's a CAOpenGLLayer, so as far as I can tell CARenderer is not going to help. But I'm fine with having a placeholder image, I just wanted to be sure I was making it in the right place. The first thing I thought looked promising was cacheDisplayInRect:toBitmapImageRep: which is called by NSCollectionView's drag, but that just calls drawRect on the top level view. I believe we've determined that the window update machinery does not call -drawRect: if you have set up your layer-hosting view correctly. Printing, and apparently NSCollectionView, will call it directly. --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
Ad-hoc distribution still supported in App Store?
And is it what I need? Here's what I have: an iOS (for iPhone/iPod Touch) app that - mostly - works; enough to be usable in a production environment, but doesn't have all the 'spit-and-polish' of a fully completed app. Currently, the project for it resides on my laptop, and whenever I receive a reminder about the provisioning profile expiring, I login to the iOS dev portal, delete the existing profile, then create a new one, so it won't expire real quick. I then update my iPad, and iPhone 3GS, as well as a few other iPads in my workplace (one belongs to my supervisor). I'd like to distribute this on the app store so they can d/l it there, and not have to put up with the reminder notices, but I don't want just anyone to be able to find the app on the App Store. Is this what Ad-hoc distribution is for? Or is there a better option? Finally, does Apple still vet such apps with the same scrutiny they do for normal apps?, or are they willing to let certain HI/usability 'gotcha's' slide (because it's just for in-house use, not for the general public)? ___ 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: Ad-hoc distribution still supported in App Store?
Ad hoc distribution has nothing to do with the app store. It is essentially the same distribution mechanism that you have been using, except the expiration of the provisioning profile is much longer. On Mar 14, 2011, at 6:45 PM, William Squires wrote: And is it what I need? Here's what I have: an iOS (for iPhone/iPod Touch) app that - mostly - works; enough to be usable in a production environment, but doesn't have all the 'spit-and-polish' of a fully completed app. Currently, the project for it resides on my laptop, and whenever I receive a reminder about the provisioning profile expiring, I login to the iOS dev portal, delete the existing profile, then create a new one, so it won't expire real quick. I then update my iPad, and iPhone 3GS, as well as a few other iPads in my workplace (one belongs to my supervisor). I'd like to distribute this on the app store so they can d/l it there, and not have to put up with the reminder notices, but I don't want just anyone to be able to find the app on the App Store. Is this what Ad-hoc distribution is for? Or is there a better option? Finally, does Apple still vet such apps with the same scrutiny they do for normal apps?, or are they willing to let certain HI/usability 'gotcha's' slide (because it's just for in-house use, not for the general public)? ___ 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/dave%40rudedog.org This email sent to d...@rudedog.org ___ 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: Ad-hoc distribution still supported in App Store?
On Mar 14, 2011, at 6:48 PM, cocoa-dev-requ...@lists.apple.com wrote: I'd like to distribute this on the app store so they can d/l it there, and not have to put up with the reminder notices, but I don't want just anyone to be able to find the app on the App Store. Is this what Ad-hoc distribution is for? No. Ad Hoc and App Store distribution are effectively opposites (or perhaps I should say orthogonal). With Ad Hoc distribution you just hand the app to your friend (email, sneakernet, whatever) whose device you've included in its profile. No scrutiny is involved because Apple never sees the app. m.___ 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: Book Cocoa programming for Mac OS X Third Edition
I recommend Beginning Mac Programming: Develop with Objective-C and Cocoa by Tim Isted. I concur with Cocoa Design Patterns after you learn a bit. I also liked Cocoa and Objective-C: Up and Running by Scott Stevenson. I would also suggest getting a membership from safaribooksonline.com and getting the full library option that way you are not limited to how many books you can read (granted they don't have every book) and you have access to the videos as well. They do have the Programming in Objective-C 2.0 video lessons which I found better than the book but still ridiculously dry. Another note, there is a new 3rd edition of Kochan's book and Hillegass has 2 or 3 more new updated books coming out. -T. On Mar 11, 2011, at 9:52 AM, David Remacle wrote: Hello, I have see on amazon the book Cocoa programming for Mac OS X third Edition of Aaron Hillegass. Is this a good book for beginner ? Which books for objective-C 2.0/Cocoa do you recommend for beginner ? Good day. ___ 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/the.blue.pencil.concept%40gmail.com This email sent to the.blue.pencil.conc...@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
Faster text drawing with configurable stroke width
Hi cocoa-dev, I'm currently drawing text one character at a time with -[NSAttributedString drawWithRect:options:], and it is really slow. I'm looking for a faster alternative. I draw one character at a time because I need exact control over horizontal positioning (regardless of whether the font is monospaced or not, I force characters onto a grid--this is non-negotiable) and I'm not aware of another way to achieve this that also supports my second requirement: I am using -[NSAttributedString drawWithRect:options:] instead CGContextShowGlyphsWithAdvances() or CTLineDraw() because it supports NSStrokeWidthAttributeName. It also does a nice (but not as nice a NSTextView) job at rendering combining marks. My performance troubles are significant when there is a substantial amount of new text, so caching layouts would do me little good. I suspect there might be something lurking in NSLayoutManager/NSTypesetter/etc. that can help me, but I haven't found it. Thanks for your help, George ___ 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
How hidden the Keyboard in a UIWebView
I searched a lot, and all thing that hidden the keyboard is when you are in a UITextField. This is the problem. I am in a UIWebView and the user click in a text box in the web page, so the iOS open the keyboard. I can know when the keyboard will show by the UIKeyboardWillShowNotification. But, I want to show another screen instead the keyboard. How can I hidden, or never show the keyboard. If the people cancel my screen, than I want to keyboard appear. There are any class that I can manager the keyboard? How can I do this: *[keyboard goWay]* and *[keyboard show]* ___ 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
Brushed/Polished Metal in 10.5/10.6?
I've been needing an interface similar to the polished metal in Mac OS X 10.4 in my 10.6 app. First of all, is there a way to get back the brushed metal using an API call, or how would I implement this? I've accomplished rendering the metal on the window itself, but the little 'shine' and the title is giving me quite some trouble. -- Regards, Tristan Seifert ___ 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
Keyboard handlers
I need to intercept repeat keys in one window of an application. I see some references from about 10 years ago about the GLUT key handling routines, but they don't seem to work. In particular glutIgnoreKeyRepeat(TRUE) does not do anything. Should I be using other code? Is there a better way to trap events? NSEvent looks like it might work, is there any sample code I can reference? Thanks for any help, Tom Jeffries ___ 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
binding contextual menu in NSTableView cell row
I am looking to replicate the user interface of the Mac OS7 abandonware application MIDIGraphy. Most of my experience has been with the QuckDraw toolbox (over 30 years?) I used to work for Apple Imaging and was one of the Postscript Gurus on the Laserwriter team, so KV coding is second nature to me. For the last decade or so I have been fighting the carbon/quartz moving target. So a month or so back I started on the Cocoa tutorials. (backwards postscript syntax?) I am finding that cocoa is now mature, stable and finally has lived up to the promise of quick development time. My current development platform is a mac mini ppc running leopard xcode 3.1.4. I am able to graph a model of a midi file as a xcdatamodel. Using interface builder I can import this model bound to a NSTableView. By manipulating the bindings in interface builder, I can set the table so each line (row) (a class and model called EventMIDI) is like this: Time | Track |Channel | Status set (popup) | parameter text (contextual) What I want is more like: Time|Track|Channel|Status set (popup)|parameter set (contextual popup) | parameter text (contextual) To get the Status (popup) I define this in the model as a many to one relation. I then run the app with a separate panel that lets me populate status with the persistent names Note,Control Change,Meta, etc. A second value is numeric and represents the actual midi status such as 9 for note, 11 for control change, 256 for meta, etc. This is used to set the parameter text similar to the way DepartmentsAndEmployees combines the first and last name through a Class (called StatusMIDI in my example) By manipulating the bindings on NSTableColum I can show both the status value which is Note and the key 9 which is a number. Changing the popup value changes the key in unison which is what I expect. Since status (9) and channel(0) exist as values in the EventMIDI This forms a parameter key. (which may be hidden from the user as they are not always interested in looking at hex codes.) To do this hiding (like in MIDIGraphy) the parameter text should be a (contextual popup) and a contextual parameter text field. The status key is the context. Ideally I would like to keep this all in the persistent model view. In my model I have arrays (sets) for the status contexts. IB included array controllers for each of my sets. These sets are instatiated as persistent by the user in preferences. This set will also used as a filter predicate on the tabular data. What I can not figure out is how to make a NSTableColumn of mutable popup menus where the key based on the context of the status selected. That somehow I should be able to take the selection from the status array set and use this as a key on the parameter array for each line in the event list. In my trial and error attempts to do this I usually get a Bad_Access signal as I may be attempting to set the value to the key rather than the selector index, which is what I think I need to bind to. Much of the online code samples for overriding core data is dated and does not use objective C2.0. So I am looking for a solution that works with 10.5 and keeps my xcdatamodel somewhat clean. This model will also be used to represent the piano roll view and mouse over tool tips of the events. The non persistent parts of the model are populated and saved to either a MIDISMF or MUSICXML file. I am still a bit fuzzy on the Observer side of KVO. How the observer is overridden. Especially things like In the DepartmentsAndEmployees tutorial keyPathsForValuesAffectingKey which gave me no end of headache. I kept adding an extra : between keyPathsForValuesAffecting and the user defined property fullNameAndID in the tutorial. The documentation on this looks like it came from mars. Dynamic API names are weird. I have been back and forth through the NSPersistentDocument core data tutorial all week. I think the solution is simple, but probably must be done programmaticly with a custom class, which uses the key of status to indicate which contextual popup array (set) to load into the cell row. -julie ___ 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 4.2 - Printing Quality
Ok I'm rendering my images slightly larger than the view's that they are being printed from. Basically the quality is less than great. Is there a way to change the CGImage dpi? Or a way to change the quality of the print to maximum? Or is print quality basically just what it is on iOS?___ 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: CALayers in seperate, overlapping, NSViews don't overlap correctly
Kyle Sluder mailto:kyle.slu...@gmail.com wrote (Monday, March 14, 2011 1:33 PM -0700): On Mon, Mar 14, 2011 at 1:13 PM, James Bucanek subscri...@gloaming.com wrote: Here's the weird thing: sometimes, but not all the time, the CALayers in the nested subviews draw ON TOP OF the CALayers in the top-level overlay view. It's almost as if whatever the last CALayer that gets drawn, draws on top of all of the other CAlayers in the window. This seems really strange, because within a single CALayer, sublayers appear to be strictly ordered and always draw over the layers behind them. You're not putting subviews inside of layer-hosting views, are you? No. None of the layer-hosting views have any subviews. We have a simpler version of what you describe (a scroll view contains both a layer-hosting document view as well as a layer-backed view added with -addSubview:layerBackedView positioned:NSWindowAbove relativeTo:[scrollView documentView]) that works fine. But the layer-backed glue can be very fickle with view Z-ordering. I don't have any layer-backed NSViews. I'm wondering if I should. If (for example) making the sibling NSSplitView a layer-backed view might help the situation? I'm pretty sure I can solve this by moving the overlay NSView into a child window. This would force the overlay graphics into its own graphics buffer, but I'd like to avoid work that if I can. -- James Bucanek ___ 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