Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #37 from DavidSchechter/master
Browse files Browse the repository at this point in the history
Loading images from correct bundle for issue #33
  • Loading branch information
DavidSchechter authored Aug 30, 2016
2 parents f25ae31 + 37d6468 commit 0a3f9f7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion NMessenger.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "NMessenger"
s.version = "1.0.75"
s.version = "1.0.76"
s.summary = "A fast, lightweight messenger component built on AsyncDisplaykit and written in Swift"

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ImageBubbleConfiguration: BubbleConfigurationProtocol {
public func getBubble() -> Bubble
{
let newBubble = ImageBubble()
newBubble.bubbleImage = UIImage(named: "MessageBubble")
newBubble.bubbleImage = UIImage(named: "MessageBubble", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)
newBubble.cutInsets = UIEdgeInsetsMake(29, 32, 25, 43)
newBubble.hasLayerMask = isMasked
return newBubble
Expand All @@ -40,7 +40,7 @@ public class ImageBubbleConfiguration: BubbleConfigurationProtocol {
public func getSecondaryBubble() -> Bubble
{
let newBubble = ImageBubble()
newBubble.bubbleImage = UIImage(named: "MessageBubble")
newBubble.bubbleImage = UIImage(named: "MessageBubble", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)
newBubble.cutInsets = UIEdgeInsetsMake(29, 32, 25, 43)
newBubble.hasLayerMask = isMasked
return newBubble
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TypingIndicatorContent: ContentNode {
var images = [UIImage]()

for imageName in imageNames {
if let image = UIImage(named: imageName) {
if let image = UIImage(named: imageName, inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil){
images.append(image)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public class CameraViewController: UIImagePickerController, UIImagePickerControl
//GALLERY BUTTON
gallery = UIButton(frame: CGRectMake(self.view.frame.width - sideButtonSize - bottomPadding, self.view.frame.height - sideButtonSize - bottomPadding, sideButtonSize, sideButtonSize))
gallery.addTarget(self, action: #selector(CameraViewController.changePictureMode), forControlEvents: UIControlEvents.TouchUpInside)
gallery.setImage(UIImage(named: "cameraRollIcon")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
gallery.setImage(UIImage(named: "cameraRollIcon", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
gallery.tintColor = UIColor.whiteColor()
galleryImage = UIImageView(frame: gallery.frame)
galleryImage.contentMode = UIViewContentMode.ScaleAspectFill
Expand Down Expand Up @@ -208,7 +208,7 @@ public class CameraViewController: UIImagePickerController, UIImagePickerControl

//CAPTURE BUTTON
capturePictureButton = UIButton(frame: CGRectMake(self.view.frame.width/2 - bottomPadding, self.view.frame.height - captureButtonSize - bottomPadding, captureButtonSize, captureButtonSize))
capturePictureButton.setImage(UIImage(named: "shutterBtn")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
capturePictureButton.setImage(UIImage(named: "shutterBtn", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
capturePictureButton.tintColor = UIColor.whiteColor()

//call the uiimagepickercontroller method takePicture()
Expand All @@ -222,7 +222,7 @@ public class CameraViewController: UIImagePickerController, UIImagePickerControl
//FLIP CAMERA BUTTON
flipCamera = UIButton(frame: CGRectMake(bottomPadding, self.view.frame.height - sideButtonSize - bottomPadding, sideButtonSize, sideButtonSize))
flipCamera.addTarget(self, action: #selector(CameraViewController.flipCamera(_:)), forControlEvents: UIControlEvents.TouchUpInside)
flipCamera.setImage(UIImage(named: "flipCameraIcon.png")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
flipCamera.setImage(UIImage(named: "flipCameraIcon", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
flipCamera.tintColor = UIColor.whiteColor()
}
/**
Expand All @@ -234,7 +234,7 @@ public class CameraViewController: UIImagePickerController, UIImagePickerControl
cameraToolbar.barStyle = UIBarStyle.BlackTranslucent
cameraToolbar.translucent = true
let exitButton = UIButton(frame: CGRectMake(20, 10, 40, 40))
exitButton.setImage(UIImage(named: "exitIcon.png")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
exitButton.setImage(UIImage(named: "exitIcon", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
exitButton.tintColor = UIColor.whiteColor()
exitButton.imageEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
exitButton.addTarget(self, action: #selector(CameraViewController.exitButtonPressed), forControlEvents: UIControlEvents.TouchUpInside)
Expand All @@ -246,7 +246,7 @@ public class CameraViewController: UIImagePickerController, UIImagePickerControl
public func addFlashButton() {
//Flash Button
flashButton = UIButton(frame: CGRectMake(self.view.frame.width - 60, 10, 40, 40))
flashButton.setImage(UIImage(named: "flashIcon")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
flashButton.setImage(UIImage(named: "flashIcon", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), forState: UIControlState.Normal)
flashButton.imageEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
flashButton.tintColor = UIColor.whiteColor()
flashButton.addTarget(self, action: #selector(CameraViewController.toggleFlash(_:)), forControlEvents: UIControlEvents.TouchUpInside)
Expand Down
2 changes: 1 addition & 1 deletion nMessengerTests/UI Components/Chat/BubbleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BubbleTests: XCTestCase {

func testBubbleImage() {
let bubble = ImageBubble()
bubble.bubbleImage = UIImage(named: "MessageBubble")
bubble.bubbleImage = UIImage(named: "MessageBubble", inBundle: NSBundle(forClass: NMessengerViewController.self), compatibleWithTraitCollection: nil)
XCTAssertNotNil(bubble.layer)
XCTAssertNotNil(bubble.maskLayer)
XCTAssertEqual(bubble.hasLayerMask, true)
Expand Down

0 comments on commit 0a3f9f7

Please sign in to comment.