Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios4 TableView图像加载问题。(tableCell的完整代码)_Ios4 - Fatal编程技术网

Ios4 TableView图像加载问题。(tableCell的完整代码)

Ios4 TableView图像加载问题。(tableCell的完整代码),ios4,Ios4,(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{ dictionary=[QuestionMutableArray对象索引:0] 静态NSString*CellIdentifier=@“BeginingCell” BeginingCell*单元格=(BeginingCell*)[tableView dequeueReusableCellWithIde

(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{

dictionary=[QuestionMutableArray对象索引:0]

静态NSString*CellIdentifier=@“BeginingCell”

BeginingCell*单元格=(BeginingCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]

如果(单元格==nil){

}

//配置单元格

if(indexPath.row==0) {

}

返回单元


}我想你必须先创建一个单元格。您可以使用如下默认单元格:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

//---try to get a reusable cell---

UITableViewCell *cell = [tableView
    dequeueReusableCellWithIdentifier:CellIdentifier];

//---create new cell if no reusable cell is available---
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
             reuseIdentifier:CellIdentifier] autorelease];
}

//---You would set the image here---
UIImage *imgDef=[UIImage imageNamed:@"man_kirstie_alley.jpg"];
cell.image = imgDef;

return cell;

这是“CellForRowatineXpath”的完整代码吗?请在“CellForRowatineXpath”方法中发布完整的代码。您需要提供更多详细信息,是否有任何错误消息?哪一行代码抛出了错误?是的,我也在这样做。我没有发布整个代码。但不起作用。它在这里崩溃:[cell.myImageView setImage:imgDef]@sohel14 cse ju:那么请在控制台上发布您的错误消息。要在XCode中显示控制台,请从菜单中选择“Run>console”,这里有一个异常:**由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[BeginingCell myImageView]:未识别的选择器已发送到实例0x4d2b0c0',全部..正在使用此代码…感谢大家的响应..[[cell imageView]setImage:[UIImage ImageName:@“man_kirstie_alley.jpg”];@sohel:我猜您是对UITableViewCell进行了子类化,对吗?您是在标题中声明了myImageView还是忘记了合成myImage属性?
cell.SectionTitle.text=[dictionary objectForKey:@"question"];
cell.Option1.text=[dictionary objectForKey:@"option1"];
cell.Option2.text=[dictionary objectForKey:@"option2"];
cell.Option3.text=[dictionary objectForKey:@"option3"];
cell.Option4.text=[dictionary objectForKey:@"option4"];


UIImage *imgDef=[UIImage imageNamed:@"man_kirstie_alley.jpg"];
[cell.myImageView setImage:imgDef];




[MyTestArray release];

[cell.button1 setTitle:@"A." forState:UIControlStateNormal];
[cell.button2 setTitle:@"B." forState:UIControlStateNormal];
[cell.button3 setTitle:@"C." forState:UIControlStateNormal];
[cell.button4 setTitle:@"D." forState:UIControlStateNormal];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

//---try to get a reusable cell---

UITableViewCell *cell = [tableView
    dequeueReusableCellWithIdentifier:CellIdentifier];

//---create new cell if no reusable cell is available---
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
             reuseIdentifier:CellIdentifier] autorelease];
}

//---You would set the image here---
UIImage *imgDef=[UIImage imageNamed:@"man_kirstie_alley.jpg"];
cell.image = imgDef;

return cell;