Commit a64ef7769c152758f9544fe7c416efc1b9e27e95
1 parent
f904c8ea
no message
Showing
2 changed files
with
41 additions
and
9 deletions
CNLiveIntegralModule/Classes/View/CNLiveIntegralDetailsTableViewCell.m
| @@ -74,9 +74,7 @@ static const NSInteger margin = 15; | @@ -74,9 +74,7 @@ static const NSInteger margin = 15; | ||
| 74 | }]; | 74 | }]; |
| 75 | 75 | ||
| 76 | } | 76 | } |
| 77 | -- (void)dealloc{ | ||
| 78 | - | ||
| 79 | -} | 77 | + |
| 80 | #pragma mark - Data | 78 | #pragma mark - Data |
| 81 | - (void)setModel:(CNLiveScoreModel *)model{ | 79 | - (void)setModel:(CNLiveScoreModel *)model{ |
| 82 | _model = model; | 80 | _model = model; |
| @@ -97,9 +95,6 @@ static const NSInteger margin = 15; | @@ -97,9 +95,6 @@ static const NSInteger margin = 15; | ||
| 97 | // Configure the view for the selected state | 95 | // Configure the view for the selected state |
| 98 | } | 96 | } |
| 99 | 97 | ||
| 100 | -#pragma mark - Private Methods | ||
| 101 | - | ||
| 102 | - | ||
| 103 | #pragma mark - Lazy loading | 98 | #pragma mark - Lazy loading |
| 104 | - (UILabel *)titleLabel{ | 99 | - (UILabel *)titleLabel{ |
| 105 | if(_titleLabel == nil){ | 100 | if(_titleLabel == nil){ |
| @@ -128,7 +123,8 @@ static const NSInteger margin = 15; | @@ -128,7 +123,8 @@ static const NSInteger margin = 15; | ||
| 128 | _scoresBtn = [QMUIButton buttonWithType:UIButtonTypeCustom]; | 123 | _scoresBtn = [QMUIButton buttonWithType:UIButtonTypeCustom]; |
| 129 | _scoresBtn.titleLabel.font = UIFontMake(14); | 124 | _scoresBtn.titleLabel.font = UIFontMake(14); |
| 130 | [_scoresBtn setTitleColor:[UIColor colorWithRed:249/255.0 green:171/255.0 blue:37/255.0 alpha:1.0] forState:UIControlStateNormal]; | 125 | [_scoresBtn setTitleColor:[UIColor colorWithRed:249/255.0 green:171/255.0 blue:37/255.0 alpha:1.0] forState:UIControlStateNormal]; |
| 131 | - [_scoresBtn setImage:[UIImage imageNamed:@"mf_soccer_smallcoin"] forState:UIControlStateNormal]; | 126 | + UIImage *image = [self xw_getImageName:@"mf_soccer_smallcoin" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; |
| 127 | + [_scoresBtn setImage:image forState:UIControlStateNormal]; | ||
| 132 | _scoresBtn.adjustsImageWhenHighlighted = NO; | 128 | _scoresBtn.adjustsImageWhenHighlighted = NO; |
| 133 | _scoresBtn.spacingBetweenImageAndTitle = 5; | 129 | _scoresBtn.spacingBetweenImageAndTitle = 5; |
| 134 | _scoresBtn.imagePosition = QMUIButtonImagePositionRight; | 130 | _scoresBtn.imagePosition = QMUIButtonImagePositionRight; |
| @@ -146,4 +142,21 @@ static const NSInteger margin = 15; | @@ -146,4 +142,21 @@ static const NSInteger margin = 15; | ||
| 146 | 142 | ||
| 147 | } | 143 | } |
| 148 | 144 | ||
| 145 | +/** | ||
| 146 | + * 创建图片 | ||
| 147 | + * | ||
| 148 | + * @param imageName 图片名字 | ||
| 149 | + * @param bundleName 图片所在的bundle名字 | ||
| 150 | + * @param targetClass 类和bundle的同级目录 | ||
| 151 | + * @return 返回UIImage | ||
| 152 | + */ | ||
| 153 | +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 154 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 155 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 156 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 157 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 158 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 159 | + | ||
| 160 | +} | ||
| 161 | + | ||
| 149 | @end | 162 | @end |
CNLiveIntegralModule/Classes/View/CNLiveSignInButtonView.m
| @@ -38,7 +38,8 @@ static const NSInteger margin = 6; | @@ -38,7 +38,8 @@ static const NSInteger margin = 6; | ||
| 38 | btn.frame = CGRectMake(i<4?i*(width+margin):(i-4)*(width+margin), i<4?0:(margin+height), width, height); | 38 | btn.frame = CGRectMake(i<4?i*(width+margin):(i-4)*(width+margin), i<4?0:(margin+height), width, height); |
| 39 | 39 | ||
| 40 | [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside]; | 40 | [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside]; |
| 41 | - [btn setImage:[UIImage imageNamed:@"sign_day_bg"] forState:UIControlStateNormal]; | 41 | + UIImage *image = [self xw_getImageName:@"sign_day_bg" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; |
| 42 | + [btn setImage:image forState:UIControlStateNormal]; | ||
| 42 | btn.adjustsImageWhenHighlighted = NO; | 43 | btn.adjustsImageWhenHighlighted = NO; |
| 43 | btn.userInteractionEnabled = NO; | 44 | btn.userInteractionEnabled = NO; |
| 44 | [self.btnsArr addObject:btn]; | 45 | [self.btnsArr addObject:btn]; |
| @@ -46,7 +47,8 @@ static const NSInteger margin = 6; | @@ -46,7 +47,8 @@ static const NSInteger margin = 6; | ||
| 46 | 47 | ||
| 47 | if(i == 6){ | 48 | if(i == 6){ |
| 48 | btn.width = 2*width+margin; | 49 | btn.width = 2*width+margin; |
| 49 | - [btn setImage:[UIImage imageNamed:@"sign_day_bg7"] forState:UIControlStateNormal]; | 50 | + UIImage *image = [self xw_getImageName:@"sign_day_bg7" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; |
| 51 | + [btn setImage:image forState:UIControlStateNormal]; | ||
| 50 | 52 | ||
| 51 | } | 53 | } |
| 52 | 54 | ||
| @@ -142,4 +144,21 @@ static const NSInteger margin = 6; | @@ -142,4 +144,21 @@ static const NSInteger margin = 6; | ||
| 142 | return _btnsArr; | 144 | return _btnsArr; |
| 143 | } | 145 | } |
| 144 | 146 | ||
| 147 | +/** | ||
| 148 | + * 创建图片 | ||
| 149 | + * | ||
| 150 | + * @param imageName 图片名字 | ||
| 151 | + * @param bundleName 图片所在的bundle名字 | ||
| 152 | + * @param targetClass 类和bundle的同级目录 | ||
| 153 | + * @return 返回UIImage | ||
| 154 | + */ | ||
| 155 | +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | ||
| 156 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 157 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 158 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 159 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 160 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 161 | + | ||
| 162 | +} | ||
| 163 | + | ||
| 145 | @end | 164 | @end |