[英]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.