English 中文(简体)
通过 UIT 视图滚动时的错误 EXC_BAD_ 度量
原标题:Bad EXC_BAD_ACCESS when scrolling through UITableView

我启动了UITView,代码如下:

ProductTableView *tableProd = [[ProductTableView alloc]initWithNibName:@"ProductTableView" bundle:nil];

轴文件确实存在!

由于我在单独的UIView中显示这张桌子,

[content addSubview:tableProd.view];

我用xcode来创建标准的 UITableView 并设置以下函数:

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

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   return 10;
}

- (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 = @"test";    
   return cell;
}

The table is displayed in the simulator with 10 rows filled with test. However, when I start scrolling, and the first cell leaves the screen, the simulator crashes with a EXC_BAD_ACCESS error. I tried using Instruments to detect the NSZombie and the software flaged the zombie. Unfortunately I cant trace this error back to the cause. Instruments Screenshot of the Zombie

有人知道这里出了什么问题吗?

问题回答

如果您将查看控制器的视图重新添加为另一个视图控制器的子视图, 我将猜想产品表查看控制器正在被交易( 因为添加为子视图保留视图, 而不是它所属的视图控制器) 。

将产品表查看控制器添加为容器查看控制器的属性,以便保留该控制器





相关问题
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 ...

热门标签