objective-c

Not getting the selected value from a PickerView

Im doing an Iphone app with a UIPickerView. The picker view has two columns that contains NSStrings. I have a button that generates a NSString containing the selected value of both columns in the PickerView and prints it in the log. The problem is that it only prints the first two items in the picker view even if i change the selected v...

XCode and the iPhone SDK: C++ Standard Library Type?

Because I'm a novice to all things C++ and gcc related I need to understand something that's potentially critical. If I use .mm files in a new iphone project whose output is a static lib I get this error: "___gxx_personality_v0", referenced from: If I change the C++ Standard Library type from Dynamic (the default) to static the err...

Parsing JSON dates on IPhone

Forgive me as I'm new to Objective C. I am getting back dates from a .NET webservice in the /Date(xxxxxxxxxxxxx-xxxx)/ format. I'm looking for some direction on how to best parse this into an NSDate object. I've tried using dateWithTimeIntervalSince1970 on it but it comes back with a date in the year 1969 for a date I know is in 2006. ...

Preloading multiple background music

I am trying to preload a bunch of background music files. Basically i am calling preloadBackgroundMusic several times. This breaks on me when i try it with SimpleAudioEngine : [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"]; [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"]; but when I...

How can I edit a mutable property in Objective C?

Hello. I am trying to edit a mutable array from a property and can't seem to directly make it work. Consider the following code that seems to work, but seems also very inefficient; I have to copy the whole property array just to make a change in one object. Why can I change the whole "carNames" array, but can't make a change to one...

Good use of plist

When It comes to .plist files, it's a bad practice to use them to save data other than user settings ? For example, using plists to save the data of levels in a videogame, or the prices of an item in a RPG game, ect. ...

CVDisplayLink instead of NSTimer

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note http://developer.apple.com/mac/library/qa/qa2004/qa1385.html Is it better to do the actual rendering within the displaylink callback itself, or should I instead call setNeedsDisplay on the view and let the main threa...

Three20: Make a TTTableItem link to a TTViewController

I want my table items to show the disclosure arrow and link to another "details" screen. Pretty standard. Three20 is supposed to help with this. In my TTListDataSource, I'm currently doing: - (void)tableViewDidLoadModel:(UITableView *)tableView { [super tableViewDidLoadModel:tableView]; // Construct an object that is suitab...

Month TableView Organizer

I need to create a table view with 1 or 2 sections, depending on certain conditions. The first section needs to contain all of the remaining months of the current year, and the second section contains the preceding months of the next year, up to but not including the current month. Example: 2009 November December 2010 January ...

Default Header view for UITableView

I have a UITableView that is styled as a grouped tableView. Under certain circumstances I need to create a custom view for the header and under other circumstances I want the default one. Creating a custom header is the easy part - simply use the delegate: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger...

Redrawing NSCollectionView on Scroll Causes Breakup of Graphics

I have a minor irritant in an NSCollectionView in which the NSCollectionViewItem's break up visually when I scroll the window. The rate of breakup depends upon the rate of scrolling. For example, if I scroll slowly the breakup occurs more often. Fast scrolling less so. It appears that the problem is when the custom NSView of the NSColle...

Memory Leak when using for(object in array) with iPhone SDK

Hey Everyone, I am running into some serious memory leaks in one of my applications I am building. I have a UINavigatonController that is inside a UITabBarview. Inside the NavView is a MKMap view. When you click an accessory button on a callout a detail view is loaded. In that detail view I am trying to populate a table from a plist usi...

Copy a file from /file to /folder/file

Hi. I have been working on an app for a while now, and it is supposed to copy files. I have the code: - (IBAction)moveFile:(id)sender { NSFileManager *filemgr; filemgr = [NSFileManager defaultManager]; NSString *fileToMove = [NSString stringWithFormat:@"%@", "TestText.txt"]; if ([filemgr copyItemAtPath: fileToMove toPath: @"./T...

Is if(obj && obj != nil) correct and necessary?

Two parts to this question 1) Is this understanding of what's going on correct? "if (obj)" is testing to see if the pointer is not 0x0, aka set to an integer memory address "if (obj != nil)" is comparing the memory address of the object to the memory address of the universal nil object 2) So in a situation where I don't know if a varia...

NSTextFieldCell vertical alignment, solutions seem to squash the horizontal alignment.

I have a NSTextFieldCell that I wish to display with middle vertical alignment. Thanks to an older question here and a blog entry I have two working solutions. However, both solutions seem to squash my ability to set the cell as right aligned. Can anyone help me make either of these solutions support both forms of alignment? Here i...

Displaying UIImagePickerController within another UIVie

I've been working pretty extensively the last couple months with UIImagePickerController, particularly with the new capabilities in OS3.1 and newer to overlay views on-top of the camera view. This has worked just fine. However, I am currently working on a project where I'd like to be able to display the camera view of the UIImagePickerC...

tableView: titleForHeaderInSection: causing crash

For some reason, the tableView: titleForHeaderInSection: method is causing the application to crash without giving any details as to why. I know it is this method because when I comment it out, the table loads, just without headers obviously. - (void)viewDidLoad { [super viewDidLoad]; NSArray *monthArray = [NSArray arrayWithObj...

iPhone - does TouchXML use an undocumented APIs?

Recently I've heard that Apple is using tools to search for references to undocumented APIs and are rejecting iPhone apps from the App Store because of it. The popular Three20 framework is causing people to get rejected. I also just saw that the KissXML library has also caused rejection. I'm looking for an Objective C DOM-based XML p...

set/get fn-lock for a macos application

Does anybody know a way to set/get the fn-lock from an application so you don't have to press the 'fn' key to get F1, F2, etc. on a macbook or apple keyboard? I want to have it always on for my application but keep the standard behavior in the rest of the system. ...

passing structs over UDP weakly typed

I'm new to network programming, and am basically learning-by-doing. I'm folling Mike Ashes program "Sphere Net" from iPhone Cool Projects. I understand what's going on in the program, but I'm ready to start extending it and I expect to be sending a reasonable variety of packet types (each represented as a struct). It doesn't seem rign...