Why am I getting an error?

Why am I getting these errors? alt text http://img39.imageshack.us/img39/2203/help.tif

It says:

Error: Request for member "jokeTableView" for something that is not a construct or union

What does it mean? And why does it break. I tried reading initWithStyle but I just could catch up with it

Here is my .h file:

#import <UIKit/UIKit.h>


 @interface TableViewController : UITableViewController {

NSMutableArray *jokes;
IBOutlet UITableView *jokeTableView; 


 } 

 @property (nonatomic, retain) NSMutableArray *jokes;

 @end

      

Thanks!

0


a source to share


2 answers


Your object (TableViewController) doesn't have a property named jokeTableView.

To access the jokeTableView with the dot special operator, it must be a property. Otherwise, you need to access it using key-encoding compatible methods, or directly using the -> operator (or just use it like an ivar and no reference to self):

jokeTableView.delegate = self;

      

or

self->jokeTableView.delegate = self;

      



or

[self jokeTableView].delegate = self;

      

or

@property (retain) UITableView *jokeTableView;
// later...
self.jokeTableView.delegate = self;

      

Also note that you are setting the socket in the initializer and this will not work. You must set this in the method - [TableViewController awakeFromNib], as self-> jokeTableView will be zero when the initializer is actually called (which happens in IB before serializing the object to the nib file).

+7


a source


Since you do this at init time, the exit points must be NULL, so this initialization shouldn't do anything. This should be done at awakeFromNib as early as possible.



0


a source







All Articles