objective-c

Process touches behind the UINavigationBar

In my application, I'm displaying a fullscreen image in a 320 x 480 frame. After I display the image, I fade the navigation bar out to allow the user to see the whole picture. When the user taps in the area where the navigation bar was, I would like to bring the navigation bar back. This is very similar to what happens in the iPhone Pho...

Detecting Download in UIWebView

I have a programatically crated UIWebView, and it is used to browse a iPhone-style site stored on my server. In this website, there are a few links to files users can download into my application. Right now, I'm trying to detect this with: - (BOOL) webView:(UIWebView *) webView shouldStartLoadWithRequest:(NSURLRequest *) request navigat...

How do I prevent text entry in a UITextView?

I have a text field entry in my view that I would like to block access to during a background operation. I've tried using the editable property, which successfully blocks access during the background operation, but the moment I set editable to YES, the keyboard comes up and the textfield becomes the first responder. Dismissing the keyb...

Key value Observing during UIView Animations

Hi, I'm animating the center property of a view in my program. During the animation, I need notifications when center hits a particular value. I tried adding the myself as a key value observer for the center property of the view . However, I only get notified when the animation begins. So I'm unable to detect if/when the object passes ...

Cocoa-Touch, NSManagedObject: Exception when setting a property.

I have a NSManagedObject subclass, created by the XCode model interface. This class has some NSString and NSNumber members, and a NSDate member. When I try to set the NSDate member, I get the following exception: 2009-10-12 21:53:32.228 xxx[2435:20b] Failed to call designated initializer on NSManagedObject class 'Item' 2009-10-12 21:53:...

To retain or not to retain

If I am adding an item to a dictionary like this: [connectionHandlers setObject:projectsHandler forKey:[NSNumber numberWithInt:PROJECTS_CONNECTION_ID]]; Should I be retaining the NSNumber used for the key. Also, when an object is added to an NSArray or NSDictionary, is it retained by the Array or Dictionary when added and released wh...

Replace " " character in an NSString with "\ " (to create a Unix path)

Using the following doesn't work: - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement By doesn't work I mean does not do any replacement what so ever. It returns the same exact string. Is there a convenience method to do this? Similar to: - (NSString *)stringByReplacingPercentEsca...

Objective-C: Best way to access REST API on your iphone

Hi guys, been wrestling with this for some time. I am trying to access a REST api on my iphone and came across the ASIHTTP framework that would assist me. So i did something like //call sites, so we can confirm username and password and site/sites NSURL *url = [NSURL URLWithString: urlbase]; ASIHTTPRequest *request = [[[ASIHTTPRequest a...

Pointers for data returned by delegate methods in MacRuby

I'm working on a small MacRuby project, using 0.5b1, which is implementing the delegate methods required for Growl (the app is using Growl for notifications). I would like to be able to respond to the Growl callbacks when the notification is clicked, however when you register the Growl delegate with ::GrowlApplicationBridge.setGrowlDele...

Are There Any Good Open-Source Mac Application Templates

I am looking to make a Mac version of one of my iPhone apps and was looking for a good ay to hit the ground running. I know how to code in Objective-c and Cocoa, and I know how to piece something together from scratch if I have to, but I am looking for an easier way. Are there any open-source templates for coding Mac desktop applicatio...

Core Data Migration Across Multiple Version Upgrades

I have an iPhone app that uses Core Data. I did an update and used Lightweight Migration to go from V1 to V2 of my MOM (Managed Object Model). This worked perfectly. What happens when I want to go to V3 (and beyond) of my MOM? If I decide to continue with Lightweight Migration, will it automatically deal with migrating from V1 to V3...

SQLite Access in Objective-C and Cocoa

Hi Everyone, I am in the process of learning Objective-C for Mac/iPhone development and decided to try and write something useful without looking at the bible (Aaron Hillegass: Cocoa Programming 3rd Edition). I'm writing a simple puzzle game. The data that defines the levels is stored as a string in a SQLite database and read into a le...

xUnit Testing Framework for Mac/iPhone

Does anyone know of any xUnit testing frameworks for the Mac OS, more specifically for the iPhone OS? I've seen a couple online, google-toolbox-for-mac & objcUnit, but they don't seem to have had any development on them for a long time. Are there any Objective-C developers out there that perform unit testing and if you do what tools do...

Observing animated property changes in a CALayer

I have a CABasicAnimation that animating a property of a CALayer e.g. bounds.origin. I want to be able to observe the property changing over time, but haven't really found a method that works 100%. I tried using KVO (key-value observation) on the presentationLayer's bounds.origin keyPath. The system complains that the object is freed b...

UITableViewController Title

I need another caption for navigationItem that I put in self.title. In self.title I have short name for back button and for toolbar buttons. I found simple solution, just create one more UIView attach to it UILable with my caption and then just self.navigationItem.titleView = containerUIView; After I returned from other UIView via bac...

Compiling Objective-C project on Linux (Ubuntu)

How to make an Objective-C project work on Ubuntu? My files are: Fraction.h #import <Foundation/NSObject.h> @interface Fraction: NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) n; -(void) setDenominator: (int) d; -(int) numerator; -(int) denomina...

How do you animate the resizing of a tableView without its rows/subviews getting clipped?

EDIT: I originally asked this question in regards to general view resizing, but I realize now that it's something much more specific to tableViews. Say that a tableView originally has a frame of (0 0, 320 460), i.e., it fills an entire iPhone screen. In order to resize the tableView's height and animate the resize, I map the following ...

Can't fix Severe Memory Leak from Open AL

Hi there! I'm nearing the end of a big iPhone project and whilst checking for memory leaks stumbled on this huge one. I implemented the sound following this tutorial: http://www.gehacktes.net/2009/03/iphone-programming-part-6-multiple-sounds-with-openal/ Works a charm, a lot of people use it but I get a huge leak a start of the project...

UIToolbar with images and titles like UITabBar

Hello, is it possible to create a UIToolBar containing UIBarItems with both, images and titles for better explaining the function behind the item? A UITabBar is designed to select 1 of n items. The current item is highlighted. This is not what I need. I'm needing to call a function without selecting the current toolbat item! ...

How can I view an NSError?

What's the best way to log an NSError? - (void)epicFail:(Lol *)aLol withError:(NSError *)error { NSLog(@"Error: %@", error); } Gives me a null message Thanks. ...