30
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SVProgressHUDの動きが変わっているのでご注意を

Last updated at Posted at 2016-03-23

#はじめに

下記メソッドの表示時間が変わってました。

showInfoWithStatus
showSuccessWithStatus
showErrorWithStatus
showImage

#コード
MINがMAXとなっています。

変更前
- (NSTimeInterval)displayDurationForString:(NSString*)string {
    return MIN((float)string.length*0.06 + 0.5, 5.0);
}
変更後
+ (NSTimeInterval)displayDurationForString:(NSString*)string {
    return MAX((float)string.length * 0.06 + 0.5, [self sharedView].minimumDismissTimeInterval);
}

#表示時間の計算方法

##今までの表示時間

  • 表示する文字列が75文字以内 → 表示文字列の文字数 * 0.06 + 0.5
  • 表示する文字列が75文字以上 → 5.0

ex)完了を表示させていた場合 → 2 * 0.06 + 0.5 = 0.62

##最新版の表示時間

  • 表示する文字列が75文字以内 → 5.0
  • 表示する文字列が75文字以上 → 表示文字列の文字数 * 0.06 + 0.5

ex)完了を表示させていた場合 → 5.0

##最新版に更新すると
完了を表示させていた場合、今までは0.62秒間表示されていましたが、更新すると5秒間表示されるようになります。

※開発者の方に確認したところ、意図した動きだと連絡がありました。不具合ではないようです。

#前と同じ動きにするには
下記を追加してください。
最小時間を指定できるようになっていました。

SVProgressHUD.setMinimumDismissTimeInterval(0)

##表示時間

  • 表示する文字列が75文字以内 → 表示文字列の文字数 * 0.06 + 0.5
  • 表示する文字列が75文字以上 → 表示文字列の文字数 * 0.06 + 0.5  (今までは5.0でした)

正確に言うと75文字を超えた場合は前と動きが変わりますが、
そういう場合はあまりない(むしろ75文字超える場合は5秒以上表示した方が良い?)かと思うので
気にしなくて良いかと思います。

#まとめ
SVProgressHUD.setMinimumDismissTimeInterval(0)を指定してください。
気付かずリリースして、想定外の動きとなってしまわないように周知できたらとこの記事を書きました。

30
24
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
30
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?