NSScrollView subclass not working with inertia
I am currently implementing my own NSTableView replacement that uses views instead of cells, and is fairly similar to the way that UITableView works (uses reusable views, queuing, etc.) Everything is working quite well, except for one problem. Similar to how UITableView works, the new table view (called CZTableView) is a subclass of a scroll view. The scroll view (CZScrollView) is a subclass of NSScrollView, and uses a subclass of NSClipView called CZClipView. I know, lots of subclasses, but most of them do very little. Scrolling is working almost perfectly. The last issue is inertia. I have inertia enabled in System Preferences, and it clearly works in other apps. The problem is that it doesn't work in the custom scroll view. Has anyone ever experienced this with a scroll view? A few thoughts: - All views (scroll view, clip view, and table view) are layer-backed. I don't think this should make a different, but layers on OS X have always been a crapshoot. - The table view overrides -reflectScrolledClipView: to draw new cells as needed (pulling them out of the queue, all that jazz). It does call super, but I'm not sure if this could cause problems. This gets called repeatedly until I stop scrolling, and it stops immediately, meaning that whatever scrolling events that should be caused by inertia aren't making it that far. - All views have their coordinates flipped. - I know there is a setting you can put in the app preferences file to disable inertial scrolling, and I haven't added it. If code samples would help, I'd be happy to provide them. I'd rather only give out what needs to be seen though, as there is quite a bit of code involved to make the table view work. Sincerely, Carter Allen___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [ANN] Cong 0.7
Really excellent work on this! Nice job catching the fact that I was using an embedded framework and kept the headers in there...though I'm not sure how to automate the removal of them during the build (hmm). It would be great if this was part of Xcode in some way (obviously a tough request). Oh, and Strange name for a framework made me laugh. Sincerely, Carter Allen On Feb 10, 2011, at 5:21 PM, Stephane Sudre wrote: After checking your code with the Build and Analysis features of Xcode, your leaks with Instruments, you may want to check the resources of your Mac OS X application with Cong. Cong is a free application that checks the contents of application bundles and looks for glitches such as: - Deprecated keys in Info.plist files - Missing files referenced by Info.plist values - .strings files with no values defined in them - Duplicate entries in .strings files - Common typos with punctuation marks - etc. Cong is available here: http://s.sudre.free.fr/Software/Cong/about.html Hope it can help. -- Stephane ___ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (xcode-us...@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/lists%40cartera.me This email sent to li...@cartera.me ___ 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: [ANN] DDMathParser
Hey Dave, I'm currently working on an app that loads expressions from plugin-like files, and currently we're having the expressions be written in JavaScript syntax and then using a WebView to evaluate the JavaScript. Obviously, this is less than ideal. I'm wondering if you think that DDMathParser is equal, greater, or lesser in raw mathematical capability (remember, everything has to be done based on an input string) than using JavaScript. If it's lesser, then perhaps there would be some way of having your class detect when it has hit an expression it can't figure out, and at that point pass the expression to WebKit. Sincerely, Carter Allen On Nov 22, 2010, at 9:41 PM, Dave DeLong wrote: Hi everyone, I thought it'd be fun to write a mathematical expression evaluator, a la Graham Cox's GCMathParser, but one that was extensible. So I dusted off my parsing skills and wrote DDMathParser: https://github.com/davedelong/DDMathParser It's an NSString = NSNumber expression evaluator, and its major feature is that you can define custom mathematical functions. So if you really need to have a multiplyBy42() function, then you can quickly write one, register it, and use it. You can use it very simply: NSLog(@%@, [@1 + 2 numberByEvaluatingString]); //logs 3 Or very complexly: DDMathParser * parser = [DDMathParser mathParserWithString:@2 ** 3 ** 2]; [parser setPowerAssociativity:DDMathParserAssociativityRight]; DDExpression * e = [parser parsedExpression]; NSLog(@%@, [e evaluateWithSubstitutions:nil evaluator:nil]); //logs 512 It supports pretty much all of the functions defined by NSExpression, plus many more (primarily trig functions: sin(), cos(), atanh(), etc). And like I mentioned above, you can create new functions as well. It supports variables of the same format used by NSPredicate/NSExpression ($variable) for substituting in values during evaluation. It has rudimentary support for simplifying expressions, and I'm currently working on support for translating an arbitrary DDExpression into an NSExpression and still having it work properly (even with custom functions). The source code is available on my github page, and I'd appreciate any comments or feedback you might have. https://github.com/davedelong/DDMathParser Cheers, Dave DeLong ___ 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/lists%40cartera.me This email sent to li...@cartera.me ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iOS] NSUserDefaults-backed Properties
Hello everyone! I'm working on cleaning up an app that was written by a colleague of mine a while ago, and one of the things that he did quite a bit was use properties (declared as @properties, with custom getters/setters) that are actually backed by NSUserDefaults. Seemingly, this was to provide excellent persistence - no matter how the app closed or crashed, it always remembered exactly what was going on. This is still important even with the advent of multi-tasking, as I am still targeting 3.x, as well as users without multi-tasking. Here's an example of one of his properties: - (BOOL)gameShouldBeCounted { return [[NSUserDefaults standardUserDefaults] boolForKey:@gameShouldBeCounted]; } - (void)setGameShouldBeCounted:(BOOL)shouldBeCounted { [[NSUserDefaults standardUserDefaults] setBool:shouldBeCounted forKey:@gameShouldBeCounted]; [[NSUserDefaults standardUserDefaults] synchronize]; } Calling synchronize that often can't possibly be efficient, but it seems to be the only way to make sure that defaults actually get written right away. Does anyone have any recommendations of how to make this better? I was thinking about some sort of KVC/O system, where actual ivars were used and NSUserDefaultsController was set to observe them and update asynchronously, but I have no idea where to start with a system like that. Any advice is welcome! Sincerely, Carter Allen___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Command-line parsing
You might be thinking of DDCLI: http://www.dribin.org/dave/blog/archives/2008/04/29/ddcli/ I've used it before, and when you're writing an ObjC CLI, it does its job perfectly. - Carter Allen On Jul 21, 2010, at 8:54 AM, Fritz Anderson wrote: I'm writing a Foundation tool that will take both options and pathname arguments. If you use NSUserDefaults, you can handle key-value options (-threshold 17) pretty easily, but this has limitations. I don't see how it can be graceful for * Two-hyphen options (chatty --verbose). * Non-value options (ls -a). * Single-item key-value options (chatty --verbose=3 -or- chatty -v3). * Concatenated options (ls -al) I also don't know what you do about normal arguments (ls -al /Users/fritza) without using NSUserDefaults _and_ running through [[NSProcessInfo processInfo] arguments] with at least a minimal state machine, which defeats the purpose. Enough complaining. Correct me if I'm wrong. I remember from 2001 or so that there was an open-source framework inherited from the OpenStep days, that included a helper for getopt(3) sorts of tasks, but for the life of me, I can't remember its name, and I don't know where it would be hosted or whether it would be compatible with today's Foundation framework. Yes, iterating through [[NSProcessInfo processInfo] arguments] and parsing for myself is the ultimate option, but if it's a solved problem, why make all the mistakes again? Google doesn't turn up much, beyond the NSUserDefaults trick. Any ideas? — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lists%40cartera.me This email sent to li...@cartera.me ___ 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: NSInteger compare - Help Needed
Steve, Have you tried changing in your code to simply ? That may work. - Carter Allen On Jul 17, 2010, at 1:58 PM, Steve Wetzel wrote: Hi all, I am new to Cocoa programming and am trying to do something that I thought was straightforward but not working. I am using the tag field of a button to tell me what button is pushed. This code does not work - (IBAction) numberPressed:(id)sender { NSLog(@Sender tag is:%d, [sender tag]); if ([sender tag] 10) { displayValues.rawNumber = [displayValues.rawNumber stringByAppendingString:[NSString stringWithFormat:@%d, [sender tag]]]; } buttons with tags 1-9 work great but the button with tag 0 does not. When I pass tag 0 the if statement is evaluated as false. When I press button with tag 1 I get Sender tag is:1 and the if statement is evaluated as true. When I press button with tag 0 I get Sender tag is:0 and the if statement is evaluated as false. What is going wrong here? Steve Steve’s daily photo blog ___ 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/lists%40cartera.me This email sent to li...@cartera.me ___ 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
CGContext text drawing doesn’t scale up on iP hone 4
I am trying to create an app that scales up nicely on the iPhone 4. Currently most of it scales up perfectly, except for one crucial piece: the text that I draw inside a CALayer, inside its drawInContext: method. Here is my code: - (void)drawInContext:(CGContextRef)context { UIGraphicsPushContext(context); CGContextSetGrayFillColor(context, 1.0f, 1.0f); CGContextFillRect(context, self.bounds); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldAntialias(context, true); CGContextSetAllowsFontSmoothing(context, true); CGContextSetShouldSmoothFonts(context, true); CGContextSetAllowsFontSubpixelQuantization(context, true); CGContextSetShouldSubpixelQuantizeFonts(context, true); CGContextTranslateCTM(context, 0.0f, self.frame.size.height); CGContextScaleCTM(context, 1.0f, -1.0f); CGContextSetFillColorWithColor(context, [[UIColor blackColor] CGColor]); CGContextSelectFont(context, CardKit, 30.0f, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextShowText(context, A, sizeof(A)); UIGraphicsPopContext(); } This short produce crisp text on both devices, but unfortunately, it produces blurry text on both. Here is how it appears: http://zcr.me/01h That image is taken at 100% zoom on the iPhone 4. What in the world? Any ideas how I can fix this? Sincerely, Carter Allen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Resizing Issues with NSCollectionView
I have a couple NSCollectionViews in a window. They are each in a side of a split view, and I'm having resize issues. It starts out fine, like this: http://c.zcr.me/84B7X , but then when I resize it, this happens: http://c.zcr.me/84D3C . All views and pieces are set up to stretch horizontally, including the scroll view, collection view, collection view item, and the split view that contains it all. Thanks for any help you can provide! Sincerely, Carter Allen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Strange Problems with IBPlugin
Hello! Thanks in advance, I know this is a lot to ask. I am working on a framework of custom classes for my own personal use, and it was going very well until I started to work on the Interface Builder plugin part. Download the non-working code here http://c.zcr.me/7aBcU. I have think that I have done everything necessary to make my plugin work so far (I know I haven't programmed the backend of the inspector palette, but that shouldn't prevent it from working. I would really appreciate it if someone could look at the code and see what is causing my problems, as I am completely stumped. The problem right now is that when I hit Build and Go in XCode, IB launches but never gets past the bouncing stage. It freezes up and doesn't continue. When I try to load the plugin normally, it gives me this alerthttp://c.zcr.me/7aE2E. I searched about that error, and the only people online that talk about it are people that messed up the linking of the framework, and in all of their cases, the plugin worked fine thru XCode. Again, thank you for any help you can provide, I know this isn't convenient. Sincerely, Carter Allen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com