sugarcube 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ios/sugarcube-568/uiimage.rb +22 -13
- data/lib/osx/sugarcube-appkit/nsstring.rb +1 -5
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d971eb3d120c7952f35581299baa11b8f05040
|
4
|
+
data.tar.gz: 1cd8be72a4aefac254d0b29d0250a942a7318297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7fde608a38bfe81d70cdc61298af9feca8bf9f369f2d950746dbf123132cd2eb6baabf24834998269c56f6fd64963f4efc5fa796a60eb2bd8a18b5a90cc63a0
|
7
|
+
data.tar.gz: c1b0618b2e4be3d733b0f0436fc708383fa8ed0e4d2a632fbade2a16f31cd335c76c8a082921ba573fa555409131a251e5da5e9fc399eab300efabe978a78442
|
@@ -1,32 +1,41 @@
|
|
1
1
|
class UIImage
|
2
2
|
class << self
|
3
|
-
SugarCube568_TallSuffix = '-568h@2x'
|
3
|
+
SugarCube568_TallSuffix = '-568h@2x' # 320 x 568
|
4
|
+
SugarCube667_TallSuffix = '-667h@2x' # 375 x 667
|
5
|
+
SugarCube736_TallSuffix = '-736h@2x' # 414 x 736
|
4
6
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
7
|
+
def sugarcube568_imageNamed(name)
|
8
|
+
case UIScreen.mainScreen.bounds.size.height
|
9
|
+
when 568
|
10
|
+
taller_image_ext = SugarCube568_TallSuffix
|
11
|
+
when 667
|
12
|
+
taller_image_ext = SugarCube667_TallSuffix
|
13
|
+
when 736
|
14
|
+
taller_image_ext = SugarCube736_TallSuffix
|
15
|
+
else
|
16
|
+
taller_image_ext = false
|
17
|
+
end
|
18
|
+
|
19
|
+
if ( taller_image_ext && name.length > 0 && name.rangeOfString(taller_image_ext).location == NSNotFound )
|
8
20
|
# Check if is there a path extension or not
|
9
|
-
test_name = name
|
21
|
+
test_name = name
|
10
22
|
if test_name.pathExtension.length > 0
|
11
|
-
test_name = test_name.stringByDeletingPathExtension.stringByAppendingString(
|
23
|
+
test_name = test_name.stringByDeletingPathExtension.stringByAppendingString(taller_image_ext).stringByAppendingPathExtension(name.pathExtension)
|
12
24
|
else
|
13
|
-
test_name = test_name.stringByAppendingString(
|
25
|
+
test_name = test_name.stringByAppendingString(taller_image_ext)
|
14
26
|
end
|
15
27
|
|
16
|
-
|
17
|
-
if image
|
18
|
-
return self.imageWithCGImage(image.CGImage, scale:2.0, orientation:image.imageOrientation)
|
19
|
-
end
|
28
|
+
return imageNamed_old(test_name)
|
20
29
|
end
|
21
30
|
|
22
31
|
return nil
|
23
32
|
end
|
24
33
|
|
25
34
|
alias :imageNamed_old :imageNamed
|
26
|
-
# now we've got
|
35
|
+
# now we've got sugarcube568_imageNamed and imageNamed_old to load the respective versions
|
27
36
|
|
28
37
|
def imageNamed(name)
|
29
|
-
|
38
|
+
sugarcube568_imageNamed(name) || imageNamed_old(name)
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
@@ -30,12 +30,8 @@ class NSString
|
|
30
30
|
|
31
31
|
# @return [NSImageView]
|
32
32
|
def nsimageview
|
33
|
-
image = NSImage.imageNamed(self)
|
34
|
-
unless image
|
35
|
-
NSLog("No image named #{self}")
|
36
|
-
end
|
37
33
|
image_view = NSImageView.alloc.init
|
38
|
-
image_view.image =
|
34
|
+
image_view.image = self.nsimage
|
39
35
|
frame = image_view.frame
|
40
36
|
frame.size = image_view.intrinsicContentSize
|
41
37
|
image_view.frame = frame
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin T.A. Gray
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-10-
|
14
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: |
|
17
17
|
== Description
|