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 parser(parser: NSXMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) { | |
if (elementName as NSString).isEqualToString(self.itemElementName) { | |
//各メンバ変数がnilでなければメンバ変数elementsへ「キー」と「値」のペアを格納 | |
if !self.name.isEqual(nil) { | |
self.elements.setObject(self.name, forKey: self.nameElementName) | |
} | |
if !self.maker.isEqual(nil) { |
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
//事前の準備としてtargetTextViewというUITextViewのインスタンスを作成。 | |
//配置したUITextViewのインスタンスに対してリンクを有効にする | |
self.targetTextView.dataDetectorTypes = .Link | |
//HTMLタグが混在している文字列に対してHTMLで表示させるようにする処理 | |
//※ "(ダブルクオーテーション)の前に、\(バックスラッシュ)をつけること | |
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
//先頭に追加したフレームワークのクラスをインポート宣言 | |
import Parse | |
import Bolts | |
(※途中省略) | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
// ----- 追加 ここから↓ ----- | |
// [Optional] Power your app with Local Datastore. For more info, go to |
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 scrollViewDidScroll(scrollview: UIScrollView) { | |
//コンテンツのスクロールのみ検知 | |
if scrollview.tag == ScrollViewTag.MainScroll.returnValue() { | |
//現在表示されているページ番号を判別する | |
let pageWidth: CGFloat = self.mainScrollView.frame.width | |
let fractionalPage: Double = Double(self.mainScrollView.contentOffset.x / pageWidth) | |
let page: NSInteger = lround(fractionalPage) |
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
Pod::Spec.new do |s| | |
s.name = "CalculateCalendarLogic" | |
s.version = "0.0.2" | |
s.summary = "This library CalculateCalendarLogic (sample project name is handMadeCalendarAdvance) can judge a holiday in Japan." | |
s.description = <<-DESC | |
This library 'CalculateCalendarLogic' can judge a holiday in Japan. | |
When you use this library, you can judge can judge a holiday in Japan very easily. | |
A method which named 'judgeJapaneseHoliday' method stores variables year, month, and day in an argument, it returns true or false. | |
DESC | |
s.homepage = "http://qiita.com/fumiyasac@github/items/33bfc07ad36dfffcdf8f" |
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
var data: NSData = NSData() | |
if let image = photoImageView.image { | |
data = UIImageJPEGRepresentation(image,0.1)! | |
} | |
let base64String = data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength) | |
let user: NSDictionary = ["name":name!,"dob":dateOfBirthTimeInterval, "photoBase64":base64String] | |
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
//「もっと他の画像を見る」ボタンのアクション | |
@IBAction func moreImageAction(_ sender: UIButton) { | |
transitionClosure!(nil) | |
} | |
//サムネイル画像のTapGesture発動時に実行されるメソッド | |
func tapGesture(sender: UITapGestureRecognizer) { | |
let targetNumber: Int = (sender.view?.tag)! | |
transitionClosure!(targetNumber) | |
} |
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 | |
import RxDataSources | |
//ラーメンデータ定義用の構造体(Model層) | |
struct Ramen { | |
//取得データに関する定義 | |
let name: String | |
let taste: String | |
let imageId: String |
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
enum APIKey: String { | |
case foresquare_clientid = "自分のクライアントID" | |
case foresquare_clientsecret = "自分のシークレット" | |
} |
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
//レシピを登録する時のアクション | |
@IBAction func saveRecipeAction(_ sender: UIButton) { | |
//キーボードを閉じる | |
view.endEditing(true) | |
//ボタンを非活性状態にする | |
closeButton.isEnabled = false | |
saveButton.isEnabled = false |
OlderNewer