Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setTabItemTitle #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

isseium
Copy link
Contributor

@isseium isseium commented Apr 13, 2017

Sorry for writing in Japanese.

立て続けに失礼します。:)

TabPageViewController 表示後に、タブのタイトルを変更したく setTabItemTitle(_ title: String, at: Int) というメソッドを用意しました。

もともと当方のfork先で類似の変更をしていたのですが、本家に取り込んでいただいたほうがメリットがあると判断しましたので、問題がなければ取り込んでいただけないでしょうか。

すでの現状のコードで変更する方法があればご教示ください。

よろしくお願いします。

====

Automatic Translation using Google Translate

After displaying TabPageViewController, we have prepared a method called setTabItemTitle that allows you to change the title of the tab.

Originally we made a similar change at our fork destination, but we decided that it is beneficial to incorporate it in our headquarters, so if you do not have a problem, would you please incorporate it?

Please teach if there is any way to change with the current code.

Thank you.

@EndouMari
Copy link
Owner

どういったときに必要になるのでしょうか?
ユースケースが思いつかず、ライブラリに組み込むか悩んでいます。

@isseium
Copy link
Contributor Author

isseium commented Apr 14, 2017

ご連絡ありがとうございます。

使用例ですが、検索結果の件数をタブに表示したいというモチベーションから提案しております。

例として、ニュースアプリを想定していただきたいです。
ニュースには、「政治」「経済」「エンタメ」というカテゴリがあります。

この3つのカテゴリを横断して任意のワードで絞り込みをする検索機能を実装します。
その場合に、検索結果で、各カテゴリごとにタブを用意し、「政治(3)」「経済(10)」「エンタメ(0)」のようにヒット件数をタブに表示したく、タブのタイトルを変更するメソッドが欲しいです。

わかりにくければ補足いたしますのでご指摘ください。

また、もし方針にあわずライブラリへの組み込みが難しい場合は、 tabView (より局所的にいうと tabView.pageTabItems) へのアクセス出来る方法を検討いただけないでしょうか。

よろしくお願いします。

@EndouMari
Copy link
Owner

使用例を理解しました。
ありがとうございます!
とてもいい提案だと思います。

使う人によってはまた別なカスタマイズがしたいとおもうので
今頂いているPRを取り込むのではなく
UITableViewDataSource,Delegateなどのような形で提供できれば良いのかなとおもいました。

実装に時間がかかると思うのですぐに対応するのはむずかしいのですが、
いかがでしょうか?

@isseium
Copy link
Contributor Author

isseium commented Apr 14, 2017

ありがとうございます。

もし DataSource や Delegate のほうがエレガントにタイトルを変更する方法が提供されるのであればそちらでぜひお願いします。

正式に対応いただくまでは、現在PRしているものを自前のリポジトリで管理して対応したいと思います。
(急かすわけではありませんが、なるべく早いとうれしいですw :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants