gpt4 book ai didi

iphone - 如何直接从上一个 View 导航回第一个 View

转载 作者:行者123 更新时间:2023-11-28 19:20:32 25 4
gpt4 key购买 nike

我在 iphone 应用程序中添加了一个导航 Controller ,它从我的主屏幕到一个 TableView ,从它到细节的 TableView 。我能够在 View 之间来回导航。我想要的是直接从我的主屏幕的详细 View 。是否有可能这样做?

- (void)viewDidLoad {


[super viewDidLoad];

self.navigationItem.hidesBackButton = TRUE;
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)]; self.navigationItem.leftBarButtonItem = saveButton;



id1 = [[NSUserDefaults standardUserDefaults] valueForKey:@"id1"];
theTitle = [[NSUserDefaults standardUserDefaults] valueForKey:@"theTitle"];
self.title=theTitle;
NSLog(@"hi %@", id1);
hello=@"hello";
NSLog(@"ahhhha sdfgs :%@",theTitle);

urlAddress = [NSString stringWithFormat:@"http://dev-parkguiden.knutpunkten.se/Api/GetPark?parkid=%@",self.id1];
baseURL =[[NSURL URLWithString:urlAddress]retain];

jsonData=[NSData dataWithContentsOfURL:baseURL];

NSDictionary *items=[NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];

boom=[items objectForKey:@"description"];
latitude=[items objectForKey:@"latitude"];
longitude=[items objectForKey:@"longitude"];
NSLog(@"retard:%@",latitude);
NSLog(@"retard:%@",longitude);
NSString *html = [NSString stringWithFormat:@"<html><body><p>%@</p></body></html>", boom];
[self.webview loadHTMLString:html baseURL:nil];


[[NSUserDefaults standardUserDefaults] setValue:latitude forKey:@"lat"];
[[NSUserDefaults standardUserDefaults] setValue: longitude forKey:@"lot"];
[[NSUserDefaults standardUserDefaults] setValue: theTitle forKey:@"title"];

最佳答案

[self.navigationController popToRootViewControllerAnimated:YES];

这将弹出回导航 Controller 的 rootviewController

关于iphone - 如何直接从上一个 View 导航回第一个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9256154/

25 4 0