在目标c中的tableViewController中显示NSMutabelArray

沙米拉

我将NSMutableArray传递给另一个表视图,我想在表视图中显示它。我的NSMutableArray如下

2017-02-07 18:32:24.086 krib[13753:2978659] (
    "Balcony.png",
    "Utilities Included.png",
    "Air-conditioning.png",
    "Stove.png",
    "WiFi Included.png",
    "Queen Bed.png",
    "Dining Table.png",
    "Washing Machine.png",
    "Dryer.png",
    "Sofa.png",
    "TV.png",
    "Curtains.png",
    "Refrigerator.png",
    "Water Heater.png",
    "Microwave Oven.png"
)

我将数据发送为

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"segue"]) {
    MZFormSheetPresentationViewControllerSegue *presentationSegue = (id)segue;
    presentationSegue.formSheetPresentationController.presentationController.shouldApplyBackgroundBlurEffect = YES;
    UINavigationController *navigationController = (id)presentationSegue.formSheetPresentationController.contentViewController;
    AmennitiesTableTableViewController *presentedViewController = [navigationController.viewControllers firstObject];
//        presentedViewController.textFieldBecomeFirstResponder = YES;

    presentedViewController.passingString = facilities;

}

并在表视图控制器中接收数据,

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];

    NSLog(@"%@",self.passingString);
    [self.tableView reloadData];

}

我尝试显示如下可变数组,

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdentifier = @"facilitiesCell";
    AmenitiesTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    cell.facilitylbl.text = [self.passingString objectAtIndex:indexPath.row];

    // Configure the cell...

    return cell;
}

但是我不明白在表视图中填充数据到底缺少什么。

穆克什

我认为您缺少设置tableview委托和数据源。

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
    [self.myTable setDelegate:self];
    [self.myTable setDataSource:self];

    NSLog(@"%@",self.passingString);
   [self.tableView reloadData];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
   // Return the number of sections.
   return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   // Return the number of rows in the section.
    return self.passingString.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdentifier = @"facilitiesCell";
   AmenitiesTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    if(self.passingString.count > 0){
        cell.facilitylbl.text = [self.passingString objectAtIndex:indexPath.row];
     }

// Configure the cell...

    return cell;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

XML 解析数据未从目标 c 中的 viewController 获取到 tableViewController?

如何在目标C中显示时间

在UIScrollView中不显示ImageView(目标C)

在TableView之后显示TableViewController中的AdBannerView

从tableViewController创建序列是在目标viewController中添加导航栏

目标C-嵌入在ViewController中的TableViewController-是什么触发了表格视图来处理数据?

无法在TableViewController中显示Firebase数据库中的项目

xcode 7 json始终在目标C中显示错误

为什么在目标C的cellforRowAtIndexPath中未显示图像

如何在IOS中显示选中的选中的TableViewCell(目标c)

如何仅在TableView中显示UISearchbar条,而不在目标C中的UINavigationbar中显示

如何在 TableViewController 中显示 Firestore 文档名称?

在目标 C 中的 UI 中显示日期时的时区问题(显示少 1 天)

在tableviewcontroller中缓存图像

如何在目标 c 中的多个标签上显示文本文件中的随机单词

为什么在iOS中将tableview样式分组后,目标c中的标题部分的视图无法正确显示,目标c

在Xcode中显示多个目标输出

在 Dragula 中突出显示目标容器

在目标C中解析json

目标C中的位屏蔽

目标C中的测验应用

目标C中的@dynamic属性

什么是目标 c 中的 xyz*

什么是C中的目标文件?

目标C中的类型转换

合并目标C中的排序

目标c中的加号(+)与减号(-)

在目标C中返回NSMutableArray

目标c中的UIImageView数组