开发者

iPhone: error: request for member 'table' in something not a structure or union

When it comes to compiling my application, I get the error mentioned in the title. How would I go about remedying this error? Basically, I want to get from one table to the other. Hierarchy, navigation.

NextViewController.m

#import "RootViewController.h"
#import "NextViewController.h"


@implementation NextViewController

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
    // Release anything that's not essential, such as cached data
}


- (void)dealloc {
    [super dealloc];
}

- (IBAction) changeTable:(NSString *)str{
    tblCSS.table = str;
}

The last line contains the erro开发者_JAVA百科r.

If you need any more code, just ask. I'll amend this post with it.

Cheers, Jack

NextViewController.h

#import <UIKit/UIKit.h>


@interface NextViewController : UIViewController {
    IBOutlet UITableView *tblCSS;
}

- (IBAction) changeTable:(NSString *)str;
@end


Presumably your tblCSS variable is an object, and it doesn't have a property called table. You should either create it as a property, or create accessor variables for it.

Edit:

It's not clear what your code is trying to do. tblCSS is a UITableView, which doesn't have a property called table; and if it did, it is unlikely that it would be a NSString (but who knows?).

Also, IBActions typically take sender as an argument, which will usually be a UIControl, not a NSString.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜