Commit e718040992e03f7ec101b098a93de50fbb7d4569
1 parent
70488856
no message
Showing
9 changed files
with
30 additions
and
156 deletions
CNLiveMineModule/Classes/Controller/CNLiveMineController.m
| @@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
| 15 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> | 15 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> |
| 16 | #import "CNUserInfoManager.h" | 16 | #import "CNUserInfoManager.h" |
| 17 | #import "CNLiveEnvironment.h" | 17 | #import "CNLiveEnvironment.h" |
| 18 | +#import "CNLiveCategory.h" | ||
| 18 | 19 | ||
| 19 | #import "CNLiveMineNavigationBar.h" | 20 | #import "CNLiveMineNavigationBar.h" |
| 20 | #import "CNLiveMineHeaderView.h" | 21 | #import "CNLiveMineHeaderView.h" |
| @@ -365,7 +366,7 @@ static const CGFloat timeValue = 1.5; | @@ -365,7 +366,7 @@ static const CGFloat timeValue = 1.5; | ||
| 365 | _soccerBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 366 | _soccerBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 366 | _soccerBtn.adjustsImageWhenHighlighted = NO; | 367 | _soccerBtn.adjustsImageWhenHighlighted = NO; |
| 367 | _soccerBtn.frame = CGRectMake(SCREEN_WIDTH-67-10, SCREEN_HEIGHT-71-10-TabBarHeight, 67, 71); | 368 | _soccerBtn.frame = CGRectMake(SCREEN_WIDTH-67-10, SCREEN_HEIGHT-71-10-TabBarHeight, 67, 71); |
| 368 | - UIImage *xw_image = [self xw_getImageName:@"mine_soccer_task" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineController class]]; | 369 | + UIImage *xw_image = [self getImageWithImageName:@"mine_soccer_task" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineController class]]; |
| 369 | [_soccerBtn setImage:xw_image forState:UIControlStateNormal]; | 370 | [_soccerBtn setImage:xw_image forState:UIControlStateNormal]; |
| 370 | [_soccerBtn addTarget:self action:@selector(soccerDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | 371 | [_soccerBtn addTarget:self action:@selector(soccerDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| 371 | } | 372 | } |
| @@ -378,20 +379,4 @@ static const CGFloat timeValue = 1.5; | @@ -378,20 +379,4 @@ static const CGFloat timeValue = 1.5; | ||
| 378 | [service pushToTaskListViewController]; | 379 | [service pushToTaskListViewController]; |
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | -/** | ||
| 382 | - * 创建图片 | ||
| 383 | - * | ||
| 384 | - * @param imageName 图片名字 | ||
| 385 | - * @param bundleName 图片所在的bundle名字 | ||
| 386 | - * @param targetClass 类和bundle的同级目录 | ||
| 387 | - * @return 返回UIImage | ||
| 388 | - */ | ||
| 389 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 390 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 391 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 392 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 393 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 394 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 395 | -} | ||
| 396 | - | ||
| 397 | @end | 382 | @end |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateCell.m
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | #import <Masonry/Masonry.h> | 10 | #import <Masonry/Masonry.h> |
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | #import "CNLiveUserInfoModel.h" | 12 | #import "CNLiveUserInfoModel.h" |
| 13 | +#import "CNLiveCategory.h" | ||
| 13 | 14 | ||
| 14 | @interface CNLiveInfoUpdateCell() | 15 | @interface CNLiveInfoUpdateCell() |
| 15 | @property (nonatomic, strong) UIView *line; | 16 | @property (nonatomic, strong) UIView *line; |
| @@ -107,7 +108,7 @@ static const NSInteger margin = 12; | @@ -107,7 +108,7 @@ static const NSInteger margin = 12; | ||
| 107 | - (UIImageView *)pic { | 108 | - (UIImageView *)pic { |
| 108 | if (!_pic) { | 109 | if (!_pic) { |
| 109 | _pic = [[UIImageView alloc] init]; | 110 | _pic = [[UIImageView alloc] init]; |
| 110 | - UIImage *xw_image = [self xw_getImageName:@"mine_update_select" bundleName:@"CNLiveMineModule" targetClass:[self class]]; | 111 | + UIImage *xw_image = [self getImageWithImageName:@"mine_update_select" bundleName:@"CNLiveMineModule" targetClass:[self class]]; |
| 111 | _pic.image = xw_image; | 112 | _pic.image = xw_image; |
| 112 | _pic.hidden = YES; | 113 | _pic.hidden = YES; |
| 113 | _pic.contentMode = UIViewContentModeCenter; | 114 | _pic.contentMode = UIViewContentModeCenter; |
| @@ -116,21 +117,4 @@ static const NSInteger margin = 12; | @@ -116,21 +117,4 @@ static const NSInteger margin = 12; | ||
| 116 | return _pic; | 117 | return _pic; |
| 117 | } | 118 | } |
| 118 | 119 | ||
| 119 | - | ||
| 120 | -/** | ||
| 121 | - * 创建图片 | ||
| 122 | - * | ||
| 123 | - * @param imageName 图片名字 | ||
| 124 | - * @param bundleName 图片所在的bundle名字 | ||
| 125 | - * @param targetClass 类和bundle的同级目录 | ||
| 126 | - * @return 返回UIImage | ||
| 127 | - */ | ||
| 128 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 129 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 130 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 131 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 132 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 133 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 134 | -} | ||
| 135 | - | ||
| 136 | @end | 120 | @end |
CNLiveMineModule/Classes/UserInfo/CNLiveInfoUpdateController.m
| @@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
| 27 | 27 | ||
| 28 | #import "CNLiveAddScoreManager.h" | 28 | #import "CNLiveAddScoreManager.h" |
| 29 | #import "CNLiveGoldWhereaboutsView.h" | 29 | #import "CNLiveGoldWhereaboutsView.h" |
| 30 | +#import "CNLiveCategory.h" | ||
| 30 | 31 | ||
| 31 | #import "CNLiveUserInfoModel.h" | 32 | #import "CNLiveUserInfoModel.h" |
| 32 | #import "CNLiveUserInfoNotification.h" | 33 | #import "CNLiveUserInfoNotification.h" |
| @@ -618,7 +619,7 @@ static const CGFloat timeValue = 1.5; | @@ -618,7 +619,7 @@ static const CGFloat timeValue = 1.5; | ||
| 618 | switch (self.model.dataType) { | 619 | switch (self.model.dataType) { |
| 619 | case CNLiveUserInfoDataTypeHead: | 620 | case CNLiveUserInfoDataTypeHead: |
| 620 | { | 621 | { |
| 621 | - UIImage *xw_image = [self xw_getImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | 622 | + UIImage *xw_image = [self getImageWithImageName:@"mine_info_set" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; |
| 622 | [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; | 623 | [_navigationBar.right setImage:xw_image forState:UIControlStateNormal]; |
| 623 | } | 624 | } |
| 624 | break; | 625 | break; |
| @@ -719,7 +720,7 @@ static const CGFloat timeValue = 1.5; | @@ -719,7 +720,7 @@ static const CGFloat timeValue = 1.5; | ||
| 719 | if(!_imageView){ | 720 | if(!_imageView){ |
| 720 | _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)]; | 721 | _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)]; |
| 721 | _imageView.center = self.view.center; | 722 | _imageView.center = self.view.center; |
| 722 | - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; | 723 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[CNLiveInfoUpdateController class]]; |
| 723 | [_imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl?CNUserShareModel.bigFaceUrl:CNUserShareModel.faceUrl] placeholderImage:xw_image]; | 724 | [_imageView sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.bigFaceUrl?CNUserShareModel.bigFaceUrl:CNUserShareModel.faceUrl] placeholderImage:xw_image]; |
| 724 | } | 725 | } |
| 725 | return _imageView; | 726 | return _imageView; |
| @@ -793,21 +794,4 @@ static const CGFloat timeValue = 1.5; | @@ -793,21 +794,4 @@ static const CGFloat timeValue = 1.5; | ||
| 793 | } | 794 | } |
| 794 | } | 795 | } |
| 795 | 796 | ||
| 796 | -/** | ||
| 797 | - * 创建图片 | ||
| 798 | - * | ||
| 799 | - * @param imageName 图片名字 | ||
| 800 | - * @param bundleName 图片所在的bundle名字 | ||
| 801 | - * @param targetClass 类和bundle的同级目录 | ||
| 802 | - * @return 返回UIImage | ||
| 803 | - */ | ||
| 804 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 805 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 806 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 807 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 808 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 809 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 810 | - | ||
| 811 | -} | ||
| 812 | - | ||
| 813 | @end | 797 | @end |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoCell.m
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | #import <Masonry/Masonry.h> | 10 | #import <Masonry/Masonry.h> |
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | #import "CNLiveUserInfoModel.h" | 12 | #import "CNLiveUserInfoModel.h" |
| 13 | +#import "CNLiveCategory.h" | ||
| 13 | 14 | ||
| 14 | @interface CNLiveUserInfoCell() | 15 | @interface CNLiveUserInfoCell() |
| 15 | @property (nonatomic, strong) UIView *line; | 16 | @property (nonatomic, strong) UIView *line; |
| @@ -56,7 +57,7 @@ static const NSInteger margin = 12; | @@ -56,7 +57,7 @@ static const NSInteger margin = 12; | ||
| 56 | _pic.contentMode = UIViewContentModeScaleToFill; | 57 | _pic.contentMode = UIViewContentModeScaleToFill; |
| 57 | _pic.layer.masksToBounds = YES; | 58 | _pic.layer.masksToBounds = YES; |
| 58 | _pic.layer.cornerRadius = 5.0; | 59 | _pic.layer.cornerRadius = 5.0; |
| 59 | - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]]; | 60 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_f" bundleName:@"CNLiveMineModule" targetClass:[self class]]; |
| 60 | [_pic sd_setImageWithURL:[NSURL URLWithString:model.content] placeholderImage:xw_image]; | 61 | [_pic sd_setImageWithURL:[NSURL URLWithString:model.content] placeholderImage:xw_image]; |
| 61 | 62 | ||
| 62 | }else if (model.dataType == CNLiveUserInfoDataTypeNickname){ | 63 | }else if (model.dataType == CNLiveUserInfoDataTypeNickname){ |
| @@ -75,7 +76,7 @@ static const NSInteger margin = 12; | @@ -75,7 +76,7 @@ static const NSInteger margin = 12; | ||
| 75 | _pic.contentMode = UIViewContentModeCenter; | 76 | _pic.contentMode = UIViewContentModeCenter; |
| 76 | _pic.layer.masksToBounds = NO; | 77 | _pic.layer.masksToBounds = NO; |
| 77 | _pic.layer.cornerRadius = 0.0; | 78 | _pic.layer.cornerRadius = 0.0; |
| 78 | - UIImage *xw_image = [self xw_getImageName:@"mine_info_qrcode" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]]; | 79 | + UIImage *xw_image = [self getImageWithImageName:@"mine_info_qrcode" bundleName:@"CNLiveMineModule" targetClass:[self class]]; |
| 79 | _pic.image = xw_image; | 80 | _pic.image = xw_image; |
| 80 | 81 | ||
| 81 | }else if (model.dataType == CNLiveUserInfoDataTypeAddress){ | 82 | }else if (model.dataType == CNLiveUserInfoDataTypeAddress){ |
| @@ -197,7 +198,7 @@ static const NSInteger margin = 12; | @@ -197,7 +198,7 @@ static const NSInteger margin = 12; | ||
| 197 | - (UIImageView *)front { | 198 | - (UIImageView *)front { |
| 198 | if (!_front) { | 199 | if (!_front) { |
| 199 | _front = [[UIImageView alloc] init]; | 200 | _front = [[UIImageView alloc] init]; |
| 200 | - UIImage *xw_image = [self xw_getImageName:@"mine_info_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoCell class]]; | 201 | + UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveMineModule" targetClass:[self class]]; |
| 201 | _front.image = xw_image; | 202 | _front.image = xw_image; |
| 202 | _front.contentMode = UIViewContentModeCenter; | 203 | _front.contentMode = UIViewContentModeCenter; |
| 203 | 204 | ||
| @@ -215,20 +216,4 @@ static const NSInteger margin = 12; | @@ -215,20 +216,4 @@ static const NSInteger margin = 12; | ||
| 215 | 216 | ||
| 216 | } | 217 | } |
| 217 | 218 | ||
| 218 | -/** | ||
| 219 | - * 创建图片 | ||
| 220 | - * | ||
| 221 | - * @param imageName 图片名字 | ||
| 222 | - * @param bundleName 图片所在的bundle名字 | ||
| 223 | - * @param targetClass 类和bundle的同级目录 | ||
| 224 | - * @return 返回UIImage | ||
| 225 | - */ | ||
| 226 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 227 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 228 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 229 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 230 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 231 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 232 | -} | ||
| 233 | - | ||
| 234 | @end | 219 | @end |
CNLiveMineModule/Classes/UserInfo/CNLiveUserInfoNavigationBar.m
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLiveUserInfoNavigationBar.h" | 9 | #import "CNLiveUserInfoNavigationBar.h" |
| 10 | #import "QMUIKit.h" | 10 | #import "QMUIKit.h" |
| 11 | +#import "CNLiveCategory.h" | ||
| 11 | 12 | ||
| 12 | @interface CNLiveUserInfoNavigationBar () | 13 | @interface CNLiveUserInfoNavigationBar () |
| 13 | 14 | ||
| @@ -60,7 +61,7 @@ static const NSInteger margin = 15; | @@ -60,7 +61,7 @@ static const NSInteger margin = 15; | ||
| 60 | _left.adjustsImageWhenHighlighted = NO; | 61 | _left.adjustsImageWhenHighlighted = NO; |
| 61 | _left.titleLabel.font = [UIFont systemFontOfSize:15]; | 62 | _left.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 62 | _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); | 63 | _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); |
| 63 | - UIImage *image = [self xw_getImageName:@"mine_back_black_b" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoNavigationBar class]]; | 64 | + UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveMineModule" targetClass:[CNLiveUserInfoNavigationBar class]]; |
| 64 | [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | 65 | [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; |
| 65 | [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | 66 | [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; |
| 66 | [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | 67 | [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; |
| @@ -104,21 +105,4 @@ static const NSInteger margin = 15; | @@ -104,21 +105,4 @@ static const NSInteger margin = 15; | ||
| 104 | } | 105 | } |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | -/** | ||
| 108 | - * 创建图片 | ||
| 109 | - * | ||
| 110 | - * @param imageName 图片名字 | ||
| 111 | - * @param bundleName 图片所在的bundle名字 | ||
| 112 | - * @param targetClass 类和bundle的同级目录 | ||
| 113 | - * @return 返回UIImage | ||
| 114 | - */ | ||
| 115 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 116 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 117 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 118 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 119 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 120 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 121 | - | ||
| 122 | -} | ||
| 123 | - | ||
| 124 | @end | 108 | @end |
CNLiveMineModule/Classes/View/CNLiveMineCell.m
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | #import "CNLiveMineCell.h" | 9 | #import "CNLiveMineCell.h" |
| 10 | #import <Masonry/Masonry.h> | 10 | #import <Masonry/Masonry.h> |
| 11 | #import "QMUIKit.h" | 11 | #import "QMUIKit.h" |
| 12 | +#import "CNLiveCategory.h" | ||
| 12 | 13 | ||
| 13 | @interface CNLiveMineCell() | 14 | @interface CNLiveMineCell() |
| 14 | @property (nonatomic, strong) UIView *bgView; | 15 | @property (nonatomic, strong) UIView *bgView; |
| @@ -43,7 +44,7 @@ | @@ -43,7 +44,7 @@ | ||
| 43 | } | 44 | } |
| 44 | _model = model; | 45 | _model = model; |
| 45 | [_titleButton setTitle:model.name forState:UIControlStateNormal]; | 46 | [_titleButton setTitle:model.name forState:UIControlStateNormal]; |
| 46 | - UIImage *xw_image = [self xw_getImageName:model.pic bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; | 47 | + UIImage *xw_image = [self getImageWithImageName:model.pic bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; |
| 47 | [_titleButton setImage:xw_image forState:UIControlStateNormal]; | 48 | [_titleButton setImage:xw_image forState:UIControlStateNormal]; |
| 48 | _allButton.hidden = YES; | 49 | _allButton.hidden = YES; |
| 49 | 50 | ||
| @@ -293,7 +294,7 @@ | @@ -293,7 +294,7 @@ | ||
| 293 | if(!_allButton){ | 294 | if(!_allButton){ |
| 294 | _allButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 295 | _allButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 295 | [_allButton setTitle:@"查看全部" forState:UIControlStateNormal]; | 296 | [_allButton setTitle:@"查看全部" forState:UIControlStateNormal]; |
| 296 | - UIImage *xw_image = [self xw_getImageName:@"mine_all_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; | 297 | + UIImage *xw_image = [self getImageWithImageName:@"mine_all_front" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; |
| 297 | [_allButton setImage:xw_image forState:UIControlStateNormal]; | 298 | [_allButton setImage:xw_image forState:UIControlStateNormal]; |
| 298 | [_allButton setImage:xw_image forState:UIControlStateHighlighted]; | 299 | [_allButton setImage:xw_image forState:UIControlStateHighlighted]; |
| 299 | _allButton.titleLabel.font = [UIFont systemFontOfSize:12]; | 300 | _allButton.titleLabel.font = [UIFont systemFontOfSize:12]; |
| @@ -327,7 +328,7 @@ | @@ -327,7 +328,7 @@ | ||
| 327 | 328 | ||
| 328 | [btn setTitle:title forState:UIControlStateNormal]; | 329 | [btn setTitle:title forState:UIControlStateNormal]; |
| 329 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | 330 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; |
| 330 | - UIImage *xw_image = [self xw_getImageName:image bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; | 331 | + UIImage *xw_image = [self getImageWithImageName:image bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineCell class]]; |
| 331 | [btn setImage:xw_image forState:UIControlStateNormal]; | 332 | [btn setImage:xw_image forState:UIControlStateNormal]; |
| 332 | btn.adjustsImageWhenHighlighted = NO; | 333 | btn.adjustsImageWhenHighlighted = NO; |
| 333 | [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | 334 | [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| @@ -337,21 +338,4 @@ | @@ -337,21 +338,4 @@ | ||
| 337 | 338 | ||
| 338 | } | 339 | } |
| 339 | 340 | ||
| 340 | -/** | ||
| 341 | - * 创建图片 | ||
| 342 | - * | ||
| 343 | - * @param imageName 图片名字 | ||
| 344 | - * @param bundleName 图片所在的bundle名字 | ||
| 345 | - * @param targetClass 类和bundle的同级目录 | ||
| 346 | - * @return 返回UIImage | ||
| 347 | - */ | ||
| 348 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 349 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 350 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 351 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 352 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 353 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 354 | - | ||
| 355 | -} | ||
| 356 | - | ||
| 357 | @end | 341 | @end |
CNLiveMineModule/Classes/View/CNLiveMineHeaderView.m
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | #import <Masonry/Masonry.h> | 10 | #import <Masonry/Masonry.h> |
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | #import "QMUIKit.h" | 12 | #import "QMUIKit.h" |
| 13 | +#import "CNLiveCategory.h" | ||
| 13 | 14 | ||
| 14 | #import "CNUserInfoManager.h" | 15 | #import "CNUserInfoManager.h" |
| 15 | 16 | ||
| @@ -153,7 +154,7 @@ static const NSInteger margin = 20; | @@ -153,7 +154,7 @@ static const NSInteger margin = 20; | ||
| 153 | // 2.添加表情图片 | 154 | // 2.添加表情图片 |
| 154 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; | 155 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; |
| 155 | // 表情图片 | 156 | // 表情图片 |
| 156 | - UIImage *xw_image = [self xw_getImageName:imageName bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 157 | + UIImage *xw_image = [self getImageWithImageName:imageName bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 157 | attch.image = xw_image; | 158 | attch.image = xw_image; |
| 158 | if(isFront){ | 159 | if(isFront){ |
| 159 | // 设置图片大小 | 160 | // 设置图片大小 |
| @@ -179,7 +180,7 @@ static const NSInteger margin = 20; | @@ -179,7 +180,7 @@ static const NSInteger margin = 20; | ||
| 179 | // 2.添加表情图片 | 180 | // 2.添加表情图片 |
| 180 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; | 181 | NSTextAttachment *attch = [[NSTextAttachment alloc] init]; |
| 181 | // 表情图片 | 182 | // 表情图片 |
| 182 | - UIImage *xw_image = [self xw_getImageName:image bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 183 | + UIImage *xw_image = [self getImageWithImageName:image bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 183 | attch.image = xw_image; | 184 | attch.image = xw_image; |
| 184 | // 创建带有图片的富文本 | 185 | // 创建带有图片的富文本 |
| 185 | NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attch]; | 186 | NSAttributedString *str = [NSAttributedString attributedStringWithAttachment:attch]; |
| @@ -197,7 +198,7 @@ static const NSInteger margin = 20; | @@ -197,7 +198,7 @@ static const NSInteger margin = 20; | ||
| 197 | - (UIButton *)witness { | 198 | - (UIButton *)witness { |
| 198 | if (!_witness) { | 199 | if (!_witness) { |
| 199 | _witness = [UIButton buttonWithType:UIButtonTypeCustom]; | 200 | _witness = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 200 | - UIImage *xw_image = [self xw_getImageName:@"mine_observer" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 201 | + UIImage *xw_image = [self getImageWithImageName:@"mine_observer" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 201 | _witness.imageView.contentMode = UIViewContentModeScaleAspectFit; | 202 | _witness.imageView.contentMode = UIViewContentModeScaleAspectFit; |
| 202 | [_witness setImage:xw_image forState:UIControlStateNormal]; | 203 | [_witness setImage:xw_image forState:UIControlStateNormal]; |
| 203 | _witness.adjustsImageWhenHighlighted = NO; | 204 | _witness.adjustsImageWhenHighlighted = NO; |
| @@ -209,7 +210,7 @@ static const NSInteger margin = 20; | @@ -209,7 +210,7 @@ static const NSInteger margin = 20; | ||
| 209 | if (!_bgView) { | 210 | if (!_bgView) { |
| 210 | _bgView = [[UIImageView alloc] init]; | 211 | _bgView = [[UIImageView alloc] init]; |
| 211 | _bgView.userInteractionEnabled = YES; | 212 | _bgView.userInteractionEnabled = YES; |
| 212 | - UIImage *xw_image = [self xw_getImageName:@"mine_bg" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 213 | + UIImage *xw_image = [self getImageWithImageName:@"mine_bg" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 213 | _bgView.image = xw_image; | 214 | _bgView.image = xw_image; |
| 214 | } | 215 | } |
| 215 | return _bgView; | 216 | return _bgView; |
| @@ -220,7 +221,7 @@ static const NSInteger margin = 20; | @@ -220,7 +221,7 @@ static const NSInteger margin = 20; | ||
| 220 | _header.userInteractionEnabled = YES; | 221 | _header.userInteractionEnabled = YES; |
| 221 | _header.layer.masksToBounds = YES; | 222 | _header.layer.masksToBounds = YES; |
| 222 | _header.layer.cornerRadius = 30; | 223 | _header.layer.cornerRadius = 30; |
| 223 | - UIImage *xw_image = [self xw_getImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 224 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 224 | [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; | 225 | [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; |
| 225 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headerTapDidClicked:)]; | 226 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headerTapDidClicked:)]; |
| 226 | [_header addGestureRecognizer:tap]; | 227 | [_header addGestureRecognizer:tap]; |
| @@ -270,7 +271,7 @@ static const NSInteger margin = 20; | @@ -270,7 +271,7 @@ static const NSInteger margin = 20; | ||
| 270 | [_sign setTitle:@"签到赚积分" forState:UIControlStateNormal]; | 271 | [_sign setTitle:@"签到赚积分" forState:UIControlStateNormal]; |
| 271 | _sign.titleLabel.font = [UIFont systemFontOfSize:13.0]; | 272 | _sign.titleLabel.font = [UIFont systemFontOfSize:13.0]; |
| 272 | [_sign setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 273 | [_sign setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 273 | - UIImage *xw_image = [self xw_getImageName:@"sign_in_soccer" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; | 274 | + UIImage *xw_image = [self getImageWithImageName:@"sign_in_soccer" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineHeaderView class]]; |
| 274 | [_sign setImage:xw_image forState:UIControlStateNormal]; | 275 | [_sign setImage:xw_image forState:UIControlStateNormal]; |
| 275 | [_sign addTarget:self action:@selector(signDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | 276 | [_sign addTarget:self action:@selector(signDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| 276 | UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_sign.layer.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(16, 16)]; | 277 | UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_sign.layer.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(16, 16)]; |
| @@ -309,21 +310,4 @@ static const NSInteger margin = 20; | @@ -309,21 +310,4 @@ static const NSInteger margin = 20; | ||
| 309 | } | 310 | } |
| 310 | } | 311 | } |
| 311 | 312 | ||
| 312 | -/** | ||
| 313 | - * 创建图片 | ||
| 314 | - * | ||
| 315 | - * @param imageName 图片名字 | ||
| 316 | - * @param bundleName 图片所在的bundle名字 | ||
| 317 | - * @param targetClass 类和bundle的同级目录 | ||
| 318 | - * @return 返回UIImage | ||
| 319 | - */ | ||
| 320 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 321 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 322 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 323 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 324 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 325 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 326 | - | ||
| 327 | -} | ||
| 328 | - | ||
| 329 | @end | 313 | @end |
CNLiveMineModule/Classes/View/CNLiveMineNavigationBar.m
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | #import <SDWebImage/SDWebImage.h> | 11 | #import <SDWebImage/SDWebImage.h> |
| 12 | #import "QMUIKit.h" | 12 | #import "QMUIKit.h" |
| 13 | #import "CNUserInfoManager.h" | 13 | #import "CNUserInfoManager.h" |
| 14 | +#import "CNLiveCategory.h" | ||
| 14 | 15 | ||
| 15 | @interface CNLiveMineNavigationBar () | 16 | @interface CNLiveMineNavigationBar () |
| 16 | @property (nonatomic, strong) UIImageView *header; | 17 | @property (nonatomic, strong) UIImageView *header; |
| @@ -80,7 +81,7 @@ static const NSInteger margin = 10; | @@ -80,7 +81,7 @@ static const NSInteger margin = 10; | ||
| 80 | _header.userInteractionEnabled = YES; | 81 | _header.userInteractionEnabled = YES; |
| 81 | _header.layer.masksToBounds = YES; | 82 | _header.layer.masksToBounds = YES; |
| 82 | _header.layer.cornerRadius = 15; | 83 | _header.layer.cornerRadius = 15; |
| 83 | - UIImage *xw_image = [self xw_getImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineNavigationBar class]]; | 84 | + UIImage *xw_image = [self getImageWithImageName:@"default_avatar_y" bundleName:@"CNLiveMineModule" targetClass:[CNLiveMineNavigationBar class]]; |
| 84 | [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; | 85 | [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; |
| 85 | 86 | ||
| 86 | } | 87 | } |
| @@ -101,21 +102,4 @@ static const NSInteger margin = 10; | @@ -101,21 +102,4 @@ static const NSInteger margin = 10; | ||
| 101 | return _name; | 102 | return _name; |
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | -/** | ||
| 105 | - * 创建图片 | ||
| 106 | - * | ||
| 107 | - * @param imageName 图片名字 | ||
| 108 | - * @param bundleName 图片所在的bundle名字 | ||
| 109 | - * @param targetClass 类和bundle的同级目录 | ||
| 110 | - * @return 返回UIImage | ||
| 111 | - */ | ||
| 112 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 113 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 114 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 115 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 116 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 117 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 118 | - | ||
| 119 | -} | ||
| 120 | - | ||
| 121 | @end | 105 | @end |
Example/CNLiveMineModule.xcodeproj/project.pbxproj
| @@ -234,8 +234,8 @@ | @@ -234,8 +234,8 @@ | ||
| 234 | 6003F586195388D20070C39A /* Sources */, | 234 | 6003F586195388D20070C39A /* Sources */, |
| 235 | 6003F587195388D20070C39A /* Frameworks */, | 235 | 6003F587195388D20070C39A /* Frameworks */, |
| 236 | 6003F588195388D20070C39A /* Resources */, | 236 | 6003F588195388D20070C39A /* Resources */, |
| 237 | - 1E7BBBA29D4F41A1D6785764 /* [CP] Embed Pods Frameworks */, | ||
| 238 | - 9CA642A8DAA35E37CA9DC131 /* [CP] Copy Pods Resources */, | 237 | + 07415E89EC912FCCAB43EC44 /* [CP] Embed Pods Frameworks */, |
| 238 | + 8B73392B8C7459E761F59865 /* [CP] Copy Pods Resources */, | ||
| 239 | ); | 239 | ); |
| 240 | buildRules = ( | 240 | buildRules = ( |
| 241 | ); | 241 | ); |
| @@ -326,7 +326,7 @@ | @@ -326,7 +326,7 @@ | ||
| 326 | /* End PBXResourcesBuildPhase section */ | 326 | /* End PBXResourcesBuildPhase section */ |
| 327 | 327 | ||
| 328 | /* Begin PBXShellScriptBuildPhase section */ | 328 | /* Begin PBXShellScriptBuildPhase section */ |
| 329 | - 1E7BBBA29D4F41A1D6785764 /* [CP] Embed Pods Frameworks */ = { | 329 | + 07415E89EC912FCCAB43EC44 /* [CP] Embed Pods Frameworks */ = { |
| 330 | isa = PBXShellScriptBuildPhase; | 330 | isa = PBXShellScriptBuildPhase; |
| 331 | buildActionMask = 2147483647; | 331 | buildActionMask = 2147483647; |
| 332 | files = ( | 332 | files = ( |
| @@ -432,7 +432,7 @@ | @@ -432,7 +432,7 @@ | ||
| 432 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-frameworks.sh\"\n"; | 432 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveMineModule_Example/Pods-CNLiveMineModule_Example-frameworks.sh\"\n"; |
| 433 | showEnvVarsInLog = 0; | 433 | showEnvVarsInLog = 0; |
| 434 | }; | 434 | }; |
| 435 | - 9CA642A8DAA35E37CA9DC131 /* [CP] Copy Pods Resources */ = { | 435 | + 8B73392B8C7459E761F59865 /* [CP] Copy Pods Resources */ = { |
| 436 | isa = PBXShellScriptBuildPhase; | 436 | isa = PBXShellScriptBuildPhase; |
| 437 | buildActionMask = 2147483647; | 437 | buildActionMask = 2147483647; |
| 438 | files = ( | 438 | files = ( |