Commit 25d4bf2ca0f201287df5b4415c242770b8177498
1 parent
c1ce21a0
0.0.1增加图片
Showing
6 changed files
with
46 additions
and
4 deletions
CNLiveNavigationClass.podspec
| ... | ... | @@ -33,8 +33,8 @@ TODO: Add long description of the pod here. |
| 33 | 33 | s.dependency 'CNLiveTripartiteManagement/QMUIKit' |
| 34 | 34 | s.dependency 'CNLiveBaseKit' |
| 35 | 35 | s.dependency 'CNLiveCommonCategory' |
| 36 | - # s.resource_bundles = { | |
| 37 | - # 'CNLiveNavigationClass' => ['CNLiveNavigationClass/Assets/*.png'] | |
| 38 | - # } | |
| 36 | + s.resource_bundles = { | |
| 37 | + 'CNLiveNavigationClass' => ['CNLiveNavigationClass/Assets/Assets.xcassets'] | |
| 38 | + } | |
| 39 | 39 | s.frameworks = 'UIKit', 'Foundation' |
| 40 | 40 | end | ... | ... |
CNLiveNavigationClass/Assets/Assets.xcassets/Contents.json
0 → 100644
CNLiveNavigationClass/Assets/Assets.xcassets/zb_icon.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "zb_icon@2x.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "filename" : "zb_icon@3x.png", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "version" : 1, | |
| 20 | + "author" : "xcode" | |
| 21 | + } | |
| 22 | +} | |
| 0 | 23 | \ No newline at end of file | ... | ... |
CNLiveNavigationClass/Assets/Assets.xcassets/zb_icon.imageset/zb_icon@2x.png
0 → 100644
7.47 KB
CNLiveNavigationClass/Assets/Assets.xcassets/zb_icon.imageset/zb_icon@3x.png
0 → 100644
11.1 KB
CNLiveNavigationClass/Classes/HKFloat/HKFloatBall.m
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | _iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; |
| 32 | 32 | _iconImageView.backgroundColor = [UIColor yellowColor]; |
| 33 | 33 | // _iconImageView.image = [UIImageMake([[[[NSBundle mainBundle] infoDictionary] valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject]) imageByResizeToSize:CGSizeMake(self.frame.size.width, self.frame.size.height)]; |
| 34 | -// _iconImageView.image = [UIImage imageNamed:@"icon"]; | |
| 34 | + _iconImageView.image = [self getImageWithImageName:@"zb_icon" bundleName:@"CNLiveNavigationClass" targetClass:[self class]]; | |
| 35 | 35 | _iconImageView.layer.borderWidth = 0; |
| 36 | 36 | _iconImageView.layer.borderColor = [UIColor grayColor].CGColor; |
| 37 | 37 | _iconImageView.layer.cornerRadius = self.bounds.size.width/2; |
| ... | ... | @@ -83,4 +83,18 @@ |
| 83 | 83 | [self.delegate floatBallDidClick:self]; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | + | |
| 87 | +-(UIImage*)getImageWithImageName:(NSString*)imageName bundleName:(NSString*)bundleName targetClass:(Class)targetClass{ | |
| 88 | + | |
| 89 | + NSBundle*bundle = [NSBundle bundleForClass:targetClass]; | |
| 90 | + | |
| 91 | + NSURL*url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 92 | + | |
| 93 | + NSBundle*targetBundle = [NSBundle bundleWithURL:url]; | |
| 94 | + | |
| 95 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 96 | + | |
| 97 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 98 | + | |
| 99 | +} | |
| 86 | 100 | @end | ... | ... |