(●´・ω・`●)ノ.:゚+ドモ.: *:・ とあるView上に配置したサブビューは触れるけれど、そのView自身は触れないぞ!ってのをやりたくて、やっと実装できたのでメモメモ。 例えば下図のような時 こういう重なり方をしているとき、通常は①のButtonをタップすることができません。 例えば②の方UIViewで とした場合、①の方のButtonは押せるようになりますが、今度は②のButtonが押せなくなります。 つまり、この重なり方を変えずに、どちらのボタンも押せるようにしたい!というわけです。 これはUIViewのサブクラスなら何でも当てはまるので、UIScrollViewやUITableViewでも同様です。 サブクラスを作ってhitTest(_:with:)をoverrideしよう!上記の図で両方のボタンを押せるようにする方法です。 重なっているviewを透過するようなイメージで
こんにちは、サービス開発部の氏です。 主にiOSのクックパッドアプリの開発を担当しています。 UICollectionViewLayout みなさん使ってますか? UICollectionView でレイアウトを組む際、実際触り始めると実装するための選択肢が複数あり、どれが最適なのか悩ましい場面に遭遇する人もいるのではないかと思います。 今回は、自分が業務で触れた際に得た知見について軽くお話したいと思います。 UICollectionVIewLayout とは UICollectionView は Cellのサイズや余白等のレイアウトを管理するため、プロパティとして、 UICollectionViewLayout を所持しています。 この UICollectionViewLayout に手をいれることによって、レイアウトを好きな形に変更することができます。 レイアウトを組み立てるときの複数
import UIKit protocol PinterestLayoutDelegate { func collectionView(_ collectionView:UICollectionView, heightForPhotoAtIndexPath indexPath:IndexPath , withWidth:CGFloat) -> CGFloat func collectionView(_ collectionView: UICollectionView, heightForCaptionAndCommentAtIndexPath indexPath: IndexPath, withWidth width: CGFloat) -> CGFloat } class PinterestLayoutAttributes: UICollectionViewLayoutAttribute
※2017.07.31追記: 「MOREMALL(モアモール)」事業、サービス終了のお知らせ 初めまして、Objective-C未経験Swift歴6ヶ月のamitanです。 WWDC2015 にてSwift2.0オープンソース化が発表されて、テンションMAXです!! UICollectionViewはiOS 6.0で追加された、 grid形式で表示可能なViewです。 今回は、MOREMALLアプリでも使用されているUICollecionViewFlowLayoutを継承したお手軽カスタマイズ方法をご紹介します。 UICollectionViewでのアニメーション方法についてはこちらからどうぞ。 カスタムレイアウトの作成 列数及び縦横の長さ、行列の位置を指定することで、UICollectionViewに描画ができるカスタムレイアウトを作成します。 ソースコードはgithubにあります。 開
Prior to Swift 4, parsing JSON was a common (yet cumbersome) process of dealing with untyped arrays and dictionaries. Now Swift comes with Codable, an incredibly powerful system for encoding and decoding types. There has been a number of great libraries for dealing with this task, but it is quite refreshing to see a fully-supported solution that is easy to adopt but also provides the customization
April 1, 2017 404 Not Found ブログのシステムを移行したため、記事の URL が変わっています。 記事自体は全て移しましたので、 トップページ swiswiswift.com の記事リストの中から検索していたければ記事が見つかると思います。 よろしくお願いします。
2024-09-21 日本のビットコイン市場:過去・現在・未来 #BitcoinTokyo2024 ブロックチェーン 聞き起こし モデレーター Bradley Loewen, Podcaster, Beyond The Price 中村 奎太, CEO, 株式会社メルコイン 廣末 紀之, CEO, bitbank株式会社 Bradley 自己紹介とビットコインに興味を持ったきっかけを 廣末 ビットバンクという取引所の創業者で代表。ITを色々やって… 2024-09-21 エネルギー産業に革命を起こすビットコインマイニング #BitcoinTokyo2024 聞き起こし ブロックチェーン モデレーター 三原 弘之, CEO, Cygnos Capital 大西 智敦, 室長補佐, 三井物産株式会社 立岩 健二, 代表取締役社長, 株式会社アジャイルエナジーX 三原 ビットコインマイニングする
I was using iOS 6.1 earlier, but now I have moved to iOS 7. Along with other problems, I have observed that in my navigation bar, the left space of left bar button item and right empty space of the right button bar item are quite more in IOS 7 than in iOS 6. I need to know is there a way I can reduce empty spaces of left, right bar button items in navigation bar??
ジェネリクス 型をパラメーターとして扱う方法。型を抽象化できて便利なコードを書けるようになる。 Swiftの標準ライブラリーの多くがジェネリクスを使っている。 この記事ではジェネリクスを使っていないコードとジェネリクスを使ったコードを比較して、ジェネリクスの有効性から使い方までみていきます。 ジェネリクスを使わないイケてないコード Int型の引数2つを入れ替える関数を作ってみます。 func swapTwoInts(inout a: Int, inout _ b: Int) { let temporaryA = a a = b b = temporaryA } このswapTwoInts(_:_)関数を実行してみます。 var someInt = 3 var anotherInt = 107 swapTwoInts(&someInt, &anotherInt) print("someInt
100 Days of Swift I started learning swift and kept going for 100 days. Each day, I tried to build something from what I learned. Most projects took a few days to complete. Below is my progression from day one to a hundred in the form of completed projects. A total of 40 projects. Read more about this on Medium I learned how to: Build custom transparent navigation bar Implement a Collection View i
I’m a huge fan of UICollectionView. It’s way more customizable than his older brother UITableView. Nowadays I use collection view even more often than table view. With iOS 9 it supports easy reordering. Before it wasn’t possible out of the box, and to do so means painful work. Let’s have look at the API. You can find the accompanying Xcode project on GitHub. The easiest way to add easy reordering
In this two-part tutorial series, you’ll develop a nifty iOS book open animation and page flip animation similar to Paper by FiftyThree: In Part 1 you’ll learn how to customize your collection view layouts and apply depth and shadow to make the app look realistic. In Part 2, you’ll learn to create custom transitions between different controllers in a sensible way and integrate gestures to create n
こんにちは、うっちーです。 UIPageViewController を使って、スワイプでページめくりをやりたかったんです。 見開き2ページ分を表示しながら、スワイプでページめくり。 1ページ表示でのサンプルはXcodeで新規プロジェクトを作るときに「Page-Based Application」を選択するとできているのですが、見開き表示する方法がなかなかわからなくって苦戦したので、書いておこうと思います。 実は超絶簡単だったんですけどね。。。 UIPageViewControllerを使って、本をめくるUIを実装する Page-Based Applicationで新規プロジェクトを作成すると、AppDelegate、RootViewController、DataViewController、ModelControllerの4つのSwiftファイルができます。 RootViewContro
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く