Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/122.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
Ios 将TableView添加到UIViewController会显示[\uU NSCFConstantString size]错误_Ios_Iphone_Objective C_Uitableview - Fatal编程技术网

Ios 将TableView添加到UIViewController会显示[\uU NSCFConstantString size]错误

Ios 将TableView添加到UIViewController会显示[\uU NSCFConstantString size]错误,ios,iphone,objective-c,uitableview,Ios,Iphone,Objective C,Uitableview,我正在将tableView添加到具有自定义大小的viewController中,即我正在定义其框架。 我没有设置它的委托,因为我不希望tableView执行任何操作。即使我设置了它,错误也是一样的。现在这个tableView由一个图像数组填充。当我运行应用程序时,它抛出[\uu NSCFConstantString size]异常 [__NSCFConstantString size]: unrecognized selector sent to instance 0x1e25c

我正在将
tableView
添加到具有自定义大小的
viewController
中,即我正在定义其框架。 我没有设置它的委托,因为我不希望tableView执行任何操作。即使我设置了它,错误也是一样的。现在这个
tableView
由一个
图像数组填充。当我运行应用程序时,它抛出[\uu NSCFConstantString size]异常

    [__NSCFConstantString size]: unrecognized selector sent to instance 0x1e25c
   Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString size]: unrecognized selector sent to instance 0x1e25c'
     *** First throw call stack:
    (
0   CoreFoundation                      0x01ce85e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x018d88b6 objc_exception_throw + 44
2   CoreFoundation                      0x01d85903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3   CoreFoundation                      0x01cd890b ___forwarding___ + 1019
4   CoreFoundation                      0x01cd84ee _CF_forwarding_prep_0 + 14
5   UIKit                               0x0059343f -[UIImageView setImage:] + 389
6   AirMapp                             0x0000f187 -[MainViewController tableView:cellForRowAtIndexPath:] + 375
7   UIKit                               0x0052cd2f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
8   UIKit                               0x0052ce03 -[UITableView _createPreparedCellForGlobalRow:] + 69
9   UIKit                               0x00511124 -[UITableView _updateVisibleCellsNow:] + 2378
10  UIKit                               0x005245a5 -[UITableView layoutSubviews] + 213
11  UIKit                               0x004a8dd
这就是我正在做的

这是在
viewDidLoad
中定义的tableView数据源

    menuArray = [[NSArray alloc]initWithObjects:@"icone_what1c.jpg",@"icone_what3c.jpg", @"icone_what2c.jpg",@"icone_what4c.jpg" ,nil];
tableView
datasource方法

  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
       return [menuArray count];
  }


  - (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.imageView.image = [menuArray objectAtIndex:indexPath.row];
      return cell;
   }
这是例外情况的总结

    [__NSCFConstantString size]: unrecognized selector sent to instance 0x1e25c
   Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString size]: unrecognized selector sent to instance 0x1e25c'
     *** First throw call stack:
    (
0   CoreFoundation                      0x01ce85e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x018d88b6 objc_exception_throw + 44
2   CoreFoundation                      0x01d85903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3   CoreFoundation                      0x01cd890b ___forwarding___ + 1019
4   CoreFoundation                      0x01cd84ee _CF_forwarding_prep_0 + 14
5   UIKit                               0x0059343f -[UIImageView setImage:] + 389
6   AirMapp                             0x0000f187 -[MainViewController tableView:cellForRowAtIndexPath:] + 375
7   UIKit                               0x0052cd2f -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 412
8   UIKit                               0x0052ce03 -[UITableView _createPreparedCellForGlobalRow:] + 69
9   UIKit                               0x00511124 -[UITableView _updateVisibleCellsNow:] + 2378
10  UIKit                               0x005245a5 -[UITableView layoutSubviews] + 213
11  UIKit                               0x004a8dd
换行

cell.imageView.image = [menuArray objectAtIndex:indexPath.row];

换行

cell.imageView.image = [menuArray objectAtIndex:indexPath.row];