objective-c

Objective C makes integer from pointer without a cast passing objects as args

For more info on fix this error, see here I'm trying to make blackjack in objective C, and am having trouble passing objects around. My Hand class basically takes a deck and draws cards from it, adding them to an array. Here's the Hand methods involved: - (id)init : (Deck*) deck { [self draw: deck]; [self draw: deck]; retu...

What describes best the term "Memory Footprint"?

In the terms of Apple's Documentation: What does "Memory Footprint" mean? How much Memory my App consumes? Does someone have a good explanation for that term? ...

Is there a difference between an "function" and an "macro" in Objective-C?

I am wondering if both are the same thing? ...

iPhone + JSON + Reflection

Hi, I'm writing an iphone application with JSON and am trying to turn JSON strings into objects (NOT Dictionaries or Arrays). In Java, thanks to Reflection, I can easily turn JSON into javabean instances like this: import net.sf.json.JSONObject; class MyBean { private String property; public String getProperty() { return prope...

Animating custom-drawn UITableViewCell when entering edit mode

Background First of all, much gratitude to atebits for their very informative blog post Fast Scrolling in Tweetie with UITableView. The post explains in detail how the developers were able to squeeze as much scrolling performance as possible out of the UITableViews in Tweetie. Goals Beginning with the source code linked from the blog...

Which initializer(s) to override for UITableViewController subclass

I have a UITableViewController subclass that's instantiated, depending on where it's used, in a NIB or via code. In both cases I want to do customization in the initializer method. Does that mean I need to implement both initWithNibName:bundle: and initWithCoder:, and would each method call its respective super initializer? While I do...

Inserting records with SQL Lite

What is the SQL Lite statement for "insert"? I have tried insert into table1 values(field1,field2) values (?,?) but this returns an error in the statement -- how do I do this? ...

Cocoa screen capturing?

How do you capture an NSImage of the screen in Cocoa? I need to know the fastest way, because I'm trying to make a screencasting app. ...

How do I get the current hour using Cocoa?

How do I get the current hour in Cocoa using Objective-C? ...

Is there an official documentation for the use of the App Store API?

I may want to write an tool that makes some App Store statistical analysis, if that's legal. I am wondering if there is any offical documentation for how to access the App Store API with third party Software. Does anyone know? ...

Synthesizing properties in categories

I'm trying to declare properties that are for internal use only in a Private category as such: @interface BarLayer (Private) @property (readwrite, retain) MenuItemFont *menuButton; @property (readwrite, retain) Menu *menuMenu; @property (readwrite, retain) LabelAtlas *messageLabel; @end Now I'm trying to figure out wher...

UITableViewCell not getting updated.

For every entry in the table view cell, I need a button at right then some text and again a button at the left. At the button click event I need to change the text (left/right button clicked.) and remove either of the buttons depending on the text conditions. I am not able to remove the buttons using cellForRowAtIndexPath method. I tried...

iPhone Disabling UIActionSheet buttons

I want to disable buttons in the UIAction sheet and enable them after a certain condition is true. How do I achieve this? Any ideas? ...

Is there a reason why I sometimes read in Books "layoutSubviews Method" and sometimes "drawRect: Method"?

I am wondering why in Books and Apple Documentation sometimes a Method has that colon as suffix, but sometimes not. I guess it means that if it has no colon, it has no parameter. On the other side, if it has a colon, it has exactly one parameter. Right or wrong? ...

ObjC - Post a UIImage by using NSData and NSURLRequest?

Hey all, I'm trying to post an image to TwitPic.com using their API. However, I have never posted an image using HTTPPOST or however else before. Anybody enlighten me to how I can post NSData from a UIImage using their api? ...

Recommended coding style for setting property values in Objective-C

Let's say I have this interface: // .h @interface DataObject : NSObject { NSString* value; } @property (retain) NSString* value; @end // .m @implementation DataObject @synthetize value @end As far as I understand, the following two snippets are identical: DataObject *o = [[[DataObject alloc] init] autorelease]; [o setValue:...

NSString contains a number, why does it crash my App?

I'm having some difficulty with NSString in my application. Basically, I have an NSString called o1string which contains the value "602". I want to output this in a UIAlertView alongside some other text. votedmessage = [ NSString stringWithFormat:@"The current standings are as follows:\n\n%@: %@ votes", b1title, o1string ]; UIAlertView ...

Overriding a setter method, and getting info out

I have a setter method (setMinimumNumberOfSides) that I want to override after using synthesize. In it, I'm putting in a constraint on the instance variable to make sure the int is within certain bounds. Later in a custom init method, I'm setting another instance variable (numberOfSides), but I need to make sure minimumNumberOfSides an...

error with import <cocoa/cocoa.h>

I added class files from another project to my new iPhone Window for the first time. The class is a simple class that defines a polygon, and subclasses NSObject. As part of the standard template for an Objective C class, this class definition imports Cocoa.h #import <Cocoa/Cocoa.h> However, just by adding this class, I'm getting a...

How to properly call SQLite functions from background thread on iPhone?

I'm using an SQLite database in my iPhone app. At startup, there are some database actions that I want to perform in a separate thread. (I'm doing this mainly to minimize startup time.) Occasionally/randomly, when these database calls are made from the background thread, the app will crash with these errors: 2009-04-13 17:36:09.932 Act...