简体   繁体   English

我该如何重新加载UITabBarController?

[英]how can I reload UITabBarController?

Hello I am making a simple program which is taking input from user and saving it is an NSMutableArray, I am passing that NSMutableArray to another class which is subclass of UITableViewController by using a method. 您好我正在创建一个简单的程序,它从用户那里获取输入并保存它是一个NSMutableArray,我通过使用方法将NSMutableArray传递给另一个类,它是UITableViewController的子类。 The NSMutableArray is correctly passed and I can see it by using NSLog. NSMutableArray已正确传递,我可以使用NSLog看到它。 but I want to see the NSMutableArray in my table cells. 但我希望在我的表格单元格中看到NSMutableArray。

I am writing it as following code, but I think it is not relaoding the UITabBarController, so please see the code and help me out... 我将其编写为以下代码,但我认为它不会重新编码UITabBarController,所以请查看代码并帮助我...

-(void) myMethodNew:(NSMutableArray*)allOrders {
    sameallOrders = [[NSMutableArray alloc] init];
    [sameallOrders addObject:allOrders];
    NSLog(@"%@", sameallOrders);
}

- (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 [sameallOrders 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] autorelease];
    }

    NSString *cellValue = [sameallOrders objectAtIndex:indexPath.row];
    cell.textLabel.text = cellValue;

    return cell;
}

if you can't understand anything which I have done, ask me, I will properly explain again, help me .... I will praise definitely... 如果你无法理解我所做的任何事情,请问我,我会再次正确解释,帮助我......我肯定会赞美......

add [myTableView reloadData]; 添加[myTableView reloadData]; to the end of your myMethodNew (change myTableView to whatever your table view is named as) 到myMethodNew的末尾(将myTableView更改为您的表视图命名为)

  -(void) myMethodNew:(NSMutableArray*)allOrders {
        sameallOrders = [[NSMutableArray alloc] init];
        [sameallOrders addObject:allOrders];
        NSLog(@"%@", sameallOrders);
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UITabBarController-如何为简单的开关设置动画? - UITabBarController -How Can I Animate Simple Switches? 如何从另一个UITabBarController中的另一个UINavigationController进入一个UITabBarController中的顶级UINavigationController? - How can I go to top level UINavigationController in one UITabBarController from another UINavigationController in another UITabBarController? 如何在UITabBarController上设置另一个视图的对象的.hidden属性 - How can I set the .hidden property of an object of another view on a UITabBarController 如何从UITabBarController访问_tabBar实例 - How can I access _tabBar instance from UITabBarController 如何将UITabBarController的底部标签栏自定义为该确切的模型? - How can I customize the bottom tab bar of UITabBarController to this exact mockup? 如何以编程方式切换到UITabBarController中的另一个选项卡? - How can I switch to another tab in UITabBarController programmatically? 如何使用Storyboard重新排列UITabBarController项目? - How can I rearrange UITabBarController items using the Storyboard? 我可以拥有超过 1 个 UITabBarController 吗? - Can I have more than 1 UITabBarController? 当我有UITabBarController时,如何将UINavigationController设置为初始屏幕? - How can I set a UINavigationController as my initial screen when I have a UITabBarController? 哪个UITabBarController事件重新加载一个视图? - which UITabBarController event to reload a view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM