Menu
  • HOME
  • TAGS

Common pattern with segues and table views in iOS

ios,objective-c,uitableview,uistoryboardsegue

In prepareForSegue, the sender argument will be the cell, so you can work out which one was tapped at that point. You could also check the tableview's selectedIndexPath property. You don't need to implement both functions. ...

Segues vs. UIViewControllerAnimatedTransitioning

ios,ios8,uistoryboardsegue,uiviewanimationtransition

Some differences: Segues can only be used with storyboards. Animator objects can be used programmatically, or along with segues. Animator objects allow you to set a customized final position and size for your new view controller. Animator objects can be configured to do special animations with navigation controllers and collection...

Receiver has no segue with identifier“***”

ios,objective-c,storyboard,segue,uistoryboardsegue

you call performSegueWithIdentifier:sender: in the viewDidLoad. You can not dismiss a UIViewController that isn't presented yet. viewDidLoad has purely memory management functions, you can use it as (part of a) constructor. What may work, is to start a segue in viewDidAppear, however I would suggest to start with the view...

programaticlly load viewController class

ios,swift,segue,uistoryboardsegue

You can initiate nextview programetically this way: let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyboard.instantiateViewControllerWithIdentifier("someViewController") as! UIViewController self.presentViewController(vc, animated: true, completion: nil) ...

Going back to viewController that was already segued to and is already loaded? No nav controller

ios,segue,uistoryboardsegue

You can't do this with a segue, since segues always instantiate new controllers. Instead of a segue, you should create a property for ViewControllerB in ViewControllerA, and instantiate it only the first time you go to it (which you would do using presentViewController:animated:completion). After coming back to A, when you...

how to pass the variable in segue

ios,objective-c,uistoryboardsegue

chatrooms defined as an ivar like you have done is accessed using -> notation: groupView->chatrooms = [NSMutableArray arrayWithArray:chatrooms] This is generally discouraged, though. You should use a property instead: @interface GroupView @property (strong) NSMutableArray *chatrooms; @end Incidentally, if you're using an NSMutableArray, that indicates that you want to modify the...

Swift - Performing Segue from UITableViewCells to different View Controller Destinations

uitableview,swift,segue,uistoryboardsegue

That's not a new question, many topics about. You should specify a tag on each cell : cell.tag = 0 In your prepareForSegue, use : if sender!.tag.littleEndian == 0 { let UIViewController:ViewController = segue.destinationViewController as YourSpecificViewcontroller } else if sender!.tag.littleEndian == 1 { let UIViewController:ViewController = segue.destinationViewController as YourOtherSpecificViewcontroller }...

Can't embed in navigation controller if I am passing data with prepareForSegue

ios,xcode,uinavigationcontroller,uistoryboardsegue

let controller: CropViewController = segue.destinationViewController as CropViewController Double check if segue.destinationViewController is actually the navigation view controller. If it's the navigation controller, get CropViewController from it: if segue.identifier == "camera2Crop" { let navController = segue.destinationViewController as UINavigationController let controller = navController.viewControllers[0] as CropViewController controller.photoTaken = self.photoTaken } Note you don't...

Segue must be modal with page navigation

storyboard,segue,watchkit,uistoryboardsegue,apple-watch

Page-based navigation and hierarchical navigation are exclusive – you can't mix and match unless you present a new interface modally. This is expected behaviour.

Cannot programmatically perform segue

ios,objective-c,uinavigationcontroller,uistoryboardsegue

Try implementing the shouldPerformSegueWithIdentifier:sender: or prepareForSegue:sender: methods in the 'from' view controller. Put a break point or NSLog() inside the method to inspect the segue identifier. This will prove that you indeed set up the segue correctly in the storyboard. If you want to manually push your next view controller...

Xcode pass data from a viewcontroller to another viewcontroller in a different storyboard

ios,objective-c,xcode,uiviewcontroller,uistoryboardsegue

First of all set Storyboard ID to your SecondView Controller like below image. Then add following code at your button click event. - (IBAction)moveToViewcontrollerB:(id)sender { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard2" bundle: nil]; SecondStoryboardVC * secondStoryboardVCOBJ_ = [storyboard instantiateViewControllerWithIdentifier:@"SecondClassStoryboardID"]; [secondStoryboardVCOBJ_ setStrValue:@"The transfer of data worked!"]; secondStoryboardVCOBJ_.modalTransitionStyle = UIModalTransitionStyleCoverVertical;...

iOS segue too slow

objective-c,profiler,uistoryboardsegue

The problem, clearly displayed in your log, is that One, Two, Three, and Four are being performed on a background thread. This means, for example, that you are saying: [self performSegueWithIdentifier:@"login_success_new" sender:self]; ...on a background thread. That is so wrong. You must NEVER say anything to or about the interface...

How to make work preparForSegue :sender: XCode 6?

ios,objective-c,xcode,uistoryboard,uistoryboardsegue

You would remove the sender part of your code. It should look like this: - (void)prepareForSegue:(UIStoryboardSegue *)segue{ //your code //check if the next view exists by checking for the id if ([[segue identifier] isEqualToString:@"Segue_Name"]) { DovizTableViewController *controller = [segue destinationViewController]; controller.user = self.user; } } ...

How should i handle Alamofire response in shouldPerformSegueWithIdentifier?

swift,segue,uistoryboard,uistoryboardsegue,alamofire

I think that not using IBAction is a good solution in this case but anyway there is a workaround how to achieve your goal. For this workaround you need to declare a variable typed boolean to check wether user is ready to login. Your shouldPerformSegueWithIdentifier method should always return value...

Redirect a View with Push Notification in AppDelegate

ios,swift,cocoa-touch,push-notification,uistoryboardsegue

The answer code is Objective-C, I want to talk about logic. To do this, when you are creating your push notification, you must set userInfo value to pass data with your push notification. Use this delegate method : application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler You can decide if which view...

How to create segue connection b/w tableview and view programmatically?

ios,objective-c,uistoryboard,uistoryboardsegue

Instead of connecting and creating segue from individual cells, you can connect all those segues from the View Controller button, lying below your view in your storyboard. In this case, you will have multiple segues and none of them will be individually connected to cells. And when segues are ready,...

Swift: Force show Navigation Bar in Modal

swift,segue,uistoryboard,uistoryboardsegue

Try to create the Segue to a Navigation controller instead of your view controller. Navigation bars are only shown for view controllers in a navigation stack. In your case, the source view controller seems to be in a navigation stack but not the presented view controller. Try something like this:...

Issue with connecting a present viewController to nextViewController

swift,uistoryboardsegue

To create a segue, you need to control+click from the trigger of the segue (button, link, etc.) to the new view controller. A view controller cannot trigger a segue. In keeping with the tutorial, try control+drag from the menu button to the target VC. That will solve your problem, but...

Orientation doesn't change after Pushing (push segue) a View on the UINavigationViewController

ios,uinavigationcontroller,orientation,uistoryboardsegue

Try this code : In AppDelegate.m class write below code. #pragma mark Orientation Code - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { NSUInteger orientations = UIInterfaceOrientationMaskAll; if (self.window.rootViewController) { UIViewController* presented = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject]; orientations = [presented supportedInterfaceOrientations]; } return orientations; } And next if you don't want orientation of...

Deinit not called on Show Detail segue

ios,swift,ios8,uistoryboard,uistoryboardsegue

If you're not using a navigation controller or a split view controller, then a "Show Detail" segue is the same as a modal presentation. A controller that presents another keeps a reference to it in its presentedViewController property (and the presented controller has a reference to the presenter in its...

Dropdown and bounce Segue anitimation

ios,uistoryboardsegue

You need a custom transition using UIKit Dynamics to perform the animation.

Difference between unwind segue and delegation

ios,objective-c,xcode,delegates,uistoryboardsegue

Using an unwind segue is very similar to having a delegate, with the following advantages: You don't need to implement any dismiss logic You don't need to pass references up and down the navigation stack You don't need to declare a delegate protocol It's trivial to unwind back a number...

Unwinding a segue on interface builder

ios,interface-builder,uistoryboardsegue

A method with with a particular signature, an IBAction with an argument of type UIStoryboardSegue, needs to be in the controller that you are unwinding to. That (and any other methods like it that you might have in other controllers) will show up in the exit button (of the controller...

Storyboard controller initialisation, where can I place pre-init code?

ios,xcode,uiviewcontroller,uistoryboard,uistoryboardsegue

you can set the LoginViewcontroller as initial viewcontroller and if the user is logged in change the initial viewcontroller to something else, you can change the initial view controller by changing the rootViewController property of the window

Getting nil when preparing for segue to navigation controller

xcode,swift,segue,uistoryboardsegue

I have a table view segueing to a navigation controller, which then segues to my own custom view controller under it. I believe that is your problem. The connection from the Navigation Controller to your Detail View Controller isn't a normal segue. It should be a Relationship Segue. Click...

How to connect two view controllers with one button?

ios,objective-c,viewcontroller,uistoryboardsegue

You can do that using code - Create IBAction method for Search Button UIControlEventTouchUpInside event. Now check user SignIn or SignOut within IBAction method and push respective viewController using below code SignINViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"SignINViewController"]; [self.navigationController pushViewController:controller animated:YES]; Don't forgot to provide Storyboard ID & Restoration ID for your...

iOS - segue from alert view is not being called

ios,objective-c,uiviewcontroller,uialertview,uistoryboardsegue

It looks like your UIAlertView has a delegate of nil so your function is never being called. Set that to self and then in your view controller's header make sure you're implementing the UIAlertViewDelegate protocol.

Swift - How do I segue from ViewController to TabBarController

xcode,swift,uistoryboardsegue

1. Control-drag from yellow symbol (ViewController) to the TabBarController This will create a segue in your ViewController menu 2. Click this new segue "Show segue to Tab..." and in identity inspector set an identifier name. 3. Now when you want to make the segue happen, use call... performSegueWithIdentifier("WhatEveryYouNamedSegue", self) ...

Image and text field boarders doesn't load fast

ios,swift,storyboard,segue,uistoryboardsegue

I found a solution. The App checks on the server if the user is already logged in or not (function: isLoggedIn). If he is not logged in the performSegueWithIdentifier function is called to show the login View. The problem was that the my code calls performSegueWithIdentifier in a closure (success...

Navigation to previous scene on iOS 8

ios,ios8,uistoryboardsegue

Unwind segues are different to forward segues and this makes it quite simple to support the functionality you are after. Prior to creating an unwind segue you need to add a method to the view controller that you want to unwind to. For example - - (IBAction)unwindFromLogin:(UIStoryboardSegue*)sender { } You...

How to dismiss segue ios8

objective-c,ios8,uistoryboardsegue

According the documentation dismissViewControllerAnimated Dismisses the view controller that was presented modally by the receiver. So this works for modally presented controllers, for navigation stacks, use unwind segues instead....

Passing data between several view controllers [duplicate]

ios,objective-c,uiviewcontroller,singleton,uistoryboardsegue

Singleton is NOT the perfect way, as it messes up your memory management easily. Same with NSUserDefaults (+ it only eats certain classes and persists data that probably shouldn't be persisted). Just pass the object from view controller to view controller. if you find 7 view controllers to difficult to...

prepareForSegue not opening ViewController

ios,segue,uistoryboardsegue

Make sure you are 100% certain of segue.identifier: Modify print("Identifier: FBLoggedInSegue") to display the actual identifier, otherwise you are working off assumptions. Have you set the ID on the view you wish to segue to or or the actual segue line in the Interface Builder? Hope this helps :) EDIT:...

when to use show Segues & when to use Show detail Segues [closed]

ios,xcode,uistoryboard,uistoryboardsegue

Show segue can be used with navigation controllers, they simply push viewControllers on your stack. Show detail segue has only sense with split view controllers. Since you have two viewControllers inside your split view controller you can: navigate in your master view controller by presenting (pushing, since the default project...

iOS State preservation and restoration when data shared between view controllers

ios,uistoryboard,uistoryboardsegue,state-restoration

Because the view controllers are restored in order, starting with the root, I found it's actually pretty simple to do what I asked. First, get the index of the current view controller in the Navigation controller. From that, figure out which view controller came before. (If my Storyboard was more...

IOS - Segue - detect which image was clicked

ios,segue,uistoryboardsegue

There are a couple of ways to do this. First of all, UIButtons can actually have a background image, which you could set to your various images. If you're intent on using a UIImageView, you would have to implement its touch event receiving method and handle it yourself. Either way,...

How to use SWRevealVC with didSelectRowAtIndexPath and prepareForSegue?

ios,uitableview,uistoryboardsegue,didselectrowatindexpath,swrevealviewcontroller

//in prepareForSegue method NSIndexPath *indexPath = [tableView indexPathForSelectedRow]; and you can get selected row value by using indexPath.row ...

iOS: Disable all touches for some time after calling 'prepareForSegue:'

ios,touch,transition,uistoryboardsegue

UIApplication offers you beginIgnoringInteractionEvents and endIgnoringInteractionEvents so you can disable all touch event handling during certain times (like a view transition). Be sure to call endIgnoringInteractionEvents once for each time you call beginIgnoringInteractionEvents....

Dismis showDetailViewController swift

swift,ios8,segue,uistoryboardsegue

You can close it pretty easy by using dismissViewControllerAnimated on the UIViewController you want to dismiss: navegador.dismissViewControllerAnimated(true, completion: nil) Maybe you need to make the NavegadorViewController a global variable, so that you can access it from another method....

How to navigate different classes using storyboard [duplicate]

ios,objective-c,storyboard,uistoryboardsegue

check this , i think what you want is similar to this. -(IBAction)buttonAction:(id)sender{ int randomNumber= arc4random() % 3; switch (randomNumber) { case 0: [self performSegueWithIdentifier:@"segue1" sender:sender]; break; case 1: [self performSegueWithIdentifier:@"segue2" sender:sender]; break; case 2: [self performSegueWithIdentifier:@"segue3" sender:sender]; break; default: break; } } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier...

How to use prepareSegue method in storyboard? [closed]

ios,segue,uistoryboardsegue

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSIndexPath *indexPath = [self.myTableView indexPathForSelectedRow]; ThirdViewController *destViewController = (ThirdViewController *)segue.destinationViewController; destViewController.displayTitlesArray = [[NSArray alloc]initWithObjects:@"first ",@"second",@"Third", nil ];} ...

Supporting custom and default unwind segues

ios,cocoa-touch,uistoryboard,uistoryboardsegue

Well, I figured out the issue. Ends up that the super method is alright, the problem lies on a UINavigationController subclass that I made that forwards the call to this view controller. To fix it, I added a protocol that any view controller can implement, and basically asks if it...

Unwind Segue with UITableViewCell in Xamarin.iOS

ios,uitableview,xamarin,uistoryboardsegue

Ok. I'm a little embarrassed at my error here. I hadn't created an outlet for my UITableView and was instead using a tableview that I had created and added through code in my ViewController. Therefore the "Scene Exit" that I hooked up to the UITableViewCell on my storyboard was never...

How do I set the size of UITableView as a subview in a Container View with Auto-layout

ios,uitableview,uiview,autolayout,uistoryboardsegue

You just have to create a a CGRect (frame) and set it to the views frame: dst.view.frame = CGRectMake( CGRectGetMinX(self.view.frame), CGRectGetMinY(self.view.frame), CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame); the values should be float values. This is just an example....

Swift - Segue to a specific view if conditions met

ios,swift,uiviewcontroller,parse.com,uistoryboardsegue

The way I usually accomplish this, and this applies to apps both with and without tab bars, is to have some kind of requires authentication flag in the destination view controller, and if the user isn't logged in, present the login screen modally. e.g. inside the friends list view controller...

How to detect whether show (push) segue navigation controller is pressed?

ios,objective-c,segue,uistoryboardsegue

You can work on the viewWillDisappear method on your second view controller like this: - (void)viewWillDisappear:(BOOL)animated { if(self.isMovingFromParentViewController){ NSLog(@"Controller being popped"); } } In this case, self.isMovingFromParentViewController will be true if the controller is being popped. You can also check for self.isMovingToParentViewController on viewWillAppear for example, to check that the...

segueForUnwindingToViewController causing “Warning: Attempt to present <…> on <…> which is already presenting <…>”

ios,swift,segue,uistoryboardsegue,unwind-segue

Created Sample code for unwind segue with above transition animation code. Checkout SampleUnwind project that will help you to understand unwind segue(and how simple it is). In project there is one navigation controller and inside it there are three view controller (Home->First->second). In Home controller following unwind action is created,...

Are Storyboards a good idea for apps that access the cloud? [closed]

ios,xcode,uistoryboardsegue

You have to remember that Storyboards are not an alternative to code. They are a tool that can be used along with coded view, nibs, etc... The real skill comes in using all of these in such a way that takes least effort and gives most maintainability, readability and reliability....

NSFetchedResultsController causes delayed segue

ios,core-data,delay,nsfetchedresultscontrolle,uistoryboardsegue

The problem is that you are using CoreData to store your pictures and apple does not. Though there is no limit on file size and on the total size your library can use it will take longer to get your files than opening a folder in the file structure. This...

Swift use prepareForSegue in indexPath

ios,uitableview,swift,uistoryboard,uistoryboardsegue

yes. i found it. This problem is optional. :( let indexPath = self.categoryTableView.indexPathForSelectedRow()**!** I put the exclamation point on the end of the line and correct. safe method; if let indexPath = categoryTableView.indexPathForSelectedRow() { // do the work here } ...

Storyboard: 'Subclasses of UIStoryboardSegue must override -perform.'

ios,storyboard,xcode6,uistoryboardsegue

I have found the solution. For creating custom segue like above, We require to subclass UIStoryBoardSegue class and override the method perform. Below is the code that i have implemented. #import "MyCustomSegue.h" @implementation MyCustomSegue - (void)perform { UIViewController *source = self.sourceViewController; UIViewController *destination = self.destinationViewController; UIWindow *window = source.view.window; CATransition...

Replace-root-view-controller custom segue with animation?

ios,objective-c,storyboard,segue,uistoryboardsegue

There are numerous ways you could add a "nice animation". Here is an example of a sort of card shuffle animation where one view moves up and left, while the other moves down and right, then reverses after changing the z-order of the two views. This implementation inserts the destination...

unwind inside containerViewController has no animation

ios,uistoryboardsegue,uianimation,uicontainerview,unwind-segue

Adding a transition definition solved it for me: CATransition *transition = [CATransition animation]; transition.duration = 0.4; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromLeft; [self.navigationController.view.layer addAnimation:transition forKey:nil]; [self.navigationController popViewControllerAnimated:YES]; ...

SWIFT pass value to another existed ViewController

ios,uitableview,swift,uiviewcontroller,uistoryboardsegue

I found it. You need to use delegates. Look here: http://makeapppie.com/2014/07/01/swift-swift-using-segues-and-delegates-in-navigation-controllers-part-1-the-template/

Unable to pass url string when segue perform using AMSlideMenu?

ios,objective-c,segue,uistoryboardsegue,amslidemenu

I got over the problem by using NSUserDefaults temporarily but still it not a proper solution. Still looking for a proper method to pass parameters b/w classes.

iOS Swift issue with UIStoryBoardSegue method

ios,swift,uistoryboardsegue,ios8

The correct pattern to use when accessing the destinationViewController in Objective C or Swift is to cast it to the correct subclass type. This will then allow you to access the subclasses methods and properties. So you should say let myDestVC = segue.destinationViewController as MyViewControllerClass Or in Objective C MyViewControllerClass...

Unbalanced calls to begin/end appearance transitions with custom segue

ios,swift,uistoryboardsegue

Looks like this behaviour is the result of some - as of yet - undocumented change in recent iOS releases. Getting frustrated with your exact issue and the lack of satisfying answers I've come up with this: // create a UIImageView containing a UIImage of `view`'s contents func createMockView(view: UIView)...

Added navigation bar but there is no back button?

ios,uitableview,swift,segue,uistoryboardsegue

Embed the TableViewController inside the NavigationController. Not the DetailViewController directly. Check out the screenshot. Make sure, that the segue, connecting your TableViewController and your DetailViewController is of type Show (e.g. Push). You have to literally push a new View on top of the Navigationstack. ...

how to load different data into the table view from different arrays depending on what row is clicked using storyboards on iOS7?

ios,iphone,uitableview,ios7,uistoryboardsegue

First, let me simplify your code -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { PetsTableViewController *pets = [[PetsTableViewController alloc]initWithNibName:@"PetsTableViewController" bundle:nil]; if([petsArray[indexPath.row] isEqualToString:@"Dog"]) { pets.petsInt = 0; [pets setTitle:petsArray[indexPath.row]]; } if([petsArray[indexPath.row] isEqualToString:@"Cat"]) { pets.petsInt = 1; [pets setTitle:petsArray[indexPath.row]]; } if([petsArray[indexPath.row]...

Push segue from UITableViewCell to ViewController in Swift

ios,iphone,uitableview,swift,uistoryboardsegue

The problem is that you're not handling your data correctly. If you look into your currentResponse Array, you'll see that it holds NSDictionaries but in your prepareForSegue you try to cast a NSDictionary to a NSArray, which will make the app crash. Change the data variable in RestaurantViewController to a...

Show last viewed product view when user interact with push notification (ios)

ios,objective-c,apple-push-notifications,segue,uistoryboardsegue

Simply send the product (or product ID and then look it up) to the destination view controller via a property: MyViewController* vc = (MyViewController*)[[UIStoryboard storyboardWithName: @"MyStoryboard" bundle: nil] instantiateViewControllerWithIdentifier: @"MyViewControllerIdentifier"]; //have to set the identifier in the storyboard vc.product = product; [self.navigationController pushViewController: vc animated: YES]; Inside MyViewController.h: (class names...

No “show” in the segue action list in Xcode 6.1

ios,iphone,xcode,swift,uistoryboardsegue

I'm going to go step by step for the process: Make a new project. I used Single View Application for iPhone. Add a second view controller to the storyboard (the panel on the left of the storyboard should look like this). If you don't see the panel click on the...

How do I segue from a UINavigationController to a UIViewController

ios,uiviewcontroller,uinavigationcontroller,uistoryboard,uistoryboardsegue

Embed your first view controller in a Navigation Controller. The reason you can't go back to your first view is because you have your second view embedded in a Navigation Controller, so there is not recognisable way back by using only storyboards; there is no further navigable way back to...