2010-04-21 93 views
0

我是新的Objective-C编程。我来自C#背景。我遇到以下代码的问题,我正在撰写iPhone App的概念证明:UIViewerTableViewController.m:15:错误:'*'令牌之前的预期标识符

我收到了一些编译错误,但我认为它们都是由于第一个错误(可能是错误的) - 错误:'*'标记之前的预期标识符(@synthesize *列表;在.m文件中)

我不确定为什么我的代码显示它在编辑器下方的视图中显示的方式..任何方式,任何帮助将不胜感激。

.m文件

// 
// Created by Aaron Levin on 4/19/10. 
// Copyright 2010 RonStan. All rights reserved. 
// 

#import "UIViewerTableViewController.h" 

@implementation UIViewerTableViewController 

@synthesize *lists; 
@synthesize *icon; 

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

#pragma mark Table View Methods 

//Customize number of rows in table view 

- (NSInteger)tableView:(UITableView *) tableView numberOfRowsInSection: (NSInteger) section{ 

return self.Lists.Count; 
} 

//Customize the appearence of table view cells 

- (UITableViewCell *) tableView(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath{ 

static NSString *CellIdentifier = @"Cell"; 

UITableView *Cell = [tablevView dequeueReusableCellWithIdentifier:CellIdentifier]; 

if(cell == nil){ 

    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
} 

cell.textLabel.text = [[self.Lists objectAtIndex:indexPath.row] retain]; 

cell.imageView = self.Icon; 

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

} 

@end 

.h文件中

// 
// UIMyCardsTableViewController.h 
// MCS ProtoType v0.1 
// 
// Created by Aaron Levin on 4/19/10. 
// Copyright 2010 RonStan. All rights reserved. 
// 

#import <UIKit/UIKit.h> 

@interface UIViewerTableViewController : UITableViewController { 

NSArray *lists; 
UIImage *icon; 

} 

@property (nonatomic,retain) NSArray *lists; 
@property (nonatomic,retain) UIImage *icon; 

@end 

回答

4

@synthesize *lists;应该@synthesize lists;

这里假定您提供访问被称为lists这似乎是私有成员以上代码为真。

PS - 您可以使用编辑器工具栏中的'1010'按钮或通过反引号来封装代码。

0

同样适用于@synthesize *icon; 您需要将其更改为@synthesize icon;

相关问题