使用OHGridView无法识别的选择器

时间:2011-02-20 05:24:47

标签: iphone objective-c cocoa-touch gridview

我下载了OHGridView,希望这是我所有问题的答案。

https://github.com/AliSoftware/OHGridView

我做了它所说的所有事情(添加类文件,添加代码,并更改其他一些东西)。

我去建造它并且它崩溃了。我意识到它崩溃的代码行:

((OHGridView *)self.view).rowHeight = 100;
((OHGridView *)self.view).columnsCount = 2;

控制台出错:

`-[UIView setRowHeight:]: unrecognized selector sent to instance 0x4b55110
2011-02-20 09:01:16.906 TableView[14358:207] *** Terminating app due to uncaught     exception 'NSInvalidArgumentException', reason: '-[UIView setRowHeight:]: unrecognized  selector sent to instance 0x4b55110'
*** Call stack at first throw:
(
0   CoreFoundation                      0x00e4dbe9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x00fa25c2 objc_exception_throw + 47
2   CoreFoundation                      0x00e4f6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3   CoreFoundation                      0x00dbf366 ___forwarding___ + 966
4   CoreFoundation                      0x00dbef22 _CF_forwarding_prep_0 + 50
5   TableView                           0x00004232 -[DetailViewController viewDidLoad] + 831
6   UIKit                               0x0037165e -[UIViewController view] + 179
7   UIKit                               0x0036fa57 -[UIViewController contentScrollView] + 42
8   UIKit                               0x00380201 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
9   UIKit                               0x0037e831 -[UINavigationController _layoutViewController:] + 43
10  UIKit                               0x0037fa86 -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
11  UIKit                               0x0037a606 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
12  UIKit                               0x0038183e -[UINavigationController pushViewController:transition:forceImmediate:] + 932
13  UIKit                               0x0037a4a0 -[UINavigationController pushViewController:animated:] + 62
14  TableView                           0x00002e4f -[RootViewController tableView:didSelectRowAtIndexPath:] + 681
15  UIKit                               0x00339794 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
16  UIKit                               0x0032fd50 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
17  Foundation                          0x000427f6 __NSFireDelayedPerform + 441
18  CoreFoundation                      0x00e2efe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
19  CoreFoundation                      0x00e30594 __CFRunLoopDoTimer + 1220
20  CoreFoundation                      0x00d8ccc9 __CFRunLoopRun + 1817
21  CoreFoundation                      0x00d8c240 CFRunLoopRunSpecific + 208
22  CoreFoundation                      0x00d8c161 CFRunLoopRunInMode + 97
23  GraphicsServices                    0x016ef268 GSEventRunModal + 217
24  GraphicsServices                    0x016ef32d GSEventRun + 115
25  UIKit                               0x002d242e UIApplicationMain + 1160
26  TableView                           0x00001abc main + 102
27  TableView                           0x00001a4d start + 53
)
terminate called after throwing an instance of 'NSException`

我删除它们并且装好了,但我没有看到任何内容。

请帮忙, 感谢。

1 个答案:

答案 0 :(得分:1)

我刚刚修复了存储库,然后在不对代码进行任何更改的情况下构建并运行了他的示例项目。它没有任何警告或错误。

无论您做出哪些更改,都需要检查代码 您的评论后更新
Unrecognized Selector通常意味着您有大写错误或您的代码不是您认为的那种对象。
例如:如果我尝试直接针对setRowHeight:对象而不是对象的OHGridView属性调用view,我会得到几乎相同的错误,例如

    ((OHGridView*)self).rowHeight = 100;
((OHGridView*)self).columnsCount = 2;

因此,我会检查您的代码以确保您的对象是OHGridView,并且您正在设置OHGridView视图的rowHeight属性。

相关问题