Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudifa/cassini_scroll_and_zoom
Learning about iOS app making with Swift (2017) from Professor Paul Hegarty of Stanford Univwersity.
https://github.com/rudifa/cassini_scroll_and_zoom
Last synced: 24 days ago
JSON representation
Learning about iOS app making with Swift (2017) from Professor Paul Hegarty of Stanford Univwersity.
- Host: GitHub
- URL: https://github.com/rudifa/cassini_scroll_and_zoom
- Owner: rudifa
- Created: 2018-07-27T15:29:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-02T16:13:20.000Z (over 6 years ago)
- Last Synced: 2024-10-06T01:40:46.158Z (about 1 month ago)
- Language: Swift
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cassini Scroll and Zoom
Ref. Stanford University course **Developing iOS 10 Apps in Swift** winter/spring 2017, taught by Paul Hegarty, **Lecture 7 Demo: Cassini**
Combines the use of IB and programmatical creation of app objects.
Shows the use of computed properties to encapsulate code that belongs together and to simplify the code in the ViewController's methods.
Vital parts:
```
@IBOutlet weak var scrollView: UIScrollView! {
didSet {
scrollView.delegate = self
scrollView.minimumZoomScale = 0.03
scrollView.maximumZoomScale = 1.0
scrollView.contentSize = imageView.frame.size
scrollView.addSubview(imageView)
}
}
``````
private var image: UIImage? {
get {
return imageView.image
}
set {
imageView.image = newValue
imageView.sizeToFit()
scrollView?.contentSize = imageView.frame.size
}
}
``````
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return imageView
}
```Continued in **Lecture 8** with a Master/SplitView controller, and queuing the image fetch on a global queue, to preserve the UI responsiveness.