From da58f32d75bf99f5d666f6d3243acc1d7e2b7aac Mon Sep 17 00:00:00 2001 From: Shalmezad Date: Thu, 28 May 2015 17:26:05 -0400 Subject: [PATCH] Fixed dataSource titleForBarAtIndex to be optional Now performs check for the dataSource to respond to the selector before actually creating/positioning the labels. --- Source/BarGraph/GKBarGraph.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/BarGraph/GKBarGraph.m b/Source/BarGraph/GKBarGraph.m index b947002..c0f3b41 100644 --- a/Source/BarGraph/GKBarGraph.m +++ b/Source/BarGraph/GKBarGraph.m @@ -97,10 +97,14 @@ - (void)_construct { if ([self _hasLabels]) [self _removeLabels]; [self _constructBars]; - [self _constructLabels]; - [self _positionBars]; - [self _positionLabels]; + + if([self.dataSource respondsToSelector:@selector(titleForBarAtIndex:)]) + { + [self _constructLabels]; + [self _positionLabels]; + } + } - (BOOL)_hasBars {