File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
JSQMessagesViewController/Layout Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,13 @@ FOUNDATION_EXPORT const CGFloat kJSQMessagesCollectionViewAvatarSizeDefault;
167
167
*/
168
168
@property (assign , nonatomic ) CGSize outgoingAvatarViewSize;
169
169
170
+ /* *
171
+ * The maximum number of items that the layout should keep in its cache of layout information.
172
+ *
173
+ * @discussion The default value is `200`. A limit of `0` means no limit. This is not a strict limit.
174
+ */
175
+ @property (assign , nonatomic ) NSUInteger cacheLimit;
176
+
170
177
/* *
171
178
* Computes and returns the size of the `messageBubbleImageView` property of a `JSQMessagesCollectionViewCell`
172
179
* at the specified indexPath. The returned size contains the required dimensions to display the entire message contents.
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ - (void)jsq_configureFlowLayout
83
83
84
84
_messageBubbleCache = [NSCache new ];
85
85
_messageBubbleCache.name = @" JSQMessagesCollectionViewFlowLayout.messageBubbleCache" ;
86
- _messageBubbleCache.countLimit = 100 ;
86
+ _messageBubbleCache.countLimit = 200 ;
87
87
88
88
_messageBubbleFont = [UIFont preferredFontForTextStyle: UIFontTextStyleBody];
89
89
@@ -221,6 +221,11 @@ - (void)setOutgoingAvatarViewSize:(CGSize)outgoingAvatarViewSize
221
221
[self invalidateLayoutWithContext: [JSQMessagesCollectionViewFlowLayoutInvalidationContext context ]];
222
222
}
223
223
224
+ - (void )setCacheLimit : (NSUInteger )cacheLimit
225
+ {
226
+ self.messageBubbleCache .countLimit = cacheLimit;
227
+ }
228
+
224
229
#pragma mark - Getters
225
230
226
231
- (CGFloat)itemWidth
@@ -244,6 +249,11 @@ - (NSMutableSet *)visibleIndexPaths
244
249
return _visibleIndexPaths;
245
250
}
246
251
252
+ - (NSUInteger )cacheLimit
253
+ {
254
+ return self.messageBubbleCache .countLimit ;
255
+ }
256
+
247
257
#pragma mark - Notifications
248
258
249
259
- (void )jsq_didReceiveApplicationMemoryWarningNotification : (NSNotification *)notification
You can’t perform that action at this time.
0 commit comments