简单的表格导航帮助
嗨
我的视图是导航控制器内的表格视图。我使用其他人的代码来执行此操作,并且我知道这是该人编写代码时的意图,但是当我触摸表格单元格时,它会将我带到相同的视图。您如何评价下面的代码以使用每个不同的表格单元加载不同的笔尖。
MoreTableViewController.h
@interface MoreTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *moreTableView;
NSMutableArray *moreArray;
AboutDetailViewController *aboutDetailViewController;
}
@property (nonatomic, retain) NSMutableArray *moreArray;
@property (nonatomic, retain) AboutDetailViewController *aboutDetailViewController;
@end
MoreTableViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
if (self.aboutDetailViewController == nil) {
AboutDetailViewController *aboutD = [[AboutDetailViewController alloc] initWithNibName:@"AboutDetailViewController" bundle:nil];
self.aboutDetailViewController = aboutD;
[aboutD release];
}
aboutDetailViewController.title = [NSString stringWithFormat:@"%@", [moreArray objectAtIndex:row]];
ROSS_APP_7AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.moreNavController pushViewController:aboutDetailViewController animated:YES];
}
我必须执行 if 语句吗?如果是的话我该怎么写代码。我需要这里能得到的所有帮助。 感谢您的帮助。
Hi
My view is a table view inside a navigation controller. I used someone else's code to do this, and i know this was the person's intention when writing the code, but when I touch a table cell it brings me to the same view. How would you critique the code below to load a different nib with each different table cell.
MoreTableViewController.h
@interface MoreTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *moreTableView;
NSMutableArray *moreArray;
AboutDetailViewController *aboutDetailViewController;
}
@property (nonatomic, retain) NSMutableArray *moreArray;
@property (nonatomic, retain) AboutDetailViewController *aboutDetailViewController;
@end
MoreTableViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
if (self.aboutDetailViewController == nil) {
AboutDetailViewController *aboutD = [[AboutDetailViewController alloc] initWithNibName:@"AboutDetailViewController" bundle:nil];
self.aboutDetailViewController = aboutD;
[aboutD release];
}
aboutDetailViewController.title = [NSString stringWithFormat:@"%@", [moreArray objectAtIndex:row]];
ROSS_APP_7AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.moreNavController pushViewController:aboutDetailViewController animated:YES];
}
Would i have to do an if statement? If so, how would I write the code. I need all the help I can get here.
Thanks For your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧......
你必须在下面的方法中写下所有这些东西
Ok....
And you have to write all these things in below method