segue

When I should use Navigation Controller?

让人想犯罪 __ 提交于 2019-12-03 03:51:29
问题 I don't know when I should use Navigation Controller instead of use segue with normal View Controller? And if use segue, which different between Modal and Push segue? Can you give me an example? 回答1: Short answer: Use a Navigation Controller with "show" segues only to implement DRILL DOWN behavior. For example, Navigation Controller → Authors → Books → Book For each level below the "root" (Authors), the Navigation Controller automatically adds the title bar and back button. So on Books, the

Passing Data Through Segue (swift 2)

南笙酒味 提交于 2019-12-03 00:37:40
问题 This is a Tip Calculator Project and It must have a settings view where I select the default tip rate. I have some issues with passing data, when I select a default tip percentage it doesn't change in the View Controller, also I want to make the app remember the default rate when I close the app and reopened. I will really appreciate that some one corrects my code and test it. This is for entering a Computer Science Program in college, I don't have previous experience with any programming

prepareForSegue and PerformSegueWithIdentifier sender

橙三吉。 提交于 2019-12-02 21:21:47
I am wondering about how the functions in the title work and also about the sender parameter. Lets say a button click calls the performSegue method, does that also call the prepareSegue method as well? Is the prepareSegue method called before the performSegue method but after the button is pressed? Also, is the "sender" parameter in both of the functions linked? If I pass in a string as the sender in the performSegue method, will that transfer over to the sender parameter in the prepareSegue method? In other words, if I set the sender parameter in the performSegue method as "Hi world", will

iOS: Make segue wait for login success

こ雲淡風輕ζ 提交于 2019-12-02 20:59:07
I am designing an iOS app using XCode 4.2's storyboard feature. The app has a login screen that takes a username and password and has a button to log in. Pushing the login button triggers a push seque to another view controller. However, I want the seque to wait until the login comes back successful before proceeding to the next view controller. I know about prepareForSegue:sender: but heres my issue: the login call is asynchronous. I therefore cannot perform the login there. Is there someway around this? Can I create a seque in the storyboard that is only triggered when I want it to be (as

Slowing Down Transition of Push Segue

流过昼夜 提交于 2019-12-02 20:48:05
问题 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

Xcode Swift 3: Timer and Segue View Controller Error

懵懂的女人 提交于 2019-12-02 19:54:17
问题 This code is in ViewController 1. goToMainUI is assigned to the segue connection ID between ViewController 1 and 2. Also, the storyboard ID for ViewController 2 is the same (goToMainUI). After the timer is finished, there is an error and the ViewControllers do not switch. Anyone know what the problem is? Thanks! override func viewDidLoad() { super.viewDidLoad() let timer = Timer.scheduledTimerWithTimeInterval(8.0, target: self, selector: #selector(timeToMoveOn), userInfo: nil, repeats: false)

When I should use Navigation Controller?

让人想犯罪 __ 提交于 2019-12-02 18:07:56
I don't know when I should use Navigation Controller instead of use segue with normal View Controller? And if use segue, which different between Modal and Push segue? Can you give me an example? Short answer: Use a Navigation Controller with "show" segues only to implement DRILL DOWN behavior. For example, Navigation Controller → Authors → Books → Book For each level below the "root" (Authors), the Navigation Controller automatically adds the title bar and back button. So on Books, the back button is automatically named "<Authors". The child View Controllers must be connected with SHOW segues

Passing array through segue in swift

一笑奈何 提交于 2019-12-02 17:26:50
问题 I've been struggling for a few days now with passing an array from my SecondViewController to my FirstViewController using Swift. From my research I found that segue with prepareForSegue would be a viable option but I can't seem to figure it out. What am I doing wrong? My prepareForSegue in SecondViewController looks like this: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { var DVC: FirstViewController = segue.destinationViewController as! FirstViewController

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

坚强是说给别人听的谎言 提交于 2019-12-02 17:20:08
问题 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

Pass data Through segue not working in swift 3 any solution?

拜拜、爱过 提交于 2019-12-02 16:55:03
问题 i have passed data from didselect method of collectionView like this func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let dicttemp = (arrRespProduct?.object(at: indexPath.row))! as! NSDictionary dicData = NSMutableDictionary(dictionary: dicttemp) performSegue(withIdentifier: GlobalConstant.segueIdentofier.productDetail, sender: self) } But method func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) is not calling in swift 3... Any