iOSDC 2017 (Sep 16, 2017) https://iosdc.jp/2017/node/1317 Library: https://github.com/inamiy/Cassowary
iOSDC 2017 (Sep 16, 2017) https://iosdc.jp/2017/node/1317 Library: https://github.com/inamiy/Cassowary
Rachel Bobbins Stitch FixでiOSのリードエンジニアをしています。以前はPivotal Labsで働いていました。ユーザ・開発者の両方にとって素晴らしい経験を作り出すことを大切にしています。 twitter.com D.A.ノーマン著「誰のためのデザイン?(原題: \"The Design of Everyday Things\")」はデザイン哲学に焦点をあてたデザインの書です。そこで紹介されている多くの原則はSwiftのような物理的ではない言語についても当てはまります。このような原則を通して、読みやすく効果的なコードの書き方を探ります。 6年前に読んだ本を読み返しました。 心理学や認知科学から考えて製品を設計するというものです。 この本で紹介されている内容とコードの関係を考えてしまいます。どうやってコードの設計にこれを適用するか。 ひょっとすると危ない未知を歩んで
当初、めちゃいけてるPullRefreshライブラリDGElasticPullToRefreshを使う予定でしたが、AutoLayoutのバグで使用を断念 RxSwiftでのMVVMモデルの実現 こんなイメージ RxSwiftの使い所 1. Model : リクエストでObservableオブジェクトの生成 ここでは、APIリクエストでObservableオブジェクトを生成 レスポンスのJSONは、ObjectMapperを利用して作成したモデルクラスFeedResponseにマッピングしておくと楽でした func connect() -> Observable<FeedResponse> { let observable: Observable<FeedResponse> = Observable.create { (observer: AnyObserver<FeedResponse>
Eureka EngineeringLearn about Eureka’s engineering efforts, product developments and more.
『アプリ道場 Advent Calendar 2015』8日目は「Auto Layoutが好き過ぎて、StackViewをおかずにご飯3杯いける」ゆこびん(@yucovin)がお送りします。 そもそもイラストレーター/デザイナーなので、アプリの開発をしていても見た目を司るAuto Layoutが気になって気になってしょうがないです。(これは恋?!) ということで、本日は今年綺羅星のごとく現れたAuto Layout界の期待のクラス「UIStackView」についてまとめたいと思います!(๑´ㅂ`๑) UIStackViewは一言で言うと、便利なレイアウト用の箱です。 StackViewは2つ以上の縦または横に並ぶサブビューを面倒な制約(Constraints)を作ることなく、いいカンジにレイアウトしてくれます。 StackViewを上手く使えば制約の数をうんと少なくすることができるんです。
MisterFusionを使ったコード 上記のレイアウトをMisterFusionを使って再現すると、以下のようなコードになります。まずは使いたいクラスの中で、import MisterFusionをしてください。 let redView = UIView() redView.backgroundColor = .redColor() self.view.addLayoutSubview(redView, andConstraints: redView.Top |+| 10, redView.Right |-| 10, redView.Left |+| 10 ) let yellowView = UIView() yellowView.backgroundColor = .yellowColor() self.view.addLayoutSubview(yellowView, andCon
Auto Layoutを使って既存アプリをiPhone 6(S)/6(S) Plus対応した際に得た知見をまとめてみました。 以下、上級編となります。 ※iOS 9で導入されたStack ViewについてはiOS 8を切れない事情で使えませんでしたorz... ※下記のサンプルに使用したStoryboardファイルはこちらです。 https://gist.github.com/ypresto/ee3b2f592b40936c11ec ※設計が悪くて画面サイズ変わるとぶっ壊れちゃう箇所をUnit Testで把握するライブラリ書きました https://github.com/ypresto/AutoLayoutLint http://qiita.com/yuya_presto/items/742a9e6dd95667bd62c9 詳解編 Auto Layoutの仕組みやPriority、Int
以前書いたAutoLayoutでアニメーションを設定する方法のSwift版です。 アニメーションで動かしたいものの例 例として、mainViewの上に乗った、movableViewを下に動かすことを考えます。 movableViewの制約は、superViewであるmainViewに対して、以下のような制約を持っているとします。 Top Space, Trailing Space, Leading Spaceの各種の制約の値は0になっています。高さは適当です。 やってみる 基本的な考え方は、既に付いているautoLayoutの制約を外し、別の制約を付ける、ということです。今回の場合、"Top Space to SuperView = 0" の制約を外し、Top Space to mainView = 30 といった制約をつけます。 まず外す対象の制約をoutletでソースに結び付けておきま
AutoLayoutになってから追加されたUILabelのプロパティpreferredMaxLayoutWidth。なぜ必要になったんでしょうか?intrinsicContentSizeと共に理解する必要があるでしょう。 intrinsicContentSizeはViewの内容を表示するために必要なサイズを返します。UILabelやUIButtonの場合、文字列の長さによってサイズが可変します。UIImageViewの場合は画像サイズを返します。intrinsicContentSizeが返すサイズに応じてAutoLayoutはレイアウトします。 ただのUIViewなどは、それ自身でサイズは決められないので、intrinsicContentSizeはUIViewNoIntrinsicMetric(サイズ不明)を返します。こういったViewはSuperviewで設定されたConstraintに
iOS、Android、Unityなどのアプリ開発について、初心者向けの内容を『RainbowApps』講師陣が分かりやすく解説していきます。 第5回に引き続き、「AutoLayoutの使い方」です。 第5回ではAutoLayoutの基本的な使い方を学びましたので、今回はより実践的なレイアウトを組んでいくことで、AutoLayoutへの理解を深めていきましょう。 【1】画面サイズに応じた大きさでViewを表示する 【2】等間隔にViewを表示する 【3】宿題 最終的に下記のような画面を作っていきます。 【1】画面サイズに応じた大きさでViewを表示する ImageViewを用いて写真やコンテンツの画像を「どーんと表示したい」ことはよくあると思います。しかし、画像のアスペクト比(縦横比)が変わってしまっては台無しですね。 そこで、アスペクト比を維持したまま画面サイズに応じて大きさが変わるよう
Update note: This tutorial has been updated to iOS 11, Xcode 9, and Swift 4 by Ryan Ackermann. The original tutorial was written by Matthijs Hollemans. Have you ever been frustrated trying to make your apps look good in both portrait and landscape orientation? Is making screen layouts that support both the iPhone and iPad driving you to the brink of madness? Despair no longer, I bring you good new
Update note: This tutorial has been updated to iOS 11, Xcode 9, and Swift 4 by Ryan Ackermann. The original tutorial was written by Matthijs Hollemans. Have you ever been frustrated trying to make your apps look good in both portrait and landscape orientation? Is making screen layouts that support both the iPhone and iPad driving you to the brink of madness? Despair no longer, I bring you good new
LINEとかチャット系アプリは大体踏襲しているアレです。 まとめて解説してるブログが見つからなかったので、必要最低限の部分だけメモっときたいと思います。 今回はメッセージ入力欄のみで、ポイントはこの二つ。 メッセージ入力欄・送信ボタンは下部固定(キーボード出現時は隠れないように移動) 入力テキストの行数によってメッセージ入力欄の高さが変わる 実現方法は色々だと思いますが、今回は StoryBoardでAutoLayout を使ってやります。 【完成イメージ】 StoryBoardでレイアウトを作成 まずは以下の構造で各種UIパーツをレイアウトします。 Constraintを設定 Constraintについてここでは詳しい説明はしませんが、View間の相対位置やサイズ等を定義するルールといったところです。 画面サイズが異なる端末でもそれぞれいい感じにレイアウトが組めるので便利です。 Stor
Xcode6が正式にリリースされたので、Swiftを利用して早速アプリを0から作ってみました。 自分はXcode5からiPhoneアプリを作り始めたのですが、レイアウト周りで幾つかハマった点があったのでまとめておきます。 スプラッシュ画面を消すと、iPhone5s以下で起動した時に上下に黒い帯ができてしまう 新しいプロジェクトを作成する際に、Xcode5ではなかったスプラッシュ画面がデフォルトで挿入されているようになってます。 デフォルトのスプラッシュ画面はプロジェクト名がUILabelで記載されています。(非常にダサいので)自前のもので置き換えないのであればProjectのGeneral->App Icons and Launch Images->Launch Screen Fileから項目を削除されると思います。 削除だけしてiPhone5s以下で起動すると(OSは8, 7関係なし)以
iPhone6,6Plus サポートとか LaunchScreen.xib とか Size Class とか考えると、もはや Autolayout は必須な感じになってきてます。 http://d.hatena.ne.jp/shu223/20141002/1412209257 で、Autolayout ✕ UIScrollView の例の問題(UIScrollView のサイズを superview との制約で動的に変えるときにその中身も動的に変えたい、ってやつ。こんな雑な説明でもハマったことある人にはわかっていただけるかと・・・)、Apple 公式でこんなドキュメントが出てますが、 Technical Note TN2154: UIScrollView And Autolayout "Mixed Approach" とかなんか筋が悪い感じだし、"Pure Auto Layout Appr
Posted on June 11th, 2014 Ok, I’ll admit. I’ve been seriously struggling with AutoLayout ever since it’s been introduced. I understand the concept, and I LOVE the idea of it, but when I actually do it, it almost never behaves as it does in my head. So when I had a chance to go talk to an actual Apple Engineer about AutoLayout last week at WWDC, I made sure to go. I thought of my most painful exper
以前からAutolayoutの重要性や便利さをちらちら目にしてきましたがとっつきにくさからずっと避けてました。 そろそろ身につけなきゃとうことでレシピをまとめたいと思います。 参考 http://www.slideshare.net/classmethod/i-os-auto-layout を参考にさせて頂きました。 Autolayoutとは AutolayoutとはviewにConstraint(制約)を付けることでレイアウトする方法。 各view同士を5px間隔で配置する、など画面の大きさにとらわれず最適なviewの配置をします。 制約はNSLayoutConstraintクラスによって定義でき、制約には優先度を設定できます。 NSLayoutConstraint NSLayoutConstraintは2つのコンストラクタがあります。 constraintsWithVisualForm
前振り Auto LayoutとSize Classesを有効にしたStoryboardにて、画面いっぱいのUIImageViewを作ろうとした際、UIViewControllerのviewにaddしているUIImageViewの制約を設定しようとすると左右-16ptがデフォルトで設定されてしまいました。 この-16ptを素直に設定しても見た目がおかしくなるわけではないし、0ptにする方法もあるんだけどなぜデフォルトで-16ptが必要なのかを調べたメモです。 謎の16ptについて説明されている記事 この文章で説明することは、下記のページで説明されているのでそれらを読んで分かるなら問題ないと思います。 SizeClassesとXcode6でのAutoLayoutの謎マージン http://qiita.com/uskiita/items/c643f5868f60b496911e What is
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く