uistoryboardsegue

How to call a segue from a disclosure button on a map pin?

两盒软妹~` 提交于 2019-12-02 14:14:35
问题 I have an app that plots pins on a mapview. Each pin uses this code to display a detail disclosure button, which when tapped calls a showDetail method which then calls the prepareForSegue method. Im thinking there is a lot of extra work here. Should I eliminate the showDetail and just call the prepareForSegue method? but how would I pass in the MyLocation object? Here is the code: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static

Attempting to segue from Objective-C to Swift VC

放肆的年华 提交于 2019-12-02 14:10:14
问题 i'm trying to segue from objective-c to swift. However when I try this using the object below I receive the following error I don't know what i'm doing wrong, i've setup the segue on the storyboard and assigned it to the same ID, created the prepare function and the perform. - (void)renderer:(id<SCNSceneRenderer>)renderer willRenderScene:(SCNScene *)scene atTime:(NSTimeInterval)time { // Look for trackables, and draw on each found one. size_t trackableCount = trackableIds.size(); for (size_t

iOS Pass data back from viewController2 to viewController 1 with presentModalSegue

99封情书 提交于 2019-12-02 11:17:05
问题 I have viewController1 that makes a modal segue to my viewController2 but the viewController2 is embebed on a navigation controller because I need the navigation bar there. I've implemented a protocol to send the data back from viewController2 to viewController1 but it doesn't function. Here is my code: protocol writeValueBackDelegate { func writeValueBack(value: String) } class viewController1: UITableViewController, writeValueBackDelegate { override func prepareForSegue(segue:

Errors while using shouldPerformSegue(withIdentifier, sender) method in swift4

怎甘沉沦 提交于 2019-12-02 10:17:40
What I'm trying to do: checking a condition, if the condition is true, perform segue as normal. If condition is false, call the shouldPerformSegue method and return false to cancel the segue. How I'm trying to do this: func buttonTapped{ if(condition is true){ // Perform actions // Perform segue as normal } else{ shouldPerformSegue(withIdentifier "mySegueIdentifier", sender: self){ return false } } } Errors I am receiving: extra argument in call. I removed the sender parameter to try and get this to work, and it got rid of the errors for me, but the segue still performed when it shouldn't. I

Why not just set initial view controller for login screen like this?

丶灬走出姿态 提交于 2019-12-02 09:00:58
I've already read this and this questions. But I didn't understand why the code below is not enough. This just works. Do I need an else statement to set rootViewController for LoginViewController ? Isn't it already set by Storyboard? func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { if Settings.loggedIn { let mainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()) let mainViewController = mainStoryboard.instantiateViewControllerWithIdentifier("MainViewController") self.window?.rootViewController =

View transition doesn't animate during custom pop segue

大憨熊 提交于 2019-12-02 08:49:17
问题 I'm using a custom segue to create an expand animation when I push new view controllers onto my navigation stack. If no sourceRect is specified when prepareForSegue:sender: is called, then the destination view controller is expanded from the center of the source view controller. ExpandSegue.m: - (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination { self = [super initWithIdentifier:identifier source:source destination

Slowing Down Transition of Push Segue

孤街醉人 提交于 2019-12-02 07:37:43
I was wondering if there is a way to slow down 'push segue & back' like Tinder & Snapchat does. It's like normal segue but it's somehow transiting slowly. I normally handle push segues with setting up a Push notification on Storyboard and programatically calling the segue (clicked on NavBarItem and push segued to new UIViewController) : func settingsTapped() { performSegueWithIdentifier("NewsToSettings", sender: nil) } It there a way to enable slowing down segue globally for the whole app? or should I do it maually for each segue? If so, what is the appropriate way? I was wondering if there is

View transition doesn't animate during custom pop segue

只谈情不闲聊 提交于 2019-12-02 06:06:12
I'm using a custom segue to create an expand animation when I push new view controllers onto my navigation stack. If no sourceRect is specified when prepareForSegue:sender: is called, then the destination view controller is expanded from the center of the source view controller. ExpandSegue.m: - (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination { self = [super initWithIdentifier:identifier source:source destination:destination]; self.sourceRect = CGRectMake(source.view.center.x, source.view.center.y, 0.0, 0.0); return

How to call a segue from a disclosure button on a map pin?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 05:20:44
I have an app that plots pins on a mapview. Each pin uses this code to display a detail disclosure button, which when tapped calls a showDetail method which then calls the prepareForSegue method. Im thinking there is a lot of extra work here. Should I eliminate the showDetail and just call the prepareForSegue method? but how would I pass in the MyLocation object? Here is the code: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"MyLocation"; if ([annotation isKindOfClass:[MyLocation class]]) { //test if

iOS Pass data back from viewController2 to viewController 1 with presentModalSegue

核能气质少年 提交于 2019-12-02 05:09:27
I have viewController1 that makes a modal segue to my viewController2 but the viewController2 is embebed on a navigation controller because I need the navigation bar there. I've implemented a protocol to send the data back from viewController2 to viewController1 but it doesn't function. Here is my code: protocol writeValueBackDelegate { func writeValueBack(value: String) } class viewController1: UITableViewController, writeValueBackDelegate { override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "SelectAddress"{ if let dest = segue