objective-c

Xcode app version not compatible with Mac OS X version

am using Os X 10.6.4 and X code Version 3.2.3 for developing some simple app files and using PackageMaker to distribute these app files. But when trying to run the package on some other mac I am getting error that the package is not compatible with the Os X its running and file would not be installed. Is this a problem with X code or pac...

Stored Block Closure as IBAction

I am trying to reduce ceremony and out of academic curiosity I want to know how to do the following without the IBAction method defined in the .m file to use a closure whenever an Interface Builder wired action occurs such as a button press. You could say that I want to imply the cancelButtonPress method below instead of having to defin...

How to use some ruby with objective-c

I don't want to go the full rubyobjc, how would I be able to use a few ruby-terms in my cocoa/objective-c code? The reason I want to switch is because I really like ruby's syntax. It's awesome! If it's not possible, then I'm wondering if rubyobjc is good... Unfortunately I've heard that when using rubyobjc there isn't a nib/interface ...

C++ pipes in Objective-C

I made the transition from C++ to objective-C a while ago, and am now finding NSLog() tiresome. Instead, still in Objective-C, I would like to be able to write something like stdout << "The answer is " << 42 << "\n"; (I know that NSLog prints to stderr, I could put up with writing stderr << "Hello world";) Basically, I just want to...

NSImage size is wrong

Hi, I think i'm missing something really basic here. If I do this with a legal URL/path which I know exists: NSImage* img = [[NSImage alloc] initWithContentsOfFile:[[selectedItem url] path]]; NSLog(@"Image width: %d height: %d", [img size].width, [img size].height); then I get reported to the console that the width is -2080177216 and...

How to make C code to update Obj-C view controller?

Hi there, i have some C code that can NOT be ported to Objective-C but it can be compiled to run on an iPhone. Now, if i want this program to have a nice GUI, how can i let it update an objc UIViewController class outlets bound to a NIB i created with interface builder? Can you please give me some (possibly full) example to understand th...

UIScreen scale factor is 1.0 in iPhone Simulator 4.0.2 ?

Am I missing something about the @2x graphics on the iPhone 4? I'm running the 4.0.2 SDK in the iPhone Simulator, but UIScreen has a scale of 1.0, isn't it supposed to be 2.0 and load high res images automatically? here's what's I'm testing: NSLog(@"system version: %@", [[UIDevice currentDevice] systemVersion]); NSLog(@"scale factor...

How to get [UIImage imageWithContentsOfFile:] and High Res Images working

As many people are complaining it seems that in the Apple SDK for the Retina Display there's a bug and imageWithContentsOfFile actually does not automatically load the 2x images. I've stumbled into a nice post how to make a function which detects UIScreen scale factor and properly loads low or high res images ( http://atastypixel.com/bl...

How to check a variable's value using a debugger in XCode

How do you use the debugger in XCode to see if a variable is nil? ...

How do I change the color of TableView and Button controls in iOS?

I designed a web app for iPhone and am now trying my hands at a native Objective-C version, and I'd like to retain some continuity with my original design. Since my web version uses CSS, I was able to customize the color palette, even though the UI was designed to imitate a native iPhone UI. I'd like to use a similar color scheme for my...

Why does self.navigationController become nil?

I have this code: ViewController2 *childView = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil]; [self.navigationController pushViewController:childView animated:YES]; I the first line, self.navigationController has a value. On the second line, its value becomes 0. Why is that? ...

presentModalViewController vs. pushViewController

I can show a different view with this code: [self presentModalViewController:childView animated:nil]; This code should do the same thing, right? [self.navigationController pushViewController:childView animated:YES]; But it doesn't do anything. Why is that? ...

pushViewController and Navigation Applications?

Why do Navigation Applications use pushViewController instead of presentModalViewController like all the other apps? How can a Navigation Application be modified to use presentModalViewController instead? Would it be sub-optimal to do so? Why? ...

How does a Navigation-based application get access to the UINavigationController class?

In a Navigation-based application, the method pushViewController:animated can be used. This is a method of the UINavigationController class. However, nowhere in the source files do I see any #import statements that import this class. The documentation doesn't show UIViewController as inheriting from UINavigationController. So how are Na...

Custom Crop Size in UIImagePickerController

I've been struggling with this for awhile now, since there is little documentation on the subject. I have a UIImagePickerController in my iPhone application that I use to select an image to be applied as the background of a view later. This is easy enough to do. Unfortunately, if a user selects a large image from their camera roll it nee...

Core Audio AudioFIleReadPackets... looking for raw audio

I'm trying to get raw audio data from a file (i'm used to seeing floating point values between -1 and 1). I'm trying to pull this data out of the buffers in real time so that I can provide some type of metering for the app. I'm basically reading the whole file into memory using AudioFileReadPackets. I've create a RemoteIO audio unit to...

does UITableViewController have special behavior when being popped off a UINavigationController stack?

I've got a bizarre what-seems-like-a-over-release issue in a tab bar application. My advance apologies for the complexity of this problem description. Hopefully a little example code will help. I have my application delegate MyAppDelegate set up as the UITabBarControllerDelegate: - (BOOL)tabBarController:(UITabBarController *)tabBarC...

How to control the crashing of my app when i switch between tabs

Hi to all, I have created a music application in iphone . The App crashes if i keep on switching between the tabs while the song is playing. How can i solve this problem .Please anybody help me regarding this problem ...

How to get day, month, year, hours, minutes, seconds from a UNIX timestamp in Objective C on Iphone

I have been going up and down through all kinds of reference docs and examples over the web but I just can't get how to get what day, month, year, hours, minutes will it be for a given timestamp in Objective C. Any ideas? The code I'm using for the purpose is like this: NSDate *date = [NSDate dateWithTimeIntervalSince1970:128618100...

How to call a method/selector when a variable/object changes value on iPhone

Hi, I'm looking for a way to "monitor/observe" a singleton class I'm using to pass information back from an asynchronous http request. I want to update the UI once I have received and parsed the response. Since iPhone SDK does not have an NSArrayController to monitor my data in the singleton, how can I do an asynchronous UI update? Thi...