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
// | |
// ViewController.swift | |
// Problem_part5 | |
// | |
// Created by 久保田 将規 on 2015/03/12. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ViewController.swift | |
// Problem_part6 | |
// | |
// Created by 久保田 将規 on 2015/03/14. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit |
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 width:String = "240" | |
let height:String = "2" | |
let menseki = width.toInt()! * height.toInt()! | |
println("\(menseki)cm2") | |
//文字列型からDouble型への変換 | |
let r = 60 | |
let pai = "3.14" | |
//かけられる数もFloat型に直す必要あり |
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
//文字を検索して、文字列を取り出す | |
//Range型利用バージョン | |
let str = "海、空、陸、宇宙、地球" | |
let word = "宇宙" | |
let range:Range? = str.rangeOfString(word) | |
if let theRange = range { | |
let start = theRange.startIndex | |
let end = theRange.endIndex | |
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
//Array<配列>を使った配列 | |
var numList :Array<Int> = [12,13,14,15] | |
//配列の個数 | |
println(numList.count) | |
//空の配列と空の調査 | |
var theArray = [Int]() |
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
// | |
// PlusViewController.swift | |
// Problem_part7 | |
// | |
// Created by masakid on 2015/03/23. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit |
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
// | |
// MinusViewController.swift | |
// Problem_part7 | |
// | |
// Created by masakid on 2015/03/23. | |
// Copyright (c) 2015年 masaki.k. All rights reserved. | |
// | |
import UIKit |
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
import UIKit | |
class CommonProcess { | |
//他のタブから遷移したときにデータを移すメソッド | |
class func settingOtherTabData(label:UILabel, slider:UISlider){ | |
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate | |
if let value = appDelegate.commonSliderValue { | |
label.text = "\(appDelegate.commonSliderValue!)" | |
slider.value = appDelegate.commonSliderValue! |
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
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
var commonSliderValue: Float? | |
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
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var valueLabel: UILabel! | |
@IBOutlet weak var blueSlider: UISlider! | |
override func viewDidLoad() { | |
super.viewDidLoad() |