I’m trying to create a date in the BC era, but failing pretty hard. The following returns ‘4713’ as the year, instead of ‘-4712’:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [NSDateComponents new];
[components setYear: -4712];
NSDate *date = [calendar...
I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph.
My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character).
So:
1 -> 1,
999 -> 999,
1.000 -> 1k,
1.200 -> 1.2k,
1.280 -> 1.2k,
12.800 -> 12.8k,...
Hi
I am a bit uncertain on how to do this:
I start a "worker-thread" that runs for the duration of my apps "life".
[NSThread detachNewThreadSelector:@selector(updateModel) toTarget:self withObject:nil];
then
- (void) updateModel {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BackgroundUpdate *update = [[Back...
I need to handle a touch event on my custom uiviewcotroller. I have a sub controller within the view that already handle touch event (it's a plot that handle zooming and scrolling).
I want to make a tabbar disappear when I tap the screen once. Actually it only works (even tought the tabbar doesn fade away but simply is no visible) in the...
Interestingly i didn't find the answer for this seemingly trivial question - Cocoas mouse events have z-coordinates - what are they for?
...
I need a hint on how to write multiple NSData chunks to single file. Downloading a file using NSURLConnection in chunks. Each chunk is downloaded in a separate NSOperation thread. As the chunks finish downloading they need to be written to a file so combined result is the file downloaded.
What would be the best way to manage the NSData ...
My Problem is this:
My framework contains public and private headers - the public headers import private headers in the framework
My app that links against this framework imports public headers
Now when I compile it, XCode complains about missing files (the private headers that are indirectly imported via the frameworks public header...
Hi,
I have some big problem with an NSMutableArray I'm filling with objects in a database. I'm using [appDelegate.myArray addObject:myObject], then somehow the object gets crushed in the memory, I don't know why, I didn't release anything...
Thanks for your answers (and sorry for my poor english xD)
...
Yes, I'm being lazy.
What happens when I call performSelector:onThread:... and pass in a thread that's currently blocked (on synchronous I/O, for instance)? Does the selector just get queued to be executed later?
...
I am using a UITableView to display the results of a series of calculations. When the user hits 'calculate', I add the latest result to the screen. When I add a new cell, the UITableViewCell object is added to an array (which is indexed by tableView:cellForRowAtIndexPath:), and then I use the following code to add this new row to what is...
Hi everybody. I'm having problems installing pyobjc on SnowLeopard.
It came with python 2.6 but I need 2.5 so I have installed 2.5 successfully. After that I have installed xcode. After that I have installed pyobjc with "easy_install-2.5 pyobjc"
But when I start my python 2.5 and from cmd line try to import Foundation, it says "no modu...
I'm using Mac OS X 10.6 SDK ImageKit's IKSaveOptions to add the file format accessory to an NSSavePanel using:
- (id)initWithImageProperties:(NSDictionary *)imageProperties imageUTType:(NSString *)imageUTType;
and
- (void)addSaveOptionsAccessoryViewToSavePanel:(NSSavePanel *)savePanel;
I have tried creating an NSDictionary to speci...
applicationDidFinishLaunching on my app delegate is being called when I run my Python-Cocoa app from the Terminal (i.e. python myapp.py). However, if I then use py2app to create an .app bundle, applicationDidFinishLaunching does not get called when I open the .app bundle.
...
Hi,
I am trying to update another windows when the one becomes visible. So I found the NSWindowDidExposeNotification and tried to work with it, so I wrote in my awakeFromNib:
// MyClass.m
- (void)awakeFromNib {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(me...
I have some strange problem with CATransactions nested:
- (void) setXShift:(int)newShift;
{
[CATransaction begin];
[CATransaction setAnimationDuration_c:1]; //1
if(newShift > 0 &&
image.x < image2.x &&
image.x <= 0 &&
image.x > -image.w + 800)
{
[CATransaction begin];
[CATransaction s...
I have used 4 NSButtons and assigned them to the 4 arrow keys separately to move in four different directions. Now I want to use two keystrokes, left arrow and up arrow together simultaneously, for north east movement, how can I do it?
I am only able to use one keystroke at a time , I need to catch two key strokes simultaneously, I need...
I know this is not normally recommended but I really need to access the NSPopupButtonCell of NSPopupButton. Is there a way to do this?
...
Hi All,
How to build the libsox.la library and integrate into xCode for editing audio in iPhone ?
thanks
...
I have a bunch of HTML resources in my app organized in a hierarchy like so:
dirA
|---> index.html
|---> a1.html
|---> a2.html
|---> dirB
|---> b1.html
|---> b2.html
|---> dirC
|---> c5.html
|---> c19.html
I'm trying to collect the absolute paths of all HTML resources however deep down, but can't seem to figure...
I have two entities: A and B
A has two properties from and to, both pointing to the B entity.
B as a fetched property to A with predicate from == $FETCH_SOURCE or to = $FETCH_SOURCE
-- (from) ->
A -- (to) -> B
<- (As) --
In my application I select a certain B instance, and then show all of its A instances.
Now, in my tab...