objective-c

Upside-down interface for iPhone

I want to have a completely upside down interface. I don't mean it should change according to the orientation of the phone. I mean it should be upside down ( UIInterfaceOrientationPortraitUpsideDown ) the whole time. A button should be able to 'right' it again. The same button should return everything to upside down. What's the best way...

setting objects to nil when releasing NSArray

When I get a memory warning I am releasing a bunch of objects stored in an NSMutableArray. [_children release]; I also need to recurse through objects at some point (potentially after a mem warning has happened), so I need to check if the objects are still around, which I do with comparison to nil- which isn't going to work because re...

NSInternalInconsistencyException when last row is removed from the section

I have an iPhone 3.0 application that work with requests using Core Data. It has a view with all requests grouped by request status (sectionNameKeyPath:@"status" ). Also it has another view where the user can change the request status. I have a problem when there is one row/request with in specific group and the user edits the status of...

Hiding/Displaying NSToolbarItem's

I have an application with many NSToolbarItems. Only 5 or so are needed at any one time so it seems like the best way to fit them on the screen and make them easy to get to is to hide/display only the NSToolbarItems depending on the context. I can't find either through google or in the Apple doc's how to do this. Is there a way? (Short ...

"Invalid" iphone string

I'm converting data (from a web page) to a string). The basic code works (but there's been some subtle change somewhere - maybe on server). NSLog shows the expected string (maybe 1000 chars long). However, when I float over responseString, it shows "Invalid". Worse, parsing with componentsSeparatedByCharactersInSet does not work. I...

Slice up image into icons at build time or runtime in xCode

I need about 100 icons inside my application. Would it be logical to have one large image file with all the icons and then somehow split it up into individual NSImage objects? Is there a way to run some code at build time to regenerate the individual icons? ...

NSTableView selection & highlights

Hi, I have a NSTableView as a very central part of my Application and want it to integrate more with the rest of it. It has only one column (it's a list) and I draw all Cells (normal NSTextFieldCells) myself. The first problem is the highlighting. I draw the highlight myself and want to get rid of the blue background. I now fill the who...

Validate before opening a document in NSDocument architecture

I have an document based application which formats an XML file. Writing and reading of document is done in my NSDocument subclass - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError but if the fil...

Rotate UIImageView and still get x/y click position

Hi, I have subclassed UIImageView to create a soccer ball. The ball bounces and moves along an x & y axis, and depending on where you touch the ball, the ball will move as you'd expect a soccer ball would. My problem is that I would like to rotate the Ball(UIImageView), but still know the x & y positions from it's original position. ...

Rotating an NSImage with or without NSAffineTransform

I've got an NSImage being drawn on a subclass of NSView. In a previous question, I was helped to draw it upright in the upper left corner. Now, I want to be able to rotate the image. I have a button that increments a rotation variable %4, and then I multiply this by -90 to find the rotation angle. I then use an NSAffineTransform to rotat...

iPhone: Is there a pre-made UISettingsView?

On startup, if the user hasn't done any setting of NSUserDefaults, I want my main view to do a flipside view that brings up the same stuff that shows up in the Settings app. Is there an API for instantiating the same controller that Settings uses, or will I have to reimplement a table view and controller myself? ...

How to Write OS X Finder plugin

I'm looking for a guide or sample code for writing Mac OS X Finder plugins? It would like to know how to do some simple actions: adding image overlayers to icons adding context menu items listen to file changes I found the following two resources: Writing Contextual Menu Plugins for OS X: An outdated document from 2002 that uses t...

How to catch sigpipe in iphone app?

Hi, How can i catch sigpipe in iphone/objective-c? thanks ...

Is there an objective-C library to talk with a CAS server

Is there a library already created to talk with an CAS server via objective-c? I know there are many supported clients but have yet to find anything I can use on the iPhone. ...

Wifi vs. Edge/3G and componentsSeparatedByString (NSString)

Hi, does anybody has a clue why downloaded html code via Wifi is different from the same url's content using Edge/3G? I noticed it when using the function because the output from Wifi has much more lines than the output from 3G. Analyzing the code I could see that only a few line breaks were detected. Here is the code: NSString *htmlC...

iPhone SDK Quick Reference

Is there a quick-reference guide to the iPhone SDK that's as fast and easy to use as one of those little O'Reilly books, or JavaDoc? I'm new to iPhone SDK programming. I need reference material. Let's say I want to know if the string class has a "reverse" function. For Java I go to http://java.sun.com/javase/6/docs/api/ and browse do...

Adding Objects to an Objective C Array at Index

I have a synthesized NSMutableArray - theResultArray . I want to insert NSNumber or NSInteger objects at specific indexes (0-49). For some reason I can never get any values to stick in my array. Every index returns nil or 0. NSInteger timeNum = time; [theResultArray insertObject:[NSNumber numberWithInt:timeNum] atIndex:rightIn...

Setting a property on a custom object through Interface Builder

I have a custom UITableViewController subclass which I use in two places in a nib file. What should I do if I want the two instances to have slightly different behavior? Of course in the code I can select one kind of behavior or the other based on the value of a BOOL, but how do I set that BOOL from Interface Builder, without having to w...

Play Music? - Objective C

Hey guys, How would you play any type of music in objective-c (not iphone sdk), and how would you stop the music? Thanks, Kevin ...

Setting an Objective-C class property without using a self reference

This morning I ran into a crash in an iPhone app I am working on and while I fixed the bug, I'm curious about syntactic reason it was a problem. Here is my code reduced to simple elements. I am populating items in a TableView using an NSArray for the items. The NSArray is a property: @interface FooViewController : UITableViewControll...