I've looked through all the class documentation for Core Data and I can't find away to programmatically update values in a core data entity. For example, I have a structure similar to this:
id | title
============
1 | Foo
2 | Bar
3 | FooFoo
Say that I want to update Bar to BarBar, I can't find any way to do this in any ...
I am developing an application for the Mac as a small team (me + another person) effort. We are located in different cities, and have started to see the need for solid source control management.
None of us have any experience with this, and both of us are relatively new to Cocoa/Obj-C/Xcode (but do have C knowledge).
Does anyone have a...
I've seen it claimed that the following are "pretty much equivalent":
foo([NSString stringWithString:@"blah"]) # version 1
foo([[[NSString alloc] initWithString:@"blah"] autorelease]) # version 2
Are the above in fact literally equivalent or are there any subtle differences?
What are reasons to prefer one or th...
In C, something like the following would be a disaster (ie, a memory leak) because you're returning a pointer to memory that you will never be able to free:
NSString* foo()
{
return [NSString stringWithFormat:@"%i+%i=%i", 2, 2, 2+2];
}
Is that in fact totally fine in Objective-C since the memory that the returned pointer points to w...
I am in the beginning stages of creating software for a mISV-to-be. The program is a desktop application and in the long run I want to have a native version for both Windows and OS X (I have a looked at various cross-platform APIs, and none of them meet my needs). Initially though, I don't think it makes sense to develop for two platform...
I am trying to subclass NSOutlineView. Here is my code:
OutlineViewSublcass.h:
#import <Cocoa/Cocoa.h>
@interface OutlineViewSubclass : NSOutlineView {
}
@end
OutlineViewSubclass.m:
#import "OutlineViewSubclass.h"
@implementation OutlineViewSubclass
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
print...
In my iPhone app I employ NSDecimalNumber to store some some currency rate values.
I pull the data from the web the first time the app is launched and then again when they become obsolete, and I store them in a NSDictionary; then I use writeToFile:atomically:.
When the app is launched for the first time, my rate conversion method works ...
I have question about NSView:
Imagine a Custom View where the mouseDown, mouseDrag and mouseUp methods are overriden so the user can drag a point (NSRect) on the screen. To drag it I need the mouse coordinates relative to the current view. This is not a problem when the parent of the view is the window, but how do I get them when the vi...
The problem
I have a transparent NSView on a transparent NSWindow. The view's drawRect: method draws some content (NSImages, NSBezierPaths and NSStrings) on the view but leaves parts of it transparent.
Clicking on the regions of the view that have been drawn on invokes the usual mouse event handling methods (mouseDown: and mouseUp:).
...
I'm just learning Objective-C/Cocoa programming for the Mac. All of the tutorials, books, blogs, podcasts, etc. I've been using really cover the two together. Is there an easy way to tell which pieces are vanilla Objective-C and which come from Cocoa?
...
I have an NSWindow that I defined in interface builder. I want to make it so that when the user clicks a button, it opens a new instance that NSWindow. Do I have to subclass NSWindow or something?
...
How can NSNotification be used to check a the status of an NSTask? I know there are a couple of class methods inside the NSTask but don't really understand how to implement them in a Cocoa application. Can somebody help me?
...
I've been looking at some OSX applications, and I noticed they all seem to have a similar (and slick) inbox purchase experience. Is there a third party thats providing this? If one wanted to implement it in ones own OS X application, where would one go?
Examples include delicious library, things, the hit list, and coda.
...
I have subclassed NSPersistentDocument. I have renamed the window too. But when I run the application I get the title of the application window as "Untitled". There is no -setTitle: method which I can use to change the title. Any ideas how can I go about doing this?
...
I have a UISearchBar and on the delegate method I hide the keyboard when the text field is cleared:
- (void)searchBar:(UISearchBar *)filterBar textDidChange:(NSString *)filterText {
NSLog(@"filter: %@", filterText);
if ([filterText length] == 0) {
NSLog(@"hiding keyboard");
[filterBar resignFirstResponder ];
N...
I have a single NSDictionary object which contains a large number of custom objects. The objects will either be of class B or of class C, both of which inherit from class A. If the objects are of type B, they will have an internal flag (kindOfCIsh) which will be used for future grouping.
How can I, at different times in my program, get ...
I have replaced an NSTextField with an NSTokenField so that I can perform some auto-completion. The value of the NSTextField was bound to a NSString attribute of a controller class. Now that I have changed the NSTextField to an NSTokenField the value has changed to an NSArray.
How do I make the NSTokenField value binding be an NSString...
The documentation for -hash says it must not change while a mutable object is stored in a collection, and similarly the documentation for -isEqual: says the -hash value must be the same for equal objects.
Given this, does anybody have any suggestions for the best way to implement -hash such that it meets both these conditions and yet is...
Hello,
I'm working on a project which shall contain two targets. One for building a Framework to use in Mac development and another to create a static library to use in iPhone development.
In the common code it's no problem to #ifdef between the platforms, but I just can't get the targets and dependencies right.
The first question is, ...
I've been doing iPhone development for the last 5 months or so, and have been using Gus Mueller's FMDB for database interaction. My next project will have both a Mac and an iPhone application, and they will share data between them, although in the end, the iPhone will be mostly a viewer app, with some minor editing capabilities.
My que...