objective-c

Xcode iPhone SDK "Terminating app due to uncaught exception"

Hi. I have a problem with my application for the iPhone. It's a tab based application. In one of the tabs, I have a Table View. I have set it up to load in data from a PLIST. My problem is that when I try to build and run it, the application either crashes, or stays at a black screen with the error message "Terminating app due to uncau...

iPhone UITableView populateing from connectionDidFinishLoading

Hey all. I have been trying for hours to figure this out. I have some JSON from a NSURLConnection. This is working fine and I have parsed it into an array. But I can't seem to get the array out of the connectionDidFinishLoading method. I an am getting (null) in the UITableViewCell method. I am assuming this is a scope of retain issue, bu...

How Do I Take a Screen Shot of a UIView?

I am wondering how my iPhone app can take a screen shot of a specific UIView as a UIImage. I tried this code but all I get is a blank image. UIGraphicsBeginImageContext(CGSizeMake(320,480)); CGContextRef context = UIGraphicsGetCurrentContext(); [myUIView.layer drawInContext:context]; UIImage *screenShot = UIGraphicsGetImageFromCurrentI...

smooth pendular animation with Core Animation Framework

Hi Guys, im trying to do an animation with an uiimageview. in this view is an image with an arrow, that i want to rotate about 45 degrees back and forward very smoothly like an pendular or an old clock. something like this, just smooth and with my image: http://bit.ly/cArvNw (found this with google ;) ) my current setup looks like thi...

NSMutableArray Strings changing after reading in from file

I have a NSMutableArray that I create on program load. If the program terminates, I save the array to a file. Then when the app starts again, I check to see if this file exists and if so, read it in as the array. Problem is, on first creation everything is fine, I check an array object against a certain string and if it is equal, do...

Objective-C for iPhone - app crashing when using simple date commands

Hi everyone... I'm still learning Objective-C so forgive me if this is a simple amateur mistake, but I guess we all have to learn somehow. Basically I have an app with a simple bit of text, at the header of the screen, which has been IBOutletted and called 'headerText'. I want this to read "Summary for February", replacing February wit...

Setting a UIWebViewDelegate programatically.

I am trying to build a custom control based on a UIWebView and compile it into a library for reuse. Everything was working just fine when I had the code all together in a single test app but I'm having some trouble setting up a the delegate for the view for a library. Of note, the sample app used interface builder and thus the delegate...

iPhone app crash logs -- How can I use them to debug my app?

I'm not an expert in programming in general. I can find my way around Objective-C and Xcode and build working apps with no huge problems but when BUGs arise I'm often lost as to where to begin. My app works fine on the sim but more often-than-is-comfortable it crashes on the device. I looked at the crash log to see if there was any clu...

How to control the scientifc style of NSNumberFormatter?

Hi, I'm converting a long string representing a very big or small number to a string in scientific notation. E.g. 9999999999999999999999999 to 9.999999999999999E24. I use NSNumberFormatter. NSNumberFormatter *ns = [[NSNumberFormatter alloc] init]; [ns setNumberStyle: NSNumberFormatterScientificStyle]; NSString *result = [ns stringFromN...

When "programmatically" creating UINavigationController and UITabBarController, how do I address their functions (like viewWillAppear?)

I am creating my Nav and TabBar in code at launch via: IN : myAppDelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { // set up a local nav controller which we will reuse for each view controller UINavigationController *localNavigationController; // create tab bar controller and array to hold the...

Language-Portable Example Programs

At the moment I am learning Objective-C 2. I'm aware that it's used heavily by Mac developers, but I'm more interested in learning the language at this point in time than the frameworks for developing on Mac OS X/iPhone (except for Foundation). In order to do this I want to write a few intermediate* console applications, but I'm stuck fo...

Printing an NSString

What's the correct way to print an NSString in Objective-C? A lot of examples use NSLog(), but according to the documentation: NSLog is a FoundationKit function for printing debug statements to the console. ... NSLog works basically like: fprintf(stderr, format_string, args ...); Which to me is a bit like the _TRACE macro i...

method taking mutli arguments in dot notation

i am viewing this video on objective c. the guy show a method which takes multiple arguments and it looks like this - (void) setTo: (int) n over: (int) d { .... } to use it he shows: [myFraction setTo: 100 over:200]; how would that bracket notation look in dot noation? andi dont understand what that over means, would anyone know? ...

Week View Control for Cocoa (Apple Mac OS X Dev)

Hi there, does anyone know if there is a control for Cocoa that has the same abilities like the iCal Week View? Which means a spreadsheet like view for the whole week with Appointments to render in their timeframe. I searched through Google for some time now and didn't find anything. Thx in Advance Steve ...

Is there a class / method to handle dragging views?

Hi all, I found a useful tutorial to get started in understanding how to Cocoa handles touch events. I've used this as a base to create a custom script, I'm trying to make a UIView draggable, very similar to the native Maps application. I've written a custom script, using the touchesBegan method it will capture where the input began ...

How can I configure XCode to generate warnings for methods without prototypes?

I'd like Xcode to warn me if I define a method but don't declare it in the class's @interface block. Is this possible? Thanks. ...

iPhone: Crash While Drawing CGLayers Stored in Array

I'm trying to build a drawing app with redo and undo functionality. My idea is to draw lines in a layer in "touchMoved", then saving the layer in "touchEnded". I'm not shure that I am drawing to the layer correct, everything works fine though, until I clear the image I'm drawing in on and try to redraw the layers in the array. - (void)...

Objective C NSString being released in singleton

Hi, I'm constructing a small iphone app and using a singleton to store and update a string that gets updated when the user taps letters or numbers on the screen to form a code. i.e. they tap 3 then S then 4 and I need to track and combine that input to give me "3S4" say. When the singleton is initialised it creates an empty NSString a...

FrontRow tutorial for Xcode

I was wondering if there was a basic tutorial to get me started on coding a FrontRow plug-in / add-on using Xcode. I searched Google a couple of times, but I haven't found a tutorial on this subject so far. ...

Getting name of the class from an instance

Hi everyone I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. Any guess how to get this? Thank you very much! ...