我无法从“更多”选项卡(UITabbar)加载视图
看看这个视频,我解释了其中的所有内容: 视频
非常感谢,希望您能帮助我!
感谢您的快速回答,因此我的每个“选项卡”都使用“UITableViewController”,每个选项卡的代码都是相同的:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = [NSString stringWithFormat:@"S.I."];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Verin", @"Binaire - Héxa - Décimal",@"Transistors",@"PFS", nil];
//Futures Categ
//@"Conversions",
self.siArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[array release];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.siArray count];
}
// Customize the appearance of table view cells.
- (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];
}
// Set up the cell...
NSUInteger row = [indexPath row];
cell.text = [siArray objectAtIndex:row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
NSInteger row = [indexPath row];
if ([siArray objectAtIndex:row] == @"Verin") {//Si on clique sur Polynomes
SiVerinViewController *verin = [[SiVerinViewController alloc] initWithNibName:@"SiVerinView" bundle:nil];
self.siVerinViewController = verin;
[verin release];
siVerinViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.siNavController pushViewController:siVerinViewController animated:YES];
}
//I use one:
//if ([siArray objectAtIndex:row] == @"theCateg")
//for each Table category
if ([siArray objectAtIndex:row] == @"Transistors") {//Si on clique sur Polynomes
SiTransistorsViewController *tempo = [[SiTransistorsViewController alloc] initWithNibName:@"SiTransistorsView" bundle:nil];
self.siTransistorsViewController = tempo;
[tempo release];
siTransistorsViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.siNavController pushViewController:siTransistorsViewController animated:YES];
}
}
Take a look to this video, I explain everything in it:
the video
Thanks a lot, I hope you will help me!
Thanks your your very fast answer, so each of my "tab" uses a "UITableViewController", the code is the same for each one:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = [NSString stringWithFormat:@"S.I."];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Verin", @"Binaire - Héxa - Décimal",@"Transistors",@"PFS", nil];
//Futures Categ
//@"Conversions",
self.siArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[array release];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.siArray count];
}
// Customize the appearance of table view cells.
- (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];
}
// Set up the cell...
NSUInteger row = [indexPath row];
cell.text = [siArray objectAtIndex:row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
NSInteger row = [indexPath row];
if ([siArray objectAtIndex:row] == @"Verin") {//Si on clique sur Polynomes
SiVerinViewController *verin = [[SiVerinViewController alloc] initWithNibName:@"SiVerinView" bundle:nil];
self.siVerinViewController = verin;
[verin release];
siVerinViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.siNavController pushViewController:siVerinViewController animated:YES];
}
//I use one:
//if ([siArray objectAtIndex:row] == @"theCateg")
//for each Table category
if ([siArray objectAtIndex:row] == @"Transistors") {//Si on clique sur Polynomes
SiTransistorsViewController *tempo = [[SiTransistorsViewController alloc] initWithNibName:@"SiTransistorsView" bundle:nil];
self.siTransistorsViewController = tempo;
[tempo release];
siTransistorsViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.siNavController pushViewController:siTransistorsViewController animated:YES];
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题很可能出在第二层表的 tableview 委托的
– tableView:willSelectRowAtIndexPath:
中。您无法将详细视图推送到导航控制器的堆栈上。标签栏控制器使用不同的代码并且可以正常工作。
如果没有看到代码,我无法告诉你更多信息。
The problem pretty well has to be in your
– tableView:willSelectRowAtIndexPath:
of the tableview delegate for the second tier table. You're failing to push the detail view onto the navigation controller's stack.The tabbar controller uses different code and that works properly.
I can't tell you more without seeing the code.