objective-c

Objective C map view question

Hello, I have been working with the map view and came across these variables: span.longitudeDelta and span.latitudeDelta... They seem to effect the amount of zoom of the screen(possibly by setting the window's x/y?) Can anyone tell me what these values do and how they relate to the screens width/height in degrees of lat/long? Thank y...

A basic question about dealloc/release: is it always OK to do x = nil; [x release]; - or can it cause probems?

Hello, since every assignment to a variable with a different object increases its retain count and in the dealloc its not always clear how often a variable got assigned a simple [maVar release] might NOT BE SUFFICIENT. So using ALWAYS myVar = nil sets the retain count to zero, and a subsequent [myVar release] will never cause a problem...

kCGErrorFailure: unknown error code: invalid memory allocation

I'm getting a strange CoreGraphics error from the following code: NSView *docView = [[[webView mainFrame] frameView] documentView]; NSSize s = [docView bounds].size; [[docView window] display]; [[docView window] setContentSize:s]; // Commenting this line removes the errors. Here are the errors: a.out[20033] : unknown error code: inva...

Can't figure out why this is a memory leak, please advice!

I have this UITableView app, a basic diary app, in this method XCode says I have a memory leak. The first line that leak is suggested to start is 117 "NSString *CellIdentifier". Down to if (cell ==..., to Diary *diaryEntry, to NSString *stringDate. There it states that the Method returns an object with a +1 retain count, owning. I've tri...

Knowing when -viewWillAppear triggered but -viewWillDisappear hasn't

Is there a way to know that a view controller is somewhere in the view controller lifecycle between -viewWillAppear and -viewWillDisappear? I ask because I want to be damned sure that a method isn't fired when my view is either not on screen, or is about to disappear from the screen. When the view is about to disappear from the screen, ...

Objective-C compiler flags

When compiling Objective-C from the command line (gcc), what are some good flags to use? Many of the standard C flags (-Wall, -ansi, etc) don't play well with Objective-C. I currently just use -lobjc and -frameworkwith various frameworks. ...

Adding item to NSMutableArray with function results in no

I have the following utility method declared, where "players" is a NSMutableArray object and a property of my application's view controller. My problem is that "players" still has 0 objects after this method is called. -(void)addPlayerNamed:(NSString *)name withLife:(NSNumber *)life{ NSMutableDictionary *newPlayer = [NSMutableDiction...

retrieve single object from NSFetchRequest

I want to get a single object from my Core Data datastore, here is the code I have been using but it returns an array of objects, there must be a simpler and better way: NSFetchRequest *request= [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Manufacturer" inManagedObjectContext:managedO...

Help to decipher iPhone app code

Can someone please help me decipher this code? It's executing when a user pushed a button to submit the data, or in this case, a "question" in the iPhone app. I know that it's sending the string to my phpscript.php hosted on the server, but what i'm not familiar with are the long list of commands happening. NSUserDefaults *p = [NSUserD...

Animating UIView with UIViewContentModeCenter causes break in background

I'm attempting to animate a UIView that has all of its content drawn in the drawRect method. If I try to animate the view with the default settings, the content gets stretched out in a really unappealing manner. My solution was to change the content mode of the view to UIViewContentModeCenter. As the content in the view is centered anyw...

Is it possible to somehow save UIActionSheet indexes?

Hi, I would like to use an ActionSheet for sorting options in an app containing many table views with navigation controllers. My problem is that I cant seem to keep the last selected index on the sheet after poping back one level or quitting the app. The index value defaults back to 0 and I just cant seem to change its initial value. It...

How can I determine UITabBarItem position?

How can I determine if a UITabBarItem has the title "Hello" and is in position 0? ...

UIImage from CALayer - iPhone SDK

Hi all, In my application, I have created a CALayer (with a few sublayers - the CALayer is composed of shapes added as sublayers). I am trying to create a UIImage that I will be able to upload to a server (I have the code for this). However, I can't figure out how to add the CALayer to a UIImage. Is this possible? Any advice would be ...

UITextField : testing text property for empty string or nil or null doesn't work!

Hi! I got this weird problem testing for empty (or null) text property. Here my setup : I got a view with 6 textfield in it and here the code I use to go thru those field (loaded in a NSMutable Array)... NSEnumerator *portsEnumerator = [appliancePorts objectEnumerator]; UITextField *tmpField; newSite.port = [NSMutableArray array]; whil...

objective-c string, string-formatter

I have a program with which dreamlax worked a lot with me on, which uses Objective-C to convert temperatures between the Fahrenheit, Celsius, Kelvin and Rankine temperature scales, but converting console-input into Kelvin, and then from Kelvin to the end-user's desired temperature scale. Now, I have an idea I would like to implement for...

Creating a program loop for the first time in objective-c

I am trying to add some "replay-value" if you will to my temperature scale conversion console program in Objective-C by adding a simple loop. Now, here is the code for my current main.m file: #import <Cocoa/Cocoa.h> #import "class.h" int main(int argc, char *argv[]) { int result; int prompt, prompt2, sourceTempText; double sourceTe...

Solution for passing special characters from iPhone to PHP Script (SQL Database)

OK, after much research, and help with stackoverflow users, I've narrowed down how to fix my problem. Most special characters work, except the ampersand. So, how can I implement the following code twice? I want to do this [[tvQ.text stringByReplacingOccurrencesOfString:@"&" withString:@"and"] stringByAddingPercentEscapesUsingEncoding:N...

make CAlayers using for loop

sorry for the simple question but how do you make a CAlayers using a for loop? I have this now but what is the proper way of doing this? for (int n = 1; n <= 6; n++) { NSString *theCloud = [NSString stringWithFormat:@"cloudImage%d",n]; NSString *theCloudLayer = [NSString stringWithFormat:@"cloudLayer%d",n]; CALayer *theClou...

UITableView not refreshing appropriately

I have a selectedArray defined as a property in my file that holds which cells have been "checked". When displaying the cell I check whether or not the current cell value is in the selectedArray, and if it is, I display the UITableViewCellAccessoryCheckmark as the table's Accessory View. The only problem is, when the user searches for t...

Doxygen structural command for methods

Hi I have a protocol in a header file with several methods. I am using Doxygen to document the APIs. What I am trying to do is to put the Doxygen comments 'outside' of the protocol, so as to enable readability of the whole protocol without the comments. Doxygen has a structural command for protocol so i can put something like this at t...