Dou*_*ith 6 iphone objective-c uitableview uiviewcontroller ios
我有一个UIViewController,在某些时候增长了一个UITableView,当它发生时,我只是初始化TableView实例变量并将其添加到视图中,但我不知道如何处理要添加到视图中的单元格的出列; 我需要一个重用标识符,但我不确定如何设置它.
我该怎么办?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"wot";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
使用该方法 initWithStyle:reuseIdentifier
cell
存在码
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath (NSIndexPath*)indexPath
{
static NSString *cellIdentifier = @"wot";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle: someStyle reuseIdentifier: cellIdentifier];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11860 次 |
最近记录: |