Visual Studio CodeでRubyデバッグを試してみました
Visual Studio CodeによるRubyのデバッグ | Developers.IOを参考にVisual Studio CodeでRubyのデバッグを試してみました。ウオッチ式、コールスタックが使えるので十分実用できそうです。
今まで、Rubyのデバッグ用にRubyMineを購入していたが、Visual Studio Codeで十分な気がしてきました。
Xcode8でコメント作成
Xcode8では、option + command + /で関数のコメントのひな形をを作成してくれます。便利。
リンク
UILabelのタップイベントを処理する
UILabelのタップイベントを処理して、ラベルに表示する値をアラートダイアログで入力する方法です。
UIラベルのisUserInteractionEnabledをtrueにして、touchesEndedで処理します。
class ViewController: UIViewController { let timerLabelTag = 10 @IBOutlet weak var timerLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() timerLabel.tag = timerLabelTag timerLabel.isUserInteractionEnabled = true } override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { for touch: UITouch in touches { let tag = touch.view!.tag if (tag == timerLabelTag) { // アラートダイアログで入力する let alert = UIAlertController(title: "タイマー時間セットアップ", message: "時間(秒)を入力してください", preferredStyle: .alert) let saveAction = UIAlertAction(title: "セット", style: .default) { (action:UIAlertAction!) -> Void in let textField = alert.textFields![0] as UITextField timerLabel = textField.text! } } let cancelAction = UIAlertAction(title: "キャンセル", style: .default) { (action:UIAlertAction!) -> Void in } // UIAlertControllerにtextFieldを追加 alert.addTextField { (textField:UITextField!) -> Void in } alert.addAction(saveAction) alert.addAction(cancelAction) present(alert, animated: true, completion: nil) } } } }
リンク
Excelを使って簡単にINSERT文を作る方法
今参加しているプロジェクトでは、データを挿入してテストすることがあるので、メモしておきます。 やっぱり、一つ一つInsert文を作成するより楽ですね。
リンク
iOS GameplayKitを使って見ました
@ITに、「iOS GameplayKitの「Agents, Goals, and Behaviors」で作る、鬼ごっごの鬼AI」という面白そうな記事がありましたので、試してみました。
GameplayKitを初めて使いましたが、簡単に使えるという印象を持ちました。 この連載には、AI的な要素もありそうで今後が楽しみです。