diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2017-10-24 16:55:20 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-11-09 11:10:21 +0300 |
commit | c8b27f64df423dde57c2b24d1969661e97623410 (patch) | |
tree | 08f8be8df2779a46432d9abba5363fb9e9db9205 /iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC | |
parent | 2c40c0ebbfc854a851608b2574e682147a9cc67d (diff) |
[MAPSME-5842] [ios] Added 600 characters limit to review text.
Diffstat (limited to 'iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC')
-rw-r--r-- | iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewTextCell.swift | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewTextCell.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewTextCell.swift index 18fa8fe1f0..3853bf251e 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewTextCell.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewTextCell.swift @@ -1,4 +1,8 @@ final class UGCAddReviewTextCell: MWMTableViewCell { + private enum Const { + static let maxCharactersCount = 600 + } + @IBOutlet private weak var textView: MWMTextView! { didSet { textView.placeholder = L("placepage_reviews_hint") @@ -15,4 +19,8 @@ final class UGCAddReviewTextCell: MWMTableViewCell { } extension UGCAddReviewTextCell: UITextViewDelegate { + func textView(_: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + let isNewLengthValid = reviewText.count + text.count - range.length <= Const.maxCharactersCount + return isNewLengthValid + } } |