English 中文(简体)
无图像的红新月体
原标题:UITableView redrawing without image and cell replaced

我引用以下法典,该法典应在顶部/顶部树立形象,然后在他人中形成文字。 我认为,问题是试图在囚室偏离屏幕时重新使用该囚室的代码,但可以确定我应该改变的内容。 你可以在此看到有关问题的录像:

http://crcast.com/t/OoQWMI5zCKVc”rel=“nofollow”http://crcast.com/t/OoQWMI5zCKVc

该法典如下:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{      
    static NSString *CellIdentifierText = @"TextCell";
    static NSString *CellIdentifierImage = @"ImageCell";

    if (indexPath.section == 0)
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierImage];

        if (cell == nil) 
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierImage] autorelease];
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,180)];                
            imageView.tag = 1;
            imageView.image = [UIImage imageNamed:@"prem.jpg"];
            [cell addSubview:imageView];
            [imageView release];
        }
        return cell;
    }
    else    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierText];
        if (cell == nil) 
        {

            cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifierImage] autorelease];
        }      
        if(indexPath.section == 1)          
            cell.textLabel.text = [arryTableData objectAtIndex:indexPath.row];       
        else if(indexPath.section ==2)
            cell.textLabel.text = [arryAddressInfo objectAtIndex:indexPath.row];
        else if(indexPath.section == 3)         
            cell.textLabel.text = [arryTableActions objectAtIndex:indexPath.row];      
        else if(indexPath.section == 4)
            cell.textLabel.text = @"REPLACE ME WITH ICONS";

        return cell;   
    }
}   
最佳回答

如果你创立了一个新案例,以显示案文的<编码>可调用的“Cell,则你使用错误识别符号:

cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:**CellIdentifierImage**] autorelease];

结果是,有人用文字(但无图像)在座的一个囚室中,通过<编码>可调取的<>可调取的填入“CellIdentifier>。 图像/密码识别。 因此,当你(在第0节)要求一个带有该识别标志的牢房时,你实际上重新找回一个只有文字的人。

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签