I'm having trouble getting my UI to reflect external changes (made by another process) to an sqlite data store.
I have a fairly standard core data based NSArrayController / table view. My app gets notified that external changes have been made to the data, at which point I do a
[managedObjectContext reset]; // brute force, but data set ...
I need to format a float (catchy title, he?) to 2 decimal places, but only if those decimal places have values that aren't zero. Example:
I have a NSTextField named 'answer', after I do some math with a couple of floats, I want to assign my 'answerFloat' variable to the 'answer' NSTextField. So far I've got:
[answer setStringValue:[NSS...
Greetings,
I'm sure that this is probably an incredibly stupid question, but...
What does the following line actually do?
string = @"Some text";
Assuming that "string" is declared thusly in the header:
NSString *string;
What does the "=" actually do here? What does it do to "string"'s reference count? In particular, assuming th...
I'm looking for some guide, I already looked at it a bit on cocoadev and in a book but I didn't find any good guide. I mean those guides were talking about multiple concepts at once so now I only want a simple straightforward guide about how to use it.
Anyone knows any good guide?
Thanks!
...
I had a couple questions related to this: http://stackoverflow.com/questions/2035994/asterisk-usage-in-objective-c
NSArray array; in a local scope would be an object "allocated" on the stack. NSArray *array; indicates an object backed by a hunk of memory, typically allocated from the heap.
How do you know when something is allocat...
For some reason, an NSTextField isn't allowing me to paste anything into it using Command+V, though I can paste into it if I right-click and click 'Paste'. Why is this happening and how do I fix it?
...
I have a NSPopUpButton subclass that i use as a NSTextAttachmentCell. This cell is inside an NSAttributedString that is the data of a cell in a NSTableView. Now I d like to get the mouse events on the cell in the table trough to the NSTextAttachmentCell. Currently the events do not get trough to the attachment cell, unless the cell in th...
Hi
I have an array of NSDates which I build from strings using [NSDate dateFromString]
In the xml I parsed to get the string there was also a timezone string. As far as I can see in the manual NSDate does not in it self deal with timezones. Do I need to always store this timezone value somewhere and pair it with the belonging NSDate eac...
I want to know how to export a 2 minute QuickTime movie in Cocoa.
...
Mathematically any number with an exponent of 0 is supposed to equal 1 (my remedial math research assures me).
But this code produces 5:
[NSDecimalNumber decimalNumberWithMantissa:5 exponent:0 isNegative:NO]
Is this something standard in computer programming -- that can be relied upon not being "corrected" in future Cocoa versions?
...
Hi,
I am trying to get each pixel point of a Square drawn using Core graphics.Here by making the stroke color black color,I am drawing the Square.Please give me an idea how I will get all pixel point on which this square is drawn.
- (void)drawRect:(CGRect)rect
{
CGMutablePathRef path = CGPathCreateMutable();
CGContextRef ctx =...
While 10.6 introduced the neat - windowDidEndLiveResize: et al for NSWindowDelegate, i need similar behaviour in 10.5 to avoid constantly invoking heavier functions via - windowDidResize:.
Currently i can only think of a timer-based solution (i.e. checking in short intervals for when the last resize occured), which seems ugly.
Is there ...
I have a situation where I want to print a multi-page PDF. While I could use the PDFKit utility classes and/or quartz functions to get the information to manually write drawing/pagination code for a NSView subclass, I had thought that quicker alternative would be to create an off-screen PDFView and tell it to print itself. When I tried t...
I'll say right off I am an inexperienced Cocoa programmer, and I apologize if my question is answered in the docs somehow and I merely missed it, or there was something I don't understand in how the NSPredicateEditor works. However, I did attempt to search in the docs and googled, to little effect. Thus, I bring the question to you.
I a...
I'm having strange problems parsing (apparently) correct XML code!
The xml parsed is:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<results>
<file id="0" name=" Linux Ubuntu.rar 700.64 2" size="700" disp="2"/>
<file id="1" name=" [Soft] Sistema operativo Linux. ...
What method must I implement in my cocoa application’s delegate so that on launch, it’ll open a url? (http/https, in this case) I’ve already implemented the url schemes, I just need to know how I can get my application to open on a url notification.
Update: I’m sorry, I wasn’t very clear. My application IS a browser that support https/h...
I'm looking for Apple documentation regarding the "delegate" and "datasource" methods for NSTableView. They don't appear in the NSTableView Class Reference for some reason. Any idea where I can look? Here's an example of one of them:
- (void)tableView:(NSTableView *)tableView
setObjectValue:(id)object
forTableColumn:(NSTableC...
On windows, each thread has a message queue, and each message queue will process messages for the windows owned by that thread.
This means that it is quite simple to write an application where you can create a thread, with a message loop, and one (or more) windows. Ignoring any kind of application issues, one now has application windows ...
Can you refer to the sender of a message without passing the sender as a parameter?
This is simplified code for the sake of discussion:
// mainTableViewController.m
[dataModel loadData]; //Table is requesting data based on user input
// dataModel.m
-(void) loadData{
// I want to store the sender for later reference
se...
How can I in Interface Builder set NSButton of type toggle with Title and Alt.Title to start with the Title (e.g. the state 0)?
The moment I set the button as toggle and set the Alt.Title it displays Alt.Title in View and I can't find the option to set it to start in the 'default' state (state 0).
I could set it pragmatically but is th...