Last active
July 16, 2018 07:35
-
-
Save andytlr/9bb208cb7d36b8914180 to your computer and use it in GitHub Desktop.
Revisions
-
andytlr revised this gist
Feb 9, 2016 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -78,6 +78,14 @@ let scrollTo = CGPointMake(0.0, 57.0) scrollView.setContentOffset(scrollTo, animated: true) ``` ## Perform a Segue Name your segue by clicking on the line that connects the views in your story board. Go to the Attribues Inspector and give your segue an Indetifier, e.g. `SegueName`. ```swift performSegueWithIdentifier("SegueName", sender: self) ``` ## Pass a variable on Segue In the view controller that you want to receive the variable, set an empty variable and give it a type. -
andytlr revised this gist
Nov 23, 2015 . 1 changed file with 31 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -133,3 +133,34 @@ if sender.state == .Ended { // Runs once when the gesture ends } ``` ## Send and Listen for Notifications Where you want to send the notification: ```swift NSNotificationCenter.defaultCenter().postNotificationName("Finished Saving To Camera Roll", object: nil) ``` If you're sending from a non-view file, you might need to wrap it in this to make sure it's on the main thread: ```swift dispatch_async(dispatch_get_main_queue()) { // } ``` Then add an 'observer'/listener in the view you want to know about the notification (probably in viewDidLoad): ```swift NSNotificationCenter.defaultCenter().addObserver(self, selector: "runWhenFinishedSavingToCameraRoll", name: "Finished Saving To Camera Roll", object: nil) ``` Then run the function with that selector at the class level: ```swift unc runWhenFinishedSavingToCameraRoll() { // Tell user it finished saving } ``` -
andytlr revised this gist
Nov 23, 2015 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,16 @@ # Swift Snippets ## Change Status Bar To make it light, put this inside the View Controller class: ```swift override func preferredStatusBarStyle() -> UIStatusBarStyle { return .LightContent } ``` Or to hide it completely: ```swift override func prefersStatusBarHidden() -> Bool { -
andytlr renamed this gist
Nov 14, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,14 @@ In the plist file, set `View controller-based status bar appearance` to `NO`. Th UIApplication.sharedApplication().statusBarStyle = .LightContent ``` ## Hide Status bar ```swift override func prefersStatusBarHidden() -> Bool { return true } ``` ## Make a scroll view with a big image scroll Tell the scrollView to be the same size as the imageView: @@ -80,10 +88,10 @@ In Source View Controller: ```swift override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { // Set the destination view controller name at the end of this line. let destinationVC = segue.destinationViewController as! DestinationViewControllerClassName // Give it a value at the end of this line. destinationVC.emptyVariableInDestinationViewController = thingIWantToSetItTo } ``` -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 0 additions and 89 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,89 +0,0 @@ -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 116 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,3 +7,119 @@ In the plist file, set `View controller-based status bar appearance` to `NO`. Th ```swift UIApplication.sharedApplication().statusBarStyle = .LightContent ``` ## Make a scroll view with a big image scroll Tell the scrollView to be the same size as the imageView: ```swift scrollView.contentSize = imageView.frame.size ``` Or, set it to a pixel size: ```swift scrollView.contentSize = CGSize(width:375, height:1857) ``` ## Control a child view controller from a parent. Define the first `[0]` of the child view controllers with the class name `ChildViewControllerClassName` as a variable childVC: ```swift let childVC = self.childViewControllers[0] as! ChildViewControllerClassName ``` Put `childVC.` before the var you want to control from the child VC: ```swift childVC.thingToControl.alpha = 1 ``` ## Go Back in Code Dismiss a modal: ```swift dismissViewControllerAnimated(true, completion: nil) ``` Go back in the history stack: ```swift navigationController!.popViewControllerAnimated(true) ``` ## Do stuff when going back to a view `viewDidLoad()` only runs the first time a view loads. If you want to do something when you pop a view try `viewDidAppear()` or `viewWillAppear()`. ```swift override func viewDidAppear(animated: Bool) { } ``` ## Set scroll position ```swift let scrollTo = CGPointMake(0.0, 57.0) scrollView.setContentOffset(scrollTo, animated: true) ``` ## Pass a variable on Segue In the view controller that you want to receive the variable, set an empty variable and give it a type. ```swift var emptyVariableInDestinationViewController: Bool! ``` In Source View Controller: ```swift override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { // Set the destination view controller name at the end of this line. let destinationVC = segue.destinationViewController as! DestinationViewControllerClassName // Give it a value at the end of this line. destinationVC.emptyVariableInDestinationViewController = thingIWantToSetItTo } ``` ## Autolayout getting f-d up? In `viewDidLoad()`: ```swift self.automaticallyAdjustsScrollViewInsets = false ``` ## Get scroll position See [this commit](https://github.com/andytlr/dropbox-carousel/commit/be0ed5dcdc50491995c9e4e1d43e7e21e4ae7dfa). ## Gesture recognizer stuff Most common properties in a gesture. These are `CGPoints`, add `.x` or `.y` for axis: ```swift let location = sender.locationInView(view) let translation = sender.translationInView(view) let velocity = sender.velocityInView(view) ``` These states go inside the gesture recognizer method: ```swift if sender.state == .Began { // Runs once on start of gesture } if sender.state == .Changed { // Runs constantly as the gesture changes } if sender.state == .Ended { // Runs once when the gesture ends } ``` -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Swift Snippets ## Set light status bar In the plist file, set `View controller-based status bar appearance` to `NO`. Then in viewDidLoad(): ```swift UIApplication.sharedApplication().statusBarStyle = .LightContent ``` -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Xcode has something called "Edit All in Scope" (`ctrl` + `cmd` + `e`). It's simi There aren't actually commands for Delete Line and Duplicate Line, but you can edit a plist file to chain multiple actions together into one command. After editing the `.plist` you can add a shortcuts in `Settings` > `Keybindings`. Open `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist` and put this before the closing `</dict>` and `</plist>` tags: ```xml <key>Custom</key> -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Make Xcode Editing More Like Atom/Sublime Go to `Settings` > `Keybindings` to remap or add keyboard shortcuts. When removing existing keybindings, don't press the keyboard Delete key, click the `–` icon. Some keybindings can't be deleted `¯\_(ツ)_/¯`; remap these to keybindings that are available. ## Multiple Selection @@ -26,8 +26,6 @@ Path: `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/ID </dict> ``` ## Move Line There are commands for Move Line Up and Move Line Down (`cmd` + `option` + `[`/`]`). -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,16 @@ # Make Xcode Editing More Like Atom/Sublime Go to `Settings` > `Keybindings` to remap or add keyboard shortcuts. When removing existing keybindings, don't press the keyboard Delete key, click the `–` icon. ## Multiple Selection Xcode has something called "Edit All in Scope" (`ctrl` + `cmd` + `e`). It's similar but just selects all instances of the selected text. ## Open Quickly `command` + `shift` + `o` ## Delete Line & Duplicate Line There aren't actually commands for Delete Line and Duplicate Line, but you can edit a plist file to chain multiple actions together into one command. After editing the `.plist` you can add a shortcuts in `Settings` > `Keybindings`. @@ -28,10 +28,10 @@ Path: `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/ID Detailed [instructions here](http://stackoverflow.com/questions/5834096/how-do-i-create-a-delete-line-keyboard-shortcut-in-xcode-6-the-xcode-3-solution). ## Move Line There are commands for Move Line Up and Move Line Down (`cmd` + `option` + `[`/`]`). ## More shortcuts This [NSHipster Article](http://nshipster.com/xcode-key-bindings-and-gestures/) covers a lot of other shortcuts. -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,3 +31,7 @@ Detailed [instructions here](http://stackoverflow.com/questions/5834096/how-do-i ### Move Line There are commands for Move Line Up and Move Line Down (`cmd` + `option` + `[`/`]`). ### More shortcuts This [NSHipster Article](http://nshipster.com/xcode-key-bindings-and-gestures/) covers a lot of other shortcuts. -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,18 @@ ## Make Xcode Editing More Like Atom/Sublime Go to `Settings` > `Keybindings` to remap or add keyboard shortcuts. When removing existing keybindings, don't press the keyboard Delete key, click the `–` icon. ### Multiple Selection Xcode has something called "Edit All in Scope" (`ctrl` + `cmd` + `e`). It's similar but just selects all instances of the selected text. ### Open Quickly `command` + `shift` + `o` ### Delete Line & Duplicate Line There aren't actually commands for Delete Line and Duplicate Line, but you can edit a plist file to chain multiple actions together into one command. After editing the `.plist` you can add a shortcuts in `Settings` > `Keybindings`. Path: `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist` @@ -17,6 +21,8 @@ Path: `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/ID <dict> <key>Delete Line</key> <string>moveToEndOfLine:, deleteToBeginningOfLine:, deleteToEndOfParagraph:</string> <key>Duplicate Line</key> <string>moveToBeginningOfLine:, deleteToEndOfLine:, yank:, insertNewline:, moveToBeginningOfLine:, yank:</string> </dict> ``` -
andytlr revised this gist
Nov 14, 2015 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ ## Make Xcode Editing More Like Atom/Sublime Go to `Settings` > `Keybindings` to remap or add keyboard shortcuts. ### Multiple Selection Xcode has something called "Edit All in Scope" (`ctrl` + `cmd` + `e`). It's similar but just selects all instances of the selected text. ### Delete Line There isn't actually a Delete Line command but you can edit a plist file to chain three actions together into one command. Edit the plist, then you can add a shortcut in `Settings` > `Keybindings`. Path: `/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist` ```xml <key>Custom</key> <dict> <key>Delete Line</key> <string>moveToEndOfLine:, deleteToBeginningOfLine:, deleteToEndOfParagraph:</string> </dict> ``` Detailed [instructions here](http://stackoverflow.com/questions/5834096/how-do-i-create-a-delete-line-keyboard-shortcut-in-xcode-6-the-xcode-3-solution). ### Move Line There are commands for Move Line Up and Move Line Down (`cmd` + `option` + `[`/`]`). -
andytlr revised this gist
Nov 5, 2015 . 1 changed file with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,3 +64,26 @@ override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { //////////////////////////////////////////////////////////////////////////////// self.automaticallyAdjustsScrollViewInsets = false // in view did load // Get scroll position //////////////////////////////////////////////////////////////////////////////// // See this commit: https://github.com/andytlr/dropbox-carousel/commit/be0ed5dcdc50491995c9e4e1d43e7e21e4ae7dfa // Gesture recognizer stuff //////////////////////////////////////////////////////////////////////////////// // Most common properties in a gesture. These are CGPoints, add .x or .y for axis. let location = sender.locationInView(view) let translation = sender.translationInView(view) let velocity = sender.velocityInView(view) // States (go inside the gesture recognizer method) if sender.state == .Began { // Runs once on start of gesture } if sender.state == .Changed { // Runs constantly as the gesture changes } if sender.state == .Ended { // Runs once when the gesture ends } -
andytlr revised this gist
Oct 27, 2015 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ UIApplication.sharedApplication().statusBarStyle = .LightContent // Make a scroll view with a big image scroll //////////////////////////////////////////////////////////////////////////////// // Tell the scrollView to be the same size as the imageView. scrollView.contentSize = imageView.frame.size @@ -31,6 +31,14 @@ dismissViewControllerAnimated(true, completion: nil) navigationController!.popViewControllerAnimated(true) // Do stuff when going back to a view //////////////////////////////////////////////////////////////////////////////// // viewDidLoad() only runs the first time a view loads. If you push the pop a // view and want to run some code try viewDidAppear() or viewWillAppear() override func viewDidAppear(animated: Bool) { } // Set scroll position //////////////////////////////////////////////////////////////////////////////// let scrollTo = CGPointMake(0.0, 57.0) -
andytlr revised this gist
Oct 27, 2015 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,3 +50,9 @@ override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { // Give it a value at the end of this line. destinationVC.emptyVariableInDestinationViewController = thingIWantToSetItTo } // Autolayout getting f-d up? //////////////////////////////////////////////////////////////////////////////// self.automaticallyAdjustsScrollViewInsets = false // in view did load -
andytlr revised this gist
Oct 27, 2015 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,3 +36,17 @@ navigationController!.popViewControllerAnimated(true) let scrollTo = CGPointMake(0.0, 57.0) scrollView.setContentOffset(scrollTo, animated: true) // In viewDidLoad() to hide a search bar or something like that. // Pass a variable on Segue //////////////////////////////////////////////////////////////////////////////// // In the view controller that I want to receive the variable, // set an empty variable and give it a type. var emptyVariableInDestinationViewController: Bool! // In Source View Controller override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { // Set the destination view controller name at the end of this line. let destinationVC = segue.destinationViewController as! DestinationViewControllerClassName // Give it a value at the end of this line. destinationVC.emptyVariableInDestinationViewController = thingIWantToSetItTo } -
andytlr revised this gist
Oct 26, 2015 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,3 +29,10 @@ childVC.thingToControl.alpha = 1 dismissViewControllerAnimated(true, completion: nil) // Go back in the history stack. navigationController!.popViewControllerAnimated(true) // Set scroll position //////////////////////////////////////////////////////////////////////////////// let scrollTo = CGPointMake(0.0, 57.0) scrollView.setContentOffset(scrollTo, animated: true) // In viewDidLoad() to hide a search bar or something like that. -
andytlr revised this gist
Oct 26, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,15 @@ // Set light status bar //////////////////////////////////////////////////////////////////////////////// // In the plist file, set `View controller-based status bar appearance` to `NO` // Then in viewDidLoad() UIApplication.sharedApplication().statusBarStyle = .LightContent // Set a scroll view to the height of an image view //////////////////////////////////////////////////////////////////////////////// // Tell the scrollView to be the same size as the imageView. scrollView.contentSize = imageView.frame.size // Or, set it to a pixel size. scrollView.contentSize = CGSize(width:375, height:1857) -
andytlr revised this gist
Oct 26, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ UIApplication.sharedApplication().statusBarStyle = .LightContent // In the plist file, set `View controller-based status bar appearance` to `NO` // Set a scroll view to the height of an image view //////////////////////////////////////////////////////////////////////////////// scrollView.contentSize = imageView.frame.size @@ -19,6 +20,7 @@ let childVC = self.childViewControllers[0] as! ChildViewControllerClassName // put `childVC.` before the var you want to control from the child VC. childVC.thingToControl.alpha = 1 // Go Back in Code //////////////////////////////////////////////////////////////////////////////// // Dismiss a modal -
andytlr revised this gist
Oct 26, 2015 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,3 +18,10 @@ scrollView.contentSize = CGSize(width:375, height:1857) let childVC = self.childViewControllers[0] as! ChildViewControllerClassName // put `childVC.` before the var you want to control from the child VC. childVC.thingToControl.alpha = 1 // Go Back in Code //////////////////////////////////////////////////////////////////////////////// // Dismiss a modal dismissViewControllerAnimated(true, completion: nil) // Go back in the history stack. navigationController!.popViewControllerAnimated(true) -
andytlr revised this gist
Oct 24, 2015 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,20 @@ // Set light status bar //////////////////////////////////////////////////////////////////////////////// UIApplication.sharedApplication().statusBarStyle = .LightContent // In the plist file, set `View controller-based status bar appearance` to `NO` // Set a scroll view to the height of an image view //////////////////////////////////////////////////////////////////////////////// scrollView.contentSize = imageView.frame.size // Or set it to a pixel size scrollView.contentSize = CGSize(width:375, height:1857) // Control a child view controller from a parent. //////////////////////////////////////////////////////////////////////////////// // Define the first `[0]` of the child view controllers with the class name // ChildViewControllerClassName as a variable childVC. // Won't always need the `self.` let childVC = self.childViewControllers[0] as! ChildViewControllerClassName // put `childVC.` before the var you want to control from the child VC. childVC.thingToControl.alpha = 1 -
andytlr revised this gist
Oct 24, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,17 @@ // Set light status bar ///////////////////////////////////////////////////////////////////////////////////// UIApplication.sharedApplication().statusBarStyle = .LightContent // In the plist file, set `View controller-based status bar appearance` to `NO` // Set a scroll view to the height of an image view ///////////////////////////////////////////////////////////////////////////////////// scrollView.contentSize = imageView.frame.size // Or set it to a pixel size scrollView.contentSize = CGSize(width:375, height:1857) // Control a child view controller from a parent. ///////////////////////////////////////////////////////////////////////////////////// // Define the first `[0]` of the child view controllers with the class name ChildViewControllerClassName as a variable childVC // Won't always need the `self.` let childVC = self.childViewControllers[0] as! ChildViewControllerClassName -
andytlr revised this gist
Oct 24, 2015 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,8 @@ // Set light status bar // UIApplication.sharedApplication().statusBarStyle = .LightContent // In the plist file, set `View controller-based status bar appearance` to `NO` // Set a scroll view to the height of an image view // scrollView.contentSize = imageView.frame.size -
andytlr revised this gist
Oct 24, 2015 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,12 @@ // Set a scroll view to the height of an image view // scrollView.contentSize = imageView.frame.size // Or set it to a pixel size scrollView.contentSize = CGSize(width:375, height:1857) // Control a child view controller from a parent. // // Define the first `[0]` of the child view controllers with the class name ChildViewControllerClassName as a variable childVC // Won't always need the `self.` let childVC = self.childViewControllers[0] as! ChildViewControllerClassName -
andytlr created this gist
Oct 24, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ // Control a child view controller from a parent. // Define the first `[0]` of the child view controllers with the class name ChildViewControllerClassName as a variable childVC // Won't always need the `self.` let childVC = self.childViewControllers[0] as! ChildViewControllerClassName // put `childVC.` before the var you want to control from the child view controller. childVC.thingToControl.alpha = 1