作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的项目中没有 xib 文件或 Storyboard。在这种情况下,我该如何设置小区标识符?下面是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"test");
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = [self.entries objectAtIndex:indexPath.row];
return cell;
}
最佳答案
尝试用这个替换你的代码(使用 ARC):
- (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.text = [self.entries objectAtIndex:indexPath.row];
return cell;
}
++
关于ios - 没有 cellidentifier ios 的 cellForRowIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18872392/
我正在尝试在我的每个 customCell 中创建一个标签。在 cellForRowIndexPath 中,我有: 编辑: static NSString *checkInTableIdendifie
我的项目中没有 xib 文件或 Storyboard。在这种情况下,我该如何设置小区标识符?下面是我的代码: - (UITableViewCell *)tableView:(UITableView *
我在用于搜索功能的 TableView 中随机出现“索引超出范围”错误。 它在 cell.article = self.searchResults?[indexPath.row] 处崩溃 99% 的时
我在这里看到了一些关于此的问题,但没有明确的答案我使用的是最新版本的 Xcode 和 swift... 我正在尝试在一个 View Controller 中使用两个 TableView ,这里是我的
我是一名优秀的程序员,十分优秀!