Tag: segue

从集合视图移动到详细视图时如何使用CoreData

我有一个IOS应用程序正在使用RestKit从服务器将JSON格式的数据拉到CoreData实体。 该实体的一些属性帮助填充每个单元格的图像和标题的集合视图。 我试图从一个单元格被选中时从集合视图移动到一个细节视图。 CoreData实体有一个“summary”属性,我想在详细视图中显示图像。 我知道我可以通过prepareForSegue方法传递数据。 但我不知道如何指定我想传递的图像和摘要数据 。 也许传递图像和总结不是正确的方法? 我应该通过managedObjectContext到详细信息视图控制器,并从那里获取结果? 这里是我的CollectionView是如何填充的。 – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; MyNewsCollectionViewCell *cell = (MyNewsCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath]; NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath]; NSURL *photoURL = [NSURL URLWithString:(NSString *) [object valueForKey:@"imageUrl"]]; NSData *photoData = [NSData dataWithContentsOfURL:photoURL]; [cell.cellimg setImage:[[UIImage alloc] initWithData:photoData]]; [cell.title setText:[object valueForKey:@"title"]]; return […]

有问题与UISplitViewController

我创build了一个字典应用程序,我正在使用UISplitViewController来search和select一个单词,我的应用程序崩溃与此日志: -[MeaningViewController topViewController]: unrecognized selector sent to instance 0x7f918945bef0 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MeaningViewController topViewController]: unrecognized selector sent to instance 0x7f918945bef0' 这里是我的代码:在ViewController (MasterView) : – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { [_searchbar resignFirstResponder]; if ([segue.identifier isEqualToString:@"Meaning"]) { //MeaningViewController *meaningVC = (MeaningViewController*)[[segue destinationViewController] topViewController]; UINavigationController *navController = (UINavigationController *)segue.destinationViewController; MeaningViewController *meaningVC = (MeaningViewController *)navController.topViewController; […]

从AppDelegate.swift执行Segue

我正在尝试通知后执行一个segue。 这是我在我的应用程序委托中。 func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { let viewController = self.window!.rootViewController!.storyboard!.instantiateViewControllerWithIdentifier("SecondViewController") self.window?.rootViewController = viewController } 这直接把我带到我想要去的视图,但是navbar和tab栏是隐藏的。 从应用程序委托,我如何执行从一个视图segue到另一个? 所以我可以通过第二种观点来达到,就好像我是从我的第一视angular推开的?

UITableView仅在第二次尝试时将数据发送到Detail View Controller

嘿,我一直在一个交通应用程序工作了一段时间,一直卡在这个问题一段时间了。 我正在使用iOS 5和故事板。 基本上我有一个UITableView显示最喜欢的公交车站位置,当用户select我使用的行: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Favorite *favorite = [self.favoriteItems objectAtIndex:indexPath.row]; stopString = favorite.title; routeString = favorite.subtitle; } 通过用户select的单元格的停止和路线信息,然后准备与我的故事板上的一个segue相对应的segue,推送一个使用停靠点名称和路线名称的详细视图控制器来显示来自plist的时间。 我对Objective C和iOS相当陌生,所以我使用了一个我的朋友告诉我可以工作的segue,但是,这可能是问题所在。 segue看起来像这样: – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { UIViewController *destination = segue.destinationViewController; if ([destination respondsToSelector:@selector(setDelegate:)]) { [destination setValue:self forKey:@"delegate"]; } if ([destination respondsToSelector:@selector(setSelection:)]) { NSString *route = routeString; NSDictionary *selection1 = [NSDictionary […]

Receiver没有标识符“***”

我第一次遇到这个问题。 我检查了堆栈溢出类似的问题,但没有解决scheme可以解决我的问题,所以我有这个post。 到目前为止,我有两个视图controllers (让我们说A和B),我试图用一个名为“toB”的segue连接它们。 当我运行这个程序的时候,Xcode告诉我Receiver(B) has no segue with identifier "toB" 。 我很确定storyboard和代码中identifier的拼写完全相同。 并且segue的线连接了A view controller和B view controller 。 但两个视图controllers的storyboard ID是不同的。 这是问题吗? 希望有人能帮助我。 提前致谢! 解 感谢@Amit Shelgaonkar的提示! 在我的情况下,移动performSegueWithIdentifier viewDidAppear仍然无法正常工作,但将其移动到applicationWillEnterForeground解决问题! 我仍然不知道为什么它不起作用,因为当我试图开发一个testing应用程序,并把performSegueWithIdentifier放在viewDidAppear ,它完美的作品。

放松之后显示警报继续停止继续。 如何确保在放松继续完成后显示警报?

从视图控制器到B视图控制器,我有一个放松的过程。 networking操作在B完成。操作完成后,响应将显示在视图控制器中。 我成功地做了这个结构。 但是有一个问题: 当我尝试显示警报时,显示但停止了继续。 如何在赛季完成后确保提醒显示。 错误在这里: 2016-04-27 14:39:28.350 PROJECT[9100:128844] Presenting view controllers on detached view controllers is discouraged <PROJECT.FeedTableViewController: 0x7a928c00>. 2016-04-27 14:39:28.359 PROJECT[9100:128844] popToViewController:transition: called on <UINavigationController 0x7c12a800> while an existing transition or presentation is occurring; the navigation stack will not be updated. A:中的展开处理程序 @IBAction func unwindToFeed(segue: UIStoryboardSegue) { jsonArray[rowFromShare!]["ApplicationDataUsers"] = jsonFromShare! tableView.reloadData() ShowErrorDialog("Success", […]

Xcode 6自适应故事板不同的每个设备的Segues

我在Xcode 6中新引入的自适应故事板中遇到了一些麻烦。iPhone应用程序已经完成,现在我想创build一个通用应用程序。 假设我有一个viewcontroller ,它显示了一些单元格和一个详细的viewcontroller ,其中显示了单元格的细节。 在iPhone上:当我点击单元格时,我push segue了细节视图。 在iPad上:我想有一个modal segue而不是一个推。 我可以在prepareForSegue或其他方面改变这个吗? 编辑:我find了一种方式…但我并不完全满意。 如果有人有更好的解决scheme,请告诉我… 我做了两个赛段,并在代码中加以区分。 if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) { self.performSegueWithIdentifier(kSegueToDetailModal, sender: object) } else if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone) { self.performSegueWithIdentifier(kSegueToDetail, sender: object) }

如何在iOS应用程序中手动设置“返回”目的地

我有一个名为“detailViewController”的UIViewController。 这个视图控制器是通过使用push segue的多个不同阶段来访问的。 我面临的问题是,detailViewController上的后退button将用户带回到以前的视图控制器(因为它应该),但是我想要后退button将用户带到masterViewController(应用程序中的默认UIViewController) 。 我该怎么做呢? 我曾经试过改变赛格型,但是根本没有做任何事情。 彼得

iOS委托不能使用performSegueWithIdentifier?

我有两个控制器(第一,第二)在故事板,xcode 4.2。 第一个控制器有一个tableview并embedded导航控制器。 第二个控制器也有一个桌面视图,并embedded导航控制器(不同于第一个) 在first.h中: #import "second.h" … @interface first : UIViewController <secondDelegate, UITableViewDelegate, UITableViewDataSource> … 在first.m: – (IBAction)add:(id)sender // action when tapped a button on topbar { [self performSegueWithIdentifier:@"addSegue" sender:sender]; } …. – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([[segue identifier] isEqualToString:@"addSegue"]) { NSLog(@"delegated"); second *controller=[segue destinationViewController]; controller.delegate=self; } } – (void)callback { NSLog(@"Callback here"); } […]

执行SegueWithIdentifier和viewDidLoad

MainViewController: [self performSegueWithIdentifier:@"showNextVC sender:self]; Segue目标控制器: – (void)viewDidLoad { [super viewDidLoad]; NSLog(@"Show text!"); [self performSegueWithIdentifier:@"showSignUp" sender:self]; } 为什么不执行目标控制器的viewDidLoad方法中的代码?