Tag: uistoryboardsegue

在(BOOL)webView中:如何打开在UIWebView中点击的URL,打开一个Modal UIWebView

感谢您查看我的问题。 让我先描述一下这个应用程序。 我有一个基于标签栏的iOS5.1应用程序使用情节提要和ARC。 每个视图控制器都有四个选项卡,用于显示带有本地HTML文件的web视图(每个视图都是一组不同的html文件)。 目前,当用户触摸http或https链接时,它将在Safari中打开。 不过,我现在希望它通过模态视图在应用程序中打开。 我目前已经创build了界面并准备显示,但是我无法将URL传递给模型的“webview2”。 我已经找了很多例子,使用RSURL和string等,但不能得到任何工作。 一些示例代码似乎不适合我的情况。 在我的FirstViewController.m文件(这是相同的其他意见),我有… – (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { //Gets the link. if (navigationType == UIWebViewNavigationTypeLinkClicked) { NSURL *URL = [request URL]; NSLog(@"url:%@",request); //Get's the url itself //If it's an external link… if ([[URL scheme] isEqualToString:@"http"] || [[URL scheme] isEqualToString: @"https" ]) { [[UIApplication sharedApplication] openURL:[request URL]]; NSLog(@"Opened in […]

在Xcode Storyboard中使用Unwind SegueclosuresPopover

我正在使用Xcode 4.5和新的iOS 6function来解开赛道。 我在一个popup窗口中提供了一个导航视图控制器,它是通过一个条形button项目以编程方式呈现的: – (IBAction)configChartTapped:(id)sender { if (self.popover.isPopoverVisible) { [self.popover dismissPopoverAnimated:YES]; } else { UINavigationController *chartConfigNavigationController = [self.storyboard instantiateViewControllerWithIdentifier:@"GrowthChartNavigationController"]; ConfigChartTypeViewController *configChartTypeViewController = (ConfigChartTypeViewController*) chartConfigNavigationController.topViewController; self.popover = [[UIPopoverController alloc]initWithContentViewController:chartConfigNavigationController]; self.popover.popoverContentSize = CGSizeMake(320, 500); self.popover.delegate = self; [self.popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } } 在这个方法的旁边,我定义了一个目标来解开这个segue(即解散popover)。 – (IBAction)cancelConfig:(UIStoryboardSegue *)segue { // } …并将其连接到导航视图控制器导航栏中的取消button。 连接取消栏button到cancelConfigbutton在Xcode中工作得很好。 然而,当运行代码时,尽pipeXcode 4.5应该支持在展开segues(根据发布文档)时支持取消popovers,但单击Cancelbutton时没有任何反应。 我错过了什么? 谢谢!

隐藏导航栏,但是当我转换到以前的视图(popup),它暂时显示旧的后退button。 为什么?

我有一个导航控制器中的视图控制器(根: RootViewController ,第二个: ReadingViewController ),但在第二个视图控制器我想禁用UIToolBar的导航栏(因为我不需要标题,并希望更多的button,如iBooks或Facebook应用程序)。 问题是,当我在第二个视图中隐藏导航栏时,当我popup视图控制器时,它会随机出现一秒钟(返回)。 当我popup视图控制器后面的button出现一秒钟: 在第二个视图控制器中,我隐藏在viewWillAppear:的导航栏: – (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:YES]; } 另外在第二个视图控制器中,我将viewWillDisappear:的导航栏恢复为:: – (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // … other stuff [self.navigationController setNavigationBarHidden:NO animated:YES]; } 我想知道如何解决这个问题,使视图控制器无缝过渡。

嵌套推animationiOS7的错误?

我刚刚遇到了一个错误testing的应用程序的问题。 我正猛地把头靠在墙上,明白为什么我得到这个错误: 2013-11-25 09:02:55.687[186:60b] nested push animation can result in corrupted navigation bar 2013-11-25 09:02:56.055[186:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2013-11-25 09:02:57.666[186:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview' 一段时间后,我创build了一个新的项目,试图重现该错误: 这发生在我按下两个不同时间的酒吧button项目,然后同时释放。 我正在使用与segues故事板,没有任何自己写的代码。 这是一个iOS7的错误,或者我错过了什么? 我没有能够在模拟器上重现,因为我没有两个游标…我使用的iOS2 7.0.3的iPad2 故事板的图像: 编辑: […]

prepareForSegue **总是**创build一个新的destinationViewController?

我只是意识到,下面的代码总是创build一个新的TagsFeedViewController。 这是segues的默认行为吗? 有没有办法configurationiOS不创build一个新的destinationViewController每次? – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showSearchResult"]) { TagsFeedViewController *destViewController = segue.destinationViewController; destViewController.query = query; } }

XCode自定义segue类卡住了

这个问题看起来可能有些奇怪,但我无法理解为什么会发生这种情况。 我所做的是我重新命名了一个自定义的segue类,并将其反映在“自定义类”下的故事板中,但仍尝试调用旧类。 我已经清理了构build文件夹,并search了旧的自定义类名称的项目,至less在xcode中找不到任何东西。 我看故事板文件,也不在那里。 即使我删除了自定义继续,我得到: 'Could not find a segue class named 'xxxxxxxxx'' 事情是我不明白从上面得到'xxxxxxxxx',它不是在故事板文件或代码中.. [[[self view] viewWithTag:1] resignFirstResponder]; 当我debugging时,这是线程杀死显示错误的地方。 我已经删除了所有的网点,事件和赛段在文本字段。 我没有使用“xxxxxxxxx”作为任何类的自定义segue。 还有什么我可以做的更清洁的项目更彻底? 从哪里开始?

警告:试图在已经呈现的*上显示*(null)

这是我第一个iOS应用程序。 所以我有UIVIewController与UITableView我集成了UISearchBar和UISearchController为了过滤TableCells显示 override func viewDidLoad() { menuBar.delegate = self table.dataSource = self table.delegate = self let nib = UINib(nibName: "ItemCellTableViewCell", bundle: nil) table.registerNib(nib, forCellReuseIdentifier: "Cell") let searchButton = UIBarButtonItem(barButtonSystemItem: .Search, target: self, action: "search:") menuBar.topItem?.leftBarButtonItem = searchButton self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self controller.dimsBackgroundDuringPresentation = false return controller })() self.table.reloadData() […]

iOS 6 – 以编程方式触发Unwind Segue什么也不做

在我的应用程序启动时,它使用segue以编程方式显示LoginViewController。 视图控制器以模态方式呈现,设置为交叉溶解。 成功的身份validation后,我想通过以编程方式触发unwind segue来closureslogin视图。 所以我把这个添加到我的头文件中: – (IBAction)unwindSegue:(UIStoryboardSegue *)segue; 现在在IB我能够控制 – 从“文件的所有者”LoginViewController拖动到退出button,并selectunwindSegue: 这将创build一个手动的继续,它显示在正确的文件的所有者和退出button的连接检查器。 然后,我从IB中的场景中单击新创build的Unwind segue,然后为其命名。 如果我点击“去”button来取消放风行动,它会把我带到上面提到的声明。 到目前为止,我在GCD块中成功进行authentication后,触发了这个过程: …. dispatch_async(dispatch_get_main_queue(), ^ { [self performSegueWithIdentifier:@"UnwindSegueIdentifier" sender:self]; [self.spinner removeFromSuperview]; self.spinner = nil; }); …..运行时没有任何反应。 微调确实被删除了,但是没有任何放松继续执行的迹象。 unwindSegue:实现的一个突破点unwindSegue:永远不会被击中。 没有错误抛出。 没有任何东西被写入控制台。 标识符是正确的,我三重检查(否则它将失败)。 我看了这里和这里的答案,但我似乎没有遗漏任何东西。 但是我注意到,Xcode认为unwindSegue: 没有联系: 我无法从unwindSegue:前的小空圈拖动,并将其链接到“退出”button。 任何帮助将不胜感激。

IOS:从故事板中的原型单元发射多个段落

有没有办法将原型单元格连接到不同的场景,并在didSelectRowAtIndexPath方法调用[self performSegueWithIdentifier:@“NAMEOFTHESEGUE”sender:self]? 我似乎无法从原型单元格拖动多个segues到不同的场景…我知道这是可能的静态单元格,因为您可以绘制从每个单元格赛格到场景,但如果我使用原型单元格? 我目前正在试图使用SWRevealViewController( https://github.com/John-Lluch/SWRevealViewController )插件来实现。 在故事板示例项目中,他使用了一个包含3个静态单元格的表格,并将每个单元格连接到不同的场景。 但在我的情况下,静态单元不是一个选项,所以如果有人知道答案将是伟大的。 哦,并且在导航控制器中embedded了“侧面板视图控制器”,这是一个UIViewController,所以我可以将导航控制器连接到不同的场景不是一个选项,因为在这种情况下,新的场景在滑动面板内打开… 请考虑到我还是IOS编程的新手。 感谢您的时间! 编辑+解决scheme :我试图连接从视图控制器的赛格斯场景,但它一直给予和例外“NSInvalidArgumentException – 接收器没有segue与标识符…”解决scheme是在Xcode去“产品”,然后select“清理“: https : //stackoverflow.com/a/14089463/1185133

prepareForSegue和popViewController兼容性

这个问题 我在iOS应用程序上工作,我有3个连续的ViewControllers : TableViewController – > DetailViewController – > ImageViewController 我用一个button执行Degue Segue(只要控制拖动Storyboard ),然后回到我有一个自定义后退button [self.navigationController popViewControllerAnimated:YES]; 发送数据,我使用 – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { [segue.destinationViewController someFunction]; } 要将数据发送到父ViewController我可以在DetailViewController使用prepareForSegue ,但它在ImageViewController不起作用,我必须使用Notifications 。 如果我使用prepareForSegue发送popViewControllerAnimated数据, popViewControllerAnimated吗? 我应该在两种情况下使用通知吗? 一些代码 我在DetailViewController有一个button,它执行Segue到ImageViewController(只是控制在Storyboard拖动)和一个Back Button: – (IBAction)backAction:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } 然后function: – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"forwardSegue"]) { [segue.destinationViewController someFuntionToImageViewController]; } else { [segue.destinationViewController someFuntionToParentViewController]; […]