Skip to content

Commit

Permalink
[Examples] Add code screenshots to example screens
Browse files Browse the repository at this point in the history
  • Loading branch information
isair committed Dec 8, 2015
1 parent aa85b01 commit bc9ee47
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "PlainExampleCode.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions MobilePlayerExamples/ExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,33 @@
import UIKit

class ExampleViewController: UIViewController {
let codeImageView = UIImageView(frame: CGRectZero)
let showButton = UIButton(type: .System)
let videoURL = NSURL(string: "https://movielalavideos.blob.core.windows.net/videos/563cb51788b8c6db4b000376.mp4")!
let videoTitle = "Star Wars: Episode VII - The Force Awakens - International Trailer"

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.whiteColor()
view.addSubview(codeImageView)
showButton.setTitle("Show Player", forState: .Normal)
showButton.addTarget(self, action: "showButtonDidGetTapped", forControlEvents: .TouchUpInside)
view.addSubview(showButton)
}

override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
let size = view.frame.size;
codeImageView.sizeToFit()
codeImageView.frame.origin.x = (size.width - codeImageView.frame.size.width) / 2
codeImageView.frame.origin.y = (size.height - codeImageView.frame.size.height) / 2
showButton.sizeToFit()
showButton.frame.origin.x = (view.frame.size.width - showButton.frame.size.width) / 2
showButton.frame.origin.y = (view.frame.size.height - showButton.frame.size.height) / 2
codeImageView.frame.origin.y -= (showButton.frame.size.height + 8) / 2;
showButton.frame.origin.x = (size.width - showButton.frame.size.width) / 2
showButton.frame.origin.y = codeImageView.frame.origin.y + codeImageView.frame.size.height + 8
}

func showButtonDidGetTapped() {
print("not implemented")
fatalError("showButtonDidGetTapped() has not been implemented")
}
}
2 changes: 0 additions & 2 deletions MobilePlayerExamples/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down
1 change: 1 addition & 0 deletions MobilePlayerExamples/PlainExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class PlainExampleViewController: ExampleViewController {
init() {
super.init(nibName: nil, bundle: nil)
title = "Plain"
codeImageView.image = UIImage(named: "PlainExampleCode")
}

required init?(coder aDecoder: NSCoder) {
Expand Down

0 comments on commit bc9ee47

Please sign in to comment.