3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Swift】ライブラリ "Parchment" を使うにあたっての初心者向け補足

Last updated at Posted at 2021-02-18

どういうことか

掲題のライブラリはお手軽に上部メニューバーを実装できてしまうものであり、調べたらいくつか『初心者向け』といったものもあったが、そういった記事をもう少し補足したものを書く。

ちなみに参考記事はこちら(ぼくが書いたものはない)。

公式
https://github.com/rechsteiner/Parchment

parchmentを使って、画面になにかを表示させる場合、どうしたらいいか?
https://teratail.com/questions/267298

Swift: ページャーライブラリParchmentの使い方
https://blog.shota-ito.com/2020/05/10/post-490/

ぼくは2番目の記事をベースに3番目の記事を参考にして色の設定などを付け足した感じです。

やるべきこと

表示させたいページ分のControllerを作る

たとえば2番目の記事で言うと firstViewController.swiftsecondViewController.swift は作る必要がある。
それぞれStoryboardでページを作るのであれば特に何かを書く必要はない。
import Parchment も書かなくていい。

StoryBoard で View Controllerを追加し identifier を設定

2番目の記事のコメント欄に書いてある。
そのまんまではあるが、Storyboardで表示させたいページ分のViewControllerを追加して、それの Storyboard ID の箇所に firstViewControllersecondViewController をそれぞれ書く。

やらなくていいこと

PagingViewController は作る必要がない

インストールするともろもろ処理が書かれたこれが最初から作られている。むしろ作るとエラーになる。

わかっていないこと

作ったメニューバーの丈夫に margin などの余白を作ることはできないのかなぁとか。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?