I'm maintaining an utility cocoa-objc framework which keeps growing.
Coming from Java, I'm used to write javadoc comments for all the API I write.
What are the guidelines for writing good API comments in cocoa-objc ?
Is there a tool to automatically generate an API documentation like Javadoc (what
is the tool used by apple for generatin...
Is it possible to assign a value to an instance variable during an initialize class method?
I'm declaring a number of arrays, then creating an array of arrays, then assigning it to self.months, which is an instance variable. Why does this not work, and how can I accomplish this?
+(void)initialize
{
// .....
NSArra...
Hi, I can't find a cause for a memory leak in my application. I found out that there is a memory leak through instruments and than more times I call the function than more memory leaks occurs. So it is obvious that a memory leak takes place.
Here is my code.
Object:
@interface WordObject : NSObject
{
int word_id;
NSString *word...
Is there any reason why you shouldn't use the "-std=c99" flag for compiling Objective-C programs on Mac? The one feature in C99 that I really like is the ability to declare variables anywhere in code, rather than just at the top of methods, but does this flag causes any problems or create incompatibilities for iPhone or Cocoa apps?
...
If i want to extend a class like AVAudioPlayer, whats the best way to also add another method to AVAudioPlayerDelegate ?. Do I make a category for it, do I extend it? If I extend it do I then also have to make sure to overwrite the actual delegate getter/setter ? How would I extend the protocol ? The following gives me errors
@prot...
I wonder how run sqlite querys in the background as suggested in http://stackoverflow.com/questions/155964/what-are-best-practices-that-you-use-when-writing-objective-c-and-cocoa
This is my try:
- (void) run:(NSString *)sql {
NSArray *data = [NSArray arrayWithObjects:
sql,
[self returnItemClass],
nil];
NSInvocationOpera...
I have a problem. I try to display a UITable that could have 2000-20000 records (typicall numbers.)
I have a SQLite database similar to the Apple contacts application.
I do all the tricks I know to get a smoth scroll, but I have a problem.
I load the data in 50 recods blocks. Then, when the user scroll, request next 50 until finish th...
I'm using NSURLConnection as listed below. I have three questions about this class. When I concatenate the url value, the debugger hits this line twice but not the line above it:
if (theConnection){
The second time I get EXC_BAD_ACCESS. Using the first url assignment (commented out) works fine.
1.) What's the difference?
- (void...
I doing a project where i need to use highlighted table view color not default.
...
Does someone have a good explanation of what an "opaque type" is? I saw that term in context of the CFBundleRef, where they were saying: "CFBundleRef opaque type". Is that a type that's readonly?
...
I've got a custom UITableViewCell implementation (leveraging labels as subviews) that is rendering the list of items correctly, but when I scroll down and select an item (say number 43 of 100), I see a rendering of a cell from earlier in the list (from say, number 3 on the first render page in the table) appear on top of the cell I selec...
Hello,
I'm wondering if it's possible to have something similar to ActionScript 3's Dictionary object with weak keys in Objective-C. I want to be able to 'attach' an instance of a class to other arbitrary instances.
Example;
MetaData *meta = [MetaData metaDataForObject:someObject];
meta.whatever = foo;
And later:
foo = [MetaData me...
What's the best way to center a label in a UIView? If you do something such as
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(view.frame.origin.x / 2, view.frame.origin.y / 2, 50.0, 50.0)];
Then you're setting the origin point of the label to the center of the view. The best bet would be to set the center of the view to ...
I'm trying out a multiple view application, but I can't seem to get the first view controller to go away when I bring in the new view controller. I'm laying the second (coming) view controller at index 0, and it's just placing it in the background. I thought the [going.view removeFromSuperview] would remove the original viewcontroller...
Apple lists (http://developer.apple.com/samplecode/AudioQueueTest/listing1.html) as a quick demonstration of playing an audio file.
Is there a way to play an audio file with many less lines of code?
...
I am trying to come to grips with how difficult it is to use NSPopUpButton. It's by far and away the most difficult user element to program in Cocoa (at least as far as I am finding it).
The use case I have in mind is as follows:
I have a class called Port that represents a Serial port.
Amongst the attributes is a name field.
In the ...
I'm trying to use the SQLite C API in my iPhone app. I'm trying to query an SQLite database for the number of records that have been completed after a certain date. The database saves the completed date as text in YYYY-MM-dd format. For example the text 2009-04-10 might appear as a completed date.
When I query the database from the comm...
I have a bunch of sound clips, named sound1.mp3 through soundN.mp3. I want to randomly play them on touch, so I've set up an AVAudioPlayer for each clip which are all stored in players (AVAudioPlayer**). After I initialize everything, the only sound I can get to play is sound1.mp3. What am I doing wrong?
Thanks for the help, init cod...
If I have a method that returns a BOOL, how do I cast that to a NSString so I can print it out with an NSLog?
For example,I tried doing this, which isn't working:
NSLog(@"Is Kind of NSString:", ([thing isKindOfClass:[NSString class]]) ? @"YES" : @"NO");
But I really want to actually turn the return value into a NSString... I know ...
Wondering which tool is considered the best/standard and what the pros/cons are for the various unit testing tools that are available. The tools I'm aware of so far are:
Google Toolbox for Mac
OCUnit which seems to be the winner for objective-c, but some folks have had trouble with on the iphone
rbiphonetest which Dr Nic comments on he...