CloudFlareのmod_cloudflareのupdate
確認
ls -al /etc/httpd/conf.d/cloudflare.conf
更新
sudo rpm --import http://pkg.cloudflare.com/pubkey.gpg yum update mod_cloudflare
xcode / first pointが消えて追加したい時
"View Controller" 項目の "Initial Scene" の "Is Initial View Controller”をチェックで復活。
swift / appdeligateでページ越しで共通変数を使う
AppDelegate.swiftとは?
アプリをつくった段階でデフォルトでつくられるファイルのひとつ。
アプリ全体のライフタイムイベントを管理するためのクラス。
http://qiita.com/SoyaTakahashi/items/cc8f48af792c353cd9f3
共通関数やら変数をページ越しで管理するときとかに使うとよさげ
例
appdeligate.swift
class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var stampArray:[Stamp] = []; var isNewStampAdded = false
viewController.swift
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate //配列stampArrayにstampを追加 appDelegate.stampArray.append(stamp) //新規スタンプ追加フラグをtrueに設定 appDelegate.isNewStampAdded = true
swift / modalで開いた画面を閉じる
@IBAction func closeTapped(){ self.dismissViewControllerAnimated(true, completion: nil); }
swift / URLエンコード
let query = "ニュース"; let encoded = query.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet()) let url = "https://ajax.googleapis.com/ajax/services/search/news?v=1.0&hl=ja&rsz=8&q=" + encoded!;
swift / 文字列置換
- <b>タグを抜く例
var title = newsDic["title"] as? String; title = title?.stringByReplacingOccurrencesOfString("<b>", withString: ""); title = title?.stringByReplacingOccurrencesOfString("</b>", withString: "");
xcode / httpサイトを見れるようにする設定
- プロジェクトアイコンをクリックして、設定画面から「Info」のタブ
- [+] App Transport Security Settings を追加
- その中に、[+] Allow Arbitrary Loads で Boolean を True