【发布时间】:2011-07-19 03:14:33
【问题描述】:
我的 RootViewController.m 文件中出现编译错误。代码如下:
#import "RootViewController.h"
@implementation RootViewController
pragma mark -
pragma mark 查看生命周期
/* - (void)viewDidLoad { [超级viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
} */
/* - (void)viewWillAppear:(BOOL)animated { [超级viewWillAppear:动画]; } / / - (void)viewDidAppear:(BOOL)animated { [超级 viewDidAppear:动画]; } / / - (void)viewWillDisappear:(BOOL)animated { [超级viewWillDisappear:动画]; } / / - (void)viewDidDisappear:(BOOL)animated { [超级 viewDidDisappear:动画]; } */
/* // 覆盖以允许默认纵向以外的方向。 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // 对于支持的方向返回 YES。 return (interfaceOrientation == UIInterfaceOrientationPortrait); } */
pragma mark -
pragma mark 表格视图数据源
// 自定义表格视图中的节数。 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 返回 1; }
// 自定义表格视图中的行数。 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 返回 1; }
// 自定义表格视图单元格的外观。 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
[cell.textLabelSetText@"Hello World!"];
return cell;
}
/* // 覆盖以支持表格视图的条件编辑。 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // 如果您不希望指定的项目可编辑,则返回 NO。 返回是; } */
/* // 重写以支持编辑表格视图。 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source.
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
} */
/* // 重写以支持重新排列表格视图。 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */
/* // 重写以支持表格视图的条件重新排列。 - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // 如果您不希望商品可重新订购,则返回 NO。 返回是; } */
pragma mark -
pragma mark 表视图委托
-
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
/* *detailViewController = [[ alloc] initWithNibName:@"" bundle:nil]; // ... // 将选中的对象传递给新的视图控制器。 [self.navigationController pushViewController:detailViewController 动画:YES]; [detailViewController 发布]; */ }
pragma mark -
pragma mark 内存管理
-
(void)didReceiveMemoryWarning { // 如果没有超级视图,则释放视图。 [super didReceiveMemoryWarning];
// 放弃任何未使用的缓存数据、图像等的所有权。 }
(void)viewDidUnload { // 放弃可以在 viewDidLoad 中或按需重新创建的任何内容的所有权。 // 例如:self.myOutlet = nil; }
(void)dealloc { [超级释放]; }
@结束
问题部分是:
[cell.textLabelSetText@"Hello World!"];
我收到一条错误消息:请求成员 textLabelSetText 不是结构或联合
和
在 OBJC_STRING 令牌之前需要 ':'
你能告诉我有什么问题吗? TIA
【问题讨论】:
标签: xcode