Skip to content
Permalink
Browse files
CB-11212 iOS: Explicitly set the bundle for images
 - set the bundle to the CDVCapture's bundle instead of assuming
   application bundle.

 This closes #61
  • Loading branch information
adzellman authored and stevengill committed May 11, 2016
1 parent b2e29fc commit fc49084eabaaf9d40a29978f86fe79880a45daf3
Showing 1 changed file with 6 additions and 5 deletions.
@@ -621,23 +621,24 @@ - (void)loadView
microphoneResource = @"CDVCapture.bundle/microphone-568h";
}

UIImage* microphone = [UIImage imageNamed:[self resolveImageResource:microphoneResource]];
NSBundle* cdvBundle = [NSBundle bundleForClass:[CDVCapture class]];
UIImage* microphone = [UIImage imageNamed:[self resolveImageResource:microphoneResource] inBundle:cdvBundle compatibleWithTraitCollection:nil];
UIView* microphoneView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, microphone.size.height)];
[microphoneView setBackgroundColor:[UIColor colorWithPatternImage:microphone]];
[microphoneView setUserInteractionEnabled:NO];
[microphoneView setIsAccessibilityElement:NO];
[tmp addSubview:microphoneView];

// add bottom bar view
UIImage* grayBkg = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/controls_bg"]];
UIImage* grayBkg = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/controls_bg"] inBundle:cdvBundle compatibleWithTraitCollection:nil];
UIView* controls = [[UIView alloc] initWithFrame:CGRectMake(0, microphone.size.height, viewRect.size.width, grayBkg.size.height)];
[controls setBackgroundColor:[UIColor colorWithPatternImage:grayBkg]];
[controls setUserInteractionEnabled:NO];
[controls setIsAccessibilityElement:NO];
[tmp addSubview:controls];

// make red recording background view
UIImage* recordingBkg = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/recording_bg"]];
UIImage* recordingBkg = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/recording_bg"] inBundle:cdvBundle compatibleWithTraitCollection:nil];
UIColor* background = [UIColor colorWithPatternImage:recordingBkg];
self.recordingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, recordingBkg.size.height)];
[self.recordingView setBackgroundColor:background];
@@ -665,8 +666,8 @@ - (void)loadView

// Add record button

self.recordImage = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/record_button"]];
self.stopRecordImage = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/stop_button"]];
self.recordImage = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/record_button"] inBundle:cdvBundle compatibleWithTraitCollection:nil];
self.stopRecordImage = [UIImage imageNamed:[self resolveImageResource:@"CDVCapture.bundle/stop_button"] inBundle:cdvBundle compatibleWithTraitCollection:nil];
self.recordButton.accessibilityTraits |= [self accessibilityTraits];
self.recordButton = [[UIButton alloc] initWithFrame:CGRectMake((viewRect.size.width - recordImage.size.width) / 2, (microphone.size.height + (grayBkg.size.height - recordImage.size.height) / 2), recordImage.size.width, recordImage.size.height)];
[self.recordButton setAccessibilityLabel:PluginLocalizedString(captureCommand, @"toggle audio recording", nil)];

0 comments on commit fc49084

Please sign in to comment.