- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含多个部分的 UITableView。我有一个 NSMutableArray 作为数据源 (floorArray)。当我重新加载 tableview 数据时,我得到 [FloorGroup count]: unrecognized selector sent to instance 0x5c18fc0
。我的 ViewController 实现了 UITableViewDelegate 和 UITableViewDataSource。我在 FloorGroup 对象上调用计数时看不到任何地方。
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [floorArray count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
FloorGroup *group = [floorArray objectAtIndex:section];
return group.floorName;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
FloorGroup *group = [floorArray objectAtIndex:section];
NSMutableArray *areasOnFloor = group.areas;
NSUInteger count = [areasOnFloor count];
return count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FloorGroup *group = [floorArray objectAtIndex:[indexPath section]];
static NSString *identity = @"MainCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identity];
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 0.0) reuseIdentifier:identity] autorelease];
}
cell.text = [group.areas objectAtIndex:indexPath.row];
return cell;
}
我的类定义是:
@interface FloorGroup : NSObject {
NSString *floorName;
NSMutableArray *areas;
}
@interface FloorArea : NSObject {
NSString *floor;
NSString *description;
NSDecimalNumber *area;
NSDecimalNumber *price;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
准确的错误是:
2011-08-05 10:54:58.692 com.Lime49.myApp[1987:207] -[FloorGroup count]: unrecognized selector sent to instance 0x5d93c90
2011-08-05 10:54:58.694 com.Lime49.myApp[1987:207] NSInvalidArgumentException
2011-08-05 10:55:02.321 com.Lime49.myApp[1987:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FloorGroup count]: unrecognized selector sent to instance 0x5d93c90'
*** Call stack at first throw:
(
0 CoreFoundation 0x0139f5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x014f3313 objc_exception_throw + 44
2 CoreFoundation 0x013a10bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01310966 ___forwarding___ + 966
4 CoreFoundation 0x01310522 _CF_forwarding_prep_0 + 50
5 UIKit 0x006492b7 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1834
6 UIKit 0x00646d88 -[UITableViewRowData numberOfRows] + 108
7 UIKit 0x004fa677 -[UITableView noteNumberOfRowsChanged] + 132
8 UIKit 0x00507708 -[UITableView reloadData] + 773
9 Foundation 0x0020b94e __NSThreadPerformPerform + 251
10 CoreFoundation 0x013808ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11 CoreFoundation 0x012de88b __CFRunLoopDoSources0 + 571
12 CoreFoundation 0x012ddd86 __CFRunLoopRun + 470
13 CoreFoundation 0x012dd840 CFRunLoopRunSpecific + 208
14 CoreFoundation 0x012dd761 CFRunLoopRunInMode + 97
15 GraphicsServices 0x01b3c1c4 GSEventRunModal + 217
16 GraphicsServices 0x01b3c289 GSEventRun + 115
17 UIKit 0x0049ac93 UIApplicationMain + 1160
18 com.Lime49.myApp 0x00002256 main + 84
19 com.Lime49.myApp 0x000021f9 start + 53
)
terminate called after throwing an instance of 'NSException'
最佳答案
您的错误看起来像您的对象具有类 FloorGroup 而不是 floorArray 的指针。
要么您的数组已被释放并且其内存被 FloorGroup 对象占用。调试您的 floorArray 是否有对象。
关于iphone - UITableViewDelegate 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6954226/
我使用 IB 在 Storyboard 中创建了一个 UITableViewController。我将 UITableview 的 delegate 设置为它的 Controller 。 UITabl
我是 iOS 新手,所以如果这是一个基本问题,请耐心等待。我正在关注 these tutorials在第 43 讲中,这个人删除了现有的 View Controller 并添加了一个新的 View C
我的应用程序中有一个 UITableView,我试图将其委托(delegate)方法拉入单独的 UITableViewDelegate 中。这是代码的样子: RestaurantViewDelegat
我有一个包含多个部分的 UITableView。我有一个 NSMutableArray 作为数据源 (floorArray)。当我重新加载 tableview 数据时,我得到 [FloorGroup
我正在尝试从 UITableView 列表调用详细信息屏幕 - 但在接收 View 中未调用委托(delegate) - 我将发布所有代码: 列出头文件: #import #import "tank
我有一个类定义如下: @interface ClassViewController : ContentViewController { IBOutlet UITableView* mTabl
我想将 UITableViewDataSource、UITableViewDelegate 分离到另一个类中,以减少和更改 UITableView 中的委托(delegate) 这是我的代码Group
UITableViewDelegate(甚至可能是 UITableViewDataSource)上似乎应该有一个 API 来让代理知道 UITableView 何时更改编辑状态。但我找不到类似的东西。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及
我有一个带有 TableView 的 TableView Controller ,我在 Storyboard 中设置了一个 TableView Controller ,并从 mapViewContro
我想问一个关于 TableView 和@synchronized 结构的问题。我必须在 didSelectRowAtIndexPath 中执行一次代码,即使用户继续点击表格单元格... 我有一张 ta
所以我正在使用 this library这允许我在向下滚动时压缩的表格 View 顶部制作一个栏。现在我使用桥接头将它安装在我的 Swift 项目中。所以我按照实现指南,将所有代码转换为 Swift
我没有将 View Controller 指定为 UITableViewDelegate,而是尝试通过为 UITableViewDelegate 创建扩展来减少 View Controller 中的代
我正在编写 UITableView 的子类,我希望我的子类在将它们传递给“真正的”委托(delegate)之前处理一些 UITableViewDelegate 方法本身,并转发我的子类未实现的所有 U
我正在做一些研究以获得 tableview 委托(delegate)方法的准确执行顺序。 情况 1:行数 - 对于小值 所以首先我创建了 100 行并发现执行流程如下。 numberOfSection
问题是这样的: 我需要能够在具有大量 tableView 的大型现有应用程序中获取有关 didSelectRowAtIndexPath 的分析。 我的第一个想法是在 didSelectRowAtInd
有人告诉我 UITableViewDelegate 和 UITableViewDatasource 之间的区别吗? 最佳答案 UITableViewDelegate 作为表格的委托(delegate)
在我所有的 UITableView 编程中,我总是在 -[UITableViewDataSource tableView:cellForRowAtIndexPath:] 中配置我的 UITableVi
我将在 tableView 上设置 UITableViewDelegate,但如果这样做,行高会发生变化:第一张图是没有代表团;第二个带有委托(delegate)(顺便说一句。缺少服务 1 是正确的)
有没有办法在表格重新加载数据时保持当前向左或向右滑动的 UITableView UITableViewCell ? 我有一个表,每分钟重新加载数据以保持最新。我使用 UITableViewDelega
我是一名优秀的程序员,十分优秀!