objective-c

How can I convert hex number to integers and strings in Objective C?

Given the example of an array like this: idx = [ 0xe, 0x3, 0x6, 0x8, 0x2 ] I want to get an integer and string representation of each of the specified items in Objective C. I have mocked up a ruby example which works perfectly: 0xe gives 14 when i run 0xe.to_i and "e" when i run to_i(base=16) 0x3 gives 3 when i run 0x3.to_i and gi...

How do get reference to another class properly?

I have some class initialized in Appdelegate, but when I get this class instance form Appdelegate in another class it has "fresh" state. I have following in AppDelegate: Interface: @property (nonatomic, retain) DataController *dataController; Implementation: @synthesize dataController; - (id)init { if (self = [super init]) { ...

UIDatePicker inside UIScrollView with pages

I have a UIScrollView with 2 pages, and I can scroll horizontally between them. However, on one of my pages, I have a UIDatePicker, and the scroll view is intercepting the vertical touch events so I can no longer manipulate the date picker (except by clicking or tapping). Is there some way to tell the ScrollView to send the vertical to...

How would you make a text cell in a an Outline View show how many children the parent row has?

How would you make Rows that are the Top Parent in an Outline View (which is connected to a NSTreeController) display how many children it has in a Text Cell? If this is a bit confusing here is a Picture of what I mean. I am talking about the number to the right of one of the rows in the circle, which is displaying how many childre...

Cocoa Touch UITabBar action on tab switch

I have a UITabBar with a number of UITabBarItems. I've assigned a different view controller to each of these. I want to load some data etc., when each button is clicked. Therefore I will like to know where to put that code? I tried implementing viewWillAppear and viewDidLoad in the view controller but those didn't get called. ...

Toll free bridging gotchas

Are there any gotchas for Toll free bridging between NS and CF types? I'm not sure if I'm doing it wrong but I can't seem to use CF opaque types like ABAddressID inside of an NS Array. ...

Read only "N" bytes from a file in Cocoa

How to read only "N" bytes from a specified file? ...

Garbage Collection Crash using NSImage

This piece of code was split off from a project I am working on. It consistently reproduces a garbage collection error on my Mac OS 10.5.7 and sometimes crashes. I have been looking at it for too long so my question is: does anybody else see why this would give errors when garbage collection is on? - (void) doCrash: (id) sender { NS...

Should I worry about collisions in NSUserDefaults?

In the application I'm working on, I'm generating a username and password and storing them in [NSUserDefaults standardUserDefaults]. I know there's some system-wide information you can retrieve from there; does that mean all the applications on the phone have access to everything in there? I'm currently prefixing the keys I'm using in th...

How does one get the error message from compileAndReturnError?

I've seen plenty of examples on how to use NSAppleScript, e.g.: NSAppleScript *script = = [[NSAppleScript alloc] initWithSource:source]; NSDictionary *errorDict; if ( ![script compileAndReturnError:&errorDict] ) { // ... } But I've never seen any example code that does anything with errorDict. In my case, I'd like to extract the ...

How to parse strings in Objective C

Hi Guys, Can someone help me to extract int timestamp value from this string "\/Date(1242597600000)\/" in Objective C I would like to get 1242597600000. Thx ...

Mac OS X View Swapping

I am developing an application which has an image and some buttons whose position remain unchanged during the entire flow. So I subclassed the NSViewController. This is the main view of my application with the fixed buttons and image. I add an NSBox item into which various subviews will be displayed and swapped in/out. How do I display t...

YAJL on the iPhone

Has anyone got the YAJL Json parsing framework to work with iPhone? And if you have can you post simple instructions on how to link to it. I want to use it with the MGTwitterEngine framework. Currently I am getting these errors.. "yajl_get_error" referenced from .. and a few tohers very similar. YAJL http://lloyd.github.com/yajl/ M...

Can Uncrustify align colons in Objective-C method calls?

I am using uncrustify 0.52. When I run it against Objective-C files, it wants to convert method invocations like this: [NSApp beginSheet:startTimerDialog modalForWindow:nil modalDelegate:nil didEndSelector:nil contextInfo:nil]; to this: [NSApp beginSheet:startTimerDialog modalForWindow:nil modalDelegate:nil didEnd...

How do I determine the country an iPhone was purchased in?

Does anyone know how to do this? I want to have different behavior if my iPhone is from the USA to the behaviour of UK models (namely, listing prices in $ rather than £), and don't want to force the user to use their current location, as this requires the user to have a network connection or GPS active. UIDevice doesn't seem to have an...

how can I retrieve an integer value from an NSMutableArray on the iPhone?

How would I get an integer value out of an NSMutableArray? ...

How would you make a Status Item show or Hide a window when clicked?

How would make a Status Item when the actually button is clicked in the Menu Bar not in a drop down menu show or hide a window? Sorry if this is a bit vague. ...

How would you make a checkbox in a Outline View become checked when all it's children's checkbox's are checked?

How would you make a checkbox which is on a parents/groups row in an outline view become checked when all it's children's checkbox's are checked. But when only some are checked display a line. Here is an example of what I'm talking about: ...

Setting UIImage dimensions on UITableViewCell image

I've got a standard UITableViewCell where I'm using the text and image properties to display a favicon.ico and a label. For the most part, this works really well since UIImage supports the ICO format. However, some sites (like Amazon.com say) have favicon.icos that make use of the ICO format's ability to store multiple sizes in the same ...

How do I use a dynamically load library in a command line utility?

Possible Duplicate: using frameworks in a command line tool Hey, I've written a command line 'foundation tool' that uses the RegexKit.framework extensively. Everything works when run in Xcode but if I compile the release build and try to run it in Terminal I get the following error: dyld: Library not loaded: @executable_path/....