0

UITableView を使用した単純なアプリケーションがありますが、アイテムは表示されません。何を忘れますか... ( cellForRowAtIndexPath が呼び出されることは知っています)

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

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

    return 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];
    }
    [[cell textLabel] setText:@"terlala"];
    return cell;
}

テーブルビューコントローラーは次を使用して呼び出されます

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
     // Override point for customization after application launch.
     self.window.backgroundColor = [UIColor whiteColor];
     SillyTableViewController * CamerasViewController = [[SillyTableViewController alloc] init];
    [[self window] addSubview:[CamerasViewController view]];
    [self.window makeKeyAndVisible];
    return YES;
 }
4

1 に答える 1

1

識別子「Cell」がセル属性インスペクターにあるかどうかを確認します

于 2012-09-05T10:16:03.887 に答える