Objective-C doesn't have namespaces, and many (such as CocoaDevCentral's Cocoa Style Guide) recommend prefixing your class names with initials to avoid namespace collision.
Quoting from the above link:
Objective-C doesn't have namespaces,
so prefix your class names with
initials. This avoids "namespace
collision," which is a...
Update: I edited the code, but the problem persists...
Hi everyone,
this is my first post here - I found this place a great ressource for solving many of my questions. Normally I try my best to fix anything on my own but this time I really have no idea what goes wrong, so I hope someone can help me out.
I am building an iPhone app tha...
While writing the touchesBegan handler for my view I ran into this interesting error.
Code:
...
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
...
The problem is point.x is always zero, no matter where I "touch" and y is a huge number that flunctuates somewhere between 1070000000 and 1090000000.
T...
I have two classes, a class that handles db connectivity and an entity class. The db class has an instance method called GetEntityByID:(int)entity_id. This method does a simple select statement, and creates an Entity class instance using an init method.
This works fine, however whoever calls GetEntityByID must remember to release it...
Note: Although my particular context is Objective-C, my question actually transcends programming language choice. Also, I tagged it as "subjective" since someone is bound to complain otherwise, but I personally think it's almost entirely objective. Also, I'm aware of this related SO question, but since this was a bigger issue, I thoug...
I am using Core Data programmatically (i.e. not using .xcdatamodel data model files) in much the same manner as depicted in Apple's Core Data Utility Tutorial. So my problem is that when I try to add an attribute to an entity with the type NSBooleanAttributeType, it gets a bit buggy. When I add it to my NSManagedObject subclass header fi...
As a newcomer to Cocoa, I am struggling to understand why the generic NSResponder subclasses implement key events the way they seem to do.
In my program, I have an NSWindow subclass which takes up the whole screen, and must necessarily handle key events. There are several major commands which can change the whole state of the program (...
Hello,
I'm pretty new to Obj-C and Cocoa stuff, so forgive any stupidity.
I'm using an NSOutlineView with an NSTreeController that provides an array of my own objects to it. My delegator is using the outline view's willDisplayCell to set the icon of the cell (I'm using NSBrowserCell). I cannot figure out for the life of me how to get m...
I am working with NSScanner to parse data that is both comma and line delimited. It was fairly straightforward to implement, but I am running into a very simple issue. I would like to scan in the next line, even if it is empty. The problem I am having now is that if there is an empty line, it will skip it and read the next line in. Then ...
I'm recording audio with AVAudioRecorder as seen in http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder/1011273#1011273
I then use AVAudioPlayer to play back the recording. However the sound is coming out of the ear speaker, not the loud speaker. How would I go about redirecting the sound to...
in my project i'm using a propertyList for maintaining data. the plist file is named "DataBase.plist". the Root for DataBase.plist is a dictionary which contains 5 dictionaries as child items... now the sub Dictionary contains 4 strings out of which one is always a webaddress with key "URL" (Without the quotes)....
i'm running the foll...
I'm sorry for opening a new question, I had to - as I wrote the other question from my iPhone as unregistered user and it is not very comfortable to write from the iPhone.
Rephrasing the question:
Is it possible to use the:
[NSMutableArray writeToURL:(NSString *)path atomically:(BOOL)AuxSomething];
In order to send a file (NSMuta...
i want to show a grapph/bar chart in iphone how do i do this without custom API;s
...
I have some code which needs to access a NSArray to work. I have a NSArray which I am using with core data and will have data in it. But i am unsure how to make it access the NSArray.
I can't just simply declare it in the Header file like this: NSArray *objectArray; because it does not know how or which NSArray to Access. How exactly wou...
In the following code, I try to read data from a plist:
-(void)readPreferences
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray * myAppDefaults = [defaults mutableArrayValueForKey:@"LastList"];
myCustomObject * savedObject;
NSUInteger i;
for (i = 0; i < [my...
Hey guys. I have a method that gets called each second which I want to use to display the time that my app has been doing it's work. Currently the class I'm using (Which I did not create) has a property named progress which stores the total number of seconds.
I have already written some code which takes these seconds and formats it into...
How can I get the current battery level using the cocoa framework running with Leopard?
Currently I am getting it running a NSTask with:
pmset -g ps | grep -o -e [0-9]*% | sed -e 's/%//g'
But i think this is a clumsy way of doing this.
Thanks
...
In iPhone OS 3.0, UIApplication allows you to set a applicationSupportsShakeToEdit flag. The documentation says "The default value is YES. Set the property to NO if you don’t want your application to display the Undo and Redo buttons when users shake the device."
This is all great and it ties in to the new NSUndoManager class nicely. Ho...
I'm using json-framework to create a NSDictionary out of a JSON response. That much works wonderfully.
Now, within this JSON payload are one or more objects - let's call them X. Sort of like this in XML:
<OBJECTS>
<X>
...
</x>
<X>
...
</X>
<X>
...
</X>
</OBJECTS>
When I look in the aforementioned NSDictionary ...
I'm using NSOperation and NSOperationQueue to handle all of my networking threads so my interface can remain responsive while handling data transfer over the internet. Currently, I've got my operation queue set to a maximum concurrent operation count of 5, and it seems to work well.
I'm wondering, though, if there is a more ideal numbe...