We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3bedaf commit 8f56ad1Copy full SHA for 8f56ad1
1 file changed
TOSegmentedControl/TOSegmentedControl.m
@@ -245,6 +245,21 @@ - (void)removeAllItems
245
self.items = nil;
246
}
247
248
+- (nullable UIImage *)imageForItemAtIndex:(NSInteger)index
249
+{
250
+ // Make sure the index provided is valid
251
+ if (index < 0 || index >= self.items.count) { return nil; }
252
+
253
+ // Return the item only if it is an image
254
+ id item = self.items[index];
255
+ if ([item isKindOfClass:[UIImage class]]) {
256
+ return item;
257
+ }
258
259
+ // Return nil if a label or anything else
260
+ return nil;
261
+}
262
263
#pragma mark - View Layout -
264
265
- (void)layoutSubviews
0 commit comments