cocoa

Showing image before text in NSButtonCell in NSMatrix

Hi all, I am displaying buttons in NSMatrix. My requirement is: to change color of button title and place an image at beginning of title, when certain condition is satisfied. To do so, I used following code: // setting attributed text NSAttributedString *selectedCellAttribute; NSFont *selectedCellFon...

escape character in cocoa

Hi i'm trying to give a request to the url in iphone sdk the http method is POST. The http body contains some escape characters NSString *requestMessage=[NSString stringWithString:@"?username/u001password/u001description"]; NSMutableURLRequest *url=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://welcome.com"]]; ...

how do I observe keyboard input event while the applicaion is not actived.

how do I observe keyboard input event while the applicaion is not actived. ...

Force redraw of custom cocoa control on property change

Lets say I have a custom control called FooBox. It is just a square on the screen. It has some properties like color, border, etc. When I change the properties, I want the FooBox to redraw itself to reflect its new properties. Is there a way to do that without writing custom setters and putting [self setNeedsDisplay:YES] into all of them...

Concatenate one NSMutableArray to the end of another NSMutableArray.

Hello everyone! A simple answer to this super simple question would be great! Here is the pseudcode: NSMutableArray Africa = [Lion, Tiger, Zebra]; NSMutableArray Canada = [Polar Bear, Beaver , Loon]; NSMutable Array Animals = Africa + Canada; What I want to end up with: Animals = [Lion, Tiger, Zebra, Polar Bear, Beaver, Loon]; Wh...

Cocoa Createfileapath

hello, I am trying to create a file on mac os. the data from the file will be accessed by the app. but how to create a file having read permission on all accounts. Currently the app can read data in admin account only. I am using following syntax: BOOL B = [fm createFileAtPath:p1 contents:data attributes:nil]; is it something to do w...

NSString and UTF8 Hex Conversion

In this function, I get the selected emoticon from NSTableView from the NSArrayController connected to an IBOutlet called emotes. The string in the selected NSArray contains UTF8 characters that is sent to the clipboard. // Get Selected Emoticon NSArray * selectedemote = [emotes selectedObjects]; NSLog(@"%@",[selectedemote valueForKey:@...

Cocoa + WebView - Application window doesn't catch all clicks - sometimes clicks "jump through" to background windows

Hi, I have a cocoa based app with only a webview catching the entire window. Sometimes when I click on stuff on the page loaded by the webview - the click seems to "jump through" and arrive to the window behind mine, instead of being handled by my window/webview. The phenomena seems sporadic and I don't really have a clue why this is h...

Is it safe to to self destruct an NSThread?

Hey all, I have a pretty standard setup. I have a UIViewController to handle user interaction and a somewhat long running NSThread that does the actual work when the UI Controller shows up. One issue I've had is when I want to cancel the NSThread. Standard NSThread semantics is alright. I want the thread to finish, clean itself up (so t...

Printing Errors to a File in Cocoa/ Objective-C

Hello Fellow Computer People! Anyone willing to help will have my gratitude ;) Just wondering what is the best approach to printing errors to a file i.e. so that if my executable crashes I can have a record of what happened. This would be in Cocoa, Objective-C or C. Thanks, Eric PS. I hope my question is not too general or vague. ...

How do you re-order a window to be on top of all others in cocoa?

I want my application to become the top-level window on the OSX desktop when it needs to display important information. How would you go about doing this in cocoa? ...

Getting wrong date with initWithTimeInterval: sinceDate:

Hi, I have a date, 2010-08-23 13:30:00 -0400 and I'm trying to get it in the UTC +2 time zone. The difference in seconds is 21600 but when I call [[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate];, I get 2010-08-24 01:30:00 +0200 which should be 2010-08-23 19:30:00 +0200. Any idea what I'm doing wrong? ...

Enumerating a NSArray of different objects

NSMutableArray *array = [NSMutableArray arrayWithObjects:@"Hello World!", [NSURL URLWithString:@"http://www.apple.com"], nil]; for (id *object in array) { NSLog(@"Class name: %@", [object className]); } Given the above array of varying objects what is the proper way to fast enumerate thru them? Using the above code I do see my log st...

QCView inputKey responds to NO but crashes on YES

Hello, I have a QCView with a boolean input splitter in it. When I try and do [qcview setValue:NO forInputKey:@"showCube"]; it works as expected and the input gets set to NO. However, When I try and do [qcview setValue:YES forInputKey:@"showCube"]; I get EXC_BAD_ACCESS. I have tried using 1, YES, and TRUE and they all give the same erro...

Can you help me understand what Cocoa is?

I have spent a lot of time getting into iOS development. I have spent a lot of time familiarizing myself with objective-c as well as xcode. I have spent a lot of time going through the motions without understanding the fundamentals of what Cocoa is. I haven't grown up my entire life understanding coding concepts as some people have, and...

NSWorkspace openFile: randomly brings focus back to my app

Within my Cocoa app, I call NSWorkspace's openFile: method to open some file with its default application. Sometimes this works just fine, and the other application gets focus, as it should. But alas, sometimes (the occurrence of which seems to be totally random), after the focus goes briefly to the other application, it goes quickly b...

Coverflow for mac os

Hi all. Is their any apple sample code to implement coverflow in MacOS. Apple core animation documentation shows example of coverflow. But I could not find related sample code. Parden me if I overlooked. -Thanks in advance shakthi ...

Where is MiniBrowser example

Hello, I have installed the developer tools for Snow Leopard on my Intel Imac. But i didn't find in /Developer/Exemple/MiniBrowser as explain in some web site. Where i can get this exemple ? Thank's. ...

How can I map a list of ranges to a single value?

I've only recently jumped into the world of iphone development and objective-c, so I'm still a bit lost as to how I might implement something like this. I have a float, and I have a list of ranges that float can fall within and the corresponding value I should return, eg: 10.0 - 14.5 : 1.0 14.5 - 17.0 : 2.0 17.0 - 23.0 : 2.5 23.0 - 32....

How do I add ApplicationServices so I can #import <ImageIO/ImageIO.h>?

Apple's Image I/O programming guide says: Image I/O resides in the Application Services framework in Mac OS X, and in the Image I/O framework in iOS. After adding the framework to your application, import the header file by including this statement: #import <ImageIO/ImageIO.h> I must be "adding the framework" wrong b...