This file contains 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 characters
class SomeViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.view.backgroundColor = UIColor.blueColor() | |
// ラベル | |
var label: UILabel = UILabel() |
This file contains 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 characters
let devices = AVCaptureDevice.devices() | |
for capDevice in devices { | |
if capDevice.position == AVCaptureDevicePosition.Back { | |
avDevice = capDevice as? AVCaptureDevice | |
} | |
} | |
// トーチオン | |
if avDevice.hasTorch | |
do { |
This file contains 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 characters
func renderView() { | |
/** | |
* ボタン | |
*/ | |
let buttonTake = UIButton(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width - 50, height: 50)) | |
buttonTake.backgroundColor = UIColor.init(colorLiteralRed: 0.3, green: 0.3, blue: 0.7, alpha: 0.5) | |
buttonTake.alpha = 0 | |
buttonTake.layer.cornerRadius = 5.0 |
This file contains 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 characters
// 画面になにか重ねて表示する | |
func renderView() { | |
/** | |
* ボタン | |
*/ | |
let buttonTake = UIButton(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width - 50, height: 50)) | |
buttonTake.backgroundColor = UIColor.init(colorLiteralRed: 0.3, green: 0.3, blue: 0.7, alpha: 0.5) | |
buttonTake.layer.cornerRadius = 5.0 | |
buttonTake.layer.masksToBounds = true |
This file contains 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 characters
class CameraViewController: UIViewController { | |
... | |
func renderView() { | |
// ボタン作成 | |
let buttonTake = UIButton(frame: CGRect.init(x: 0, y: 0, width: self.view.frame.size.width - 50, height: 50)) | |
buttonTake.backgroundColor = UIColor.init(colorLiteralRed: 0.3, green: 0.3, blue: 0.7, alpha: 0.5) | |
// 角丸 | |
buttonTake.layer.cornerRadius = 5.0 |
This file contains 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 characters
class ThirdViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// 1つ前のViewControllerを遷移リストから削除 | |
let parentIndex = (self.navigationController?.viewControllers.indexOf(self))! - 1 | |
self.navigationController?.viewControllers.removeAtIndex(parentIndex) | |
} |
This file contains 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 characters
class CameraViewController: UIViewController { | |
... | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// 角丸なLabelを作成 | |
let labelHello: UILabel = UILabel(frame: CGRectMake(0, 0, 300, 40)) | |
labelHello.layer.masksToBounds = true | |
labelHello.layer.cornerRadius = 5.0 | |
This file contains 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 characters
class MasterViewController: UITableViewController { | |
... | |
func doCamera(sender: AnyObject) { | |
let cameraViewController = CameraViewController() | |
self.navigationController?.pushViewController(cameraViewController, animated: true) | |
} | |
} | |
</code> |
This file contains 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 characters
class MasterViewController: UITableViewController { | |
... | |
override func viewDidLoad() { | |
... | |
let cameraButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Camera, target: self, action: "doCamera:") | |
... | |
} | |
... | |
func doCamera(sender: UIButton) { |
This file contains 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 characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
// ボタン達 | |
let addButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "insertNewObject:") | |
let cameraButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Camera, target: self, action: "insertNewObject:") | |
let myRightButtons = [addButton, cameraButton] | |
// テンプレはこうだった |
NewerOlder