cocoa

Core Data Fetching Objects That Are in Relationship to another object

I want to fetch objects B which has a to-many relationship with object A (ie. A -->> B). I already have A in memory. I know I could get a NSSet of the B objects from A, but would it be better to make a fetch request of the B objects (especially if I want to sort sections by date in a UITableView)? How would I make such a request that on...

Nib objects (subviews) accessing properties in ViewController

Edited for brevity: How does a subview access properties in its superview and its superview's view controller? Easy enough to go down the chain. How do we go back up? Original (verbose) post: The immediate problem I'm trying to solve is simplifying the "birth" of a somewhat complex view. The large picture has to do with Nibs and how...

How to use redirectReponse with NSURLConnection in Cocoa

I'm using some pretty standard URL code in Cocoa - basically result = [NSURLConnection sendSynchronousRequest:query returningResponse:&response error:&serverError]; However I cannot see how to detect when the query (which is the URL) responds with a redirect - ...

How to create a CGGradient for my UIView subclass ?

Does anyone know how to create a CGGradient that will fill my view, my current code is this and it fill the UIView with a red rectangle I want to have a gradient (from black to gray for instance) instead of the rect : - (void)drawRect:(CGRect)rect { CGContextRef context=UIGraphicsGetCurrentContext(); CGRect r; r.origin.x=00...

Safe way to change the priority of an NSOperation

Is there a safe way to change the priority of an NSOperation that is already enqueued in an NSOperationQueue? If the operation hasn't started yet there is no problem, but if it is already executing I get an NSInvalidArgumentException. ...

Deploying Beta software updates and Sparkle

My application uses the Cocoa Framework Sparkle to deploy updates. I don't usually deploy beta's of my software but for my next update, I feel like I need to. My question is what is the best numbering strategy for deploying a beta using Sparkle. For anyone who tests my beta I'd like the update to be seamless when I release the next offic...

how to implement pay pal in cocoa objective C application.

I want to implement paypal in my application and it is purely objective C based. How should I do that? I searched a lot but could not get any proper guidance? ...

Second Frontmost App?

I'm looking for a way to determine the second frontmost app. Here's what I mean by that. Let's say I launch three apps in this order: Xcode, Interface Builder, and my application. If I press Command-tab, I should see four applications in the switcher: (from left to right) my application, Interface Builder, Xcode, and Finder. Let's t...

round NSDate to the nearest 5 minutes

For example I have NSDate *curDate = [NSDate date]; and its value is 9:13 am. I am not using year, month and day parts of curDate. What I want to get is date with 9:15 time value; If I have time value 9:16 I want to advance it to 9:20 and so on. How can I do that with NSDate? thx ...

Filtering data in an NSPopUpButtonCell in an NSTableView

I have an NSTable which includes a column of NSPopUpButtonCells. I would like to filter the NSPopUpButtonCell based on the contents of another column in the table. This feels like something that should have a fairly easy solution, but at the minute the solutions that I seem to be coming up with are very complicated. My biggest problem se...

Persistent Storage Cocoa/MacOSX

When writing an application for MacOSX, using Cocoa/Objective-C, I'd like to be able to store the data entered by the users. There will only be one user per installation at the moment; however, I'd like to get an idea of how storage methods change if it were multiple users per installation. In the case of 1 user per installation, shoul...

Cocoa controls text location?

Is this possible to get the coordinates of where the text drawn in standard (not custom) Cocoa controls? Actually, I need a baseline of the text, the y-axis offset value (relative to the y-origin of the view’s frame rectangle). This is what the Interface Builder shows on design pane when Layout->Show Layout Rectangles selected. ...

Multiple keys held down in Cocoa (OS X)

Hi, I'm new to Mac programming, so I hope this isn't obvious. In short, I don't seem to be getting multiple key pressed events. I've created this snippet, which never fires an assert, and therefore never prints multiple keys. I get single key prints, though. - (void)keyDown:(NSEvent *) theEvent { NSString *characters = [theEvent...

animationDidStop set but not being called (iPhone app coding)

#import "MyViewController.h" @implementation MyViewController @synthesize menuView, gameView, helpView, optionsView, gameButton, helpButton, optionsButton; - (void) viewDidLoad { [self setView:menuView]; } - (IBAction)gotoGame { [UIView beginAnimations:@"buttonSlide" context: nil]; [UIView setAnimationDuration:1.5]; [UIView setAnimat...

Parsing This String in Objective C: 60.56MB / 237.03MB 1526kbps 25.5%, 00:15:47 remaining

I am writing a front-end for a command line utility in Objective-C (Cocoa). I need to parse the output to check for different types of messages. There are two basic types; information messages and download status messages. Information messages always begin with one of the following: INFO:, WARNING:, ERROR:, or : . The download status mes...

How to make iPhone screen dim

I have a refresh button on my iphone screen that refreshes a table in the current view. The screen refresh beautifully, but is there a way I can make the screen dim and then lighten again after the table has refreshed? ...

Run Function Every Minute In Cocoa

Hi Everyone: I am wondering if there is some way to run a function every minute in Cocoa. I, personally, will be using this for saving content as the user types it in case they quit - But I have seen this effect also used in Twitter clients. When the user keeps the window open, it will auto-update every x minutes without input from th...

Multiple Selection in Cocoa's NSTableView without Command Key

Is there any way to achieve multiple selection behavior in an NSTableView without requiring the user to hold down the command button while clicking? This was easy to do in a Carbon list box, by ORing in the cmdKey modifier flag, during mouse down processing, on the call to the HandleControlClick() function. I am new to Cocoa, and it is...

Access UI elements created in Interface Builder in the controller?

This is a very simple iPhone / Cocoa question. I have a button that transitions between two views. I set most of this up using interface builder. When I click the button and the second view is displayed, how do I programmatically change the text of the button (to say 'back', for instance)? ...

Cocoa NSNumberFormatterCurrencyStyle without "$" return zero

I have a number formatter set up to convert currency strings to decimal values. The problem is that if the text string does not have a leading dollar sign ("$"), it gets converted to 0, rather than a valid matching number. So: "$3.50" converts to 3.50 "3.50" converts to 0 Here is the code for the converter: // formatter to convert a...