Commit 39848776b71a79bd019f61e2357371d23a447d10
1 parent
c3aaab71
no message
Showing
2 changed files
with
29 additions
and
4 deletions
CNLiveIntegralModule/Classes/Tools/CNLiveSignInView.m
| ... | ... | @@ -239,7 +239,8 @@ static const NSInteger margin = 15; |
| 239 | 239 | if (!_bgView) { |
| 240 | 240 | _bgView = [[UIImageView alloc] init]; |
| 241 | 241 | _bgView.userInteractionEnabled = YES; |
| 242 | - _bgView.image = [UIImage imageNamed:@"sign_allday_bg"]; | |
| 242 | + UIImage *image = [self xw_getImageName:@"sign_allday_bg" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; | |
| 243 | + _bgView.image = image; | |
| 243 | 244 | } |
| 244 | 245 | return _bgView; |
| 245 | 246 | } |
| ... | ... | @@ -249,7 +250,8 @@ static const NSInteger margin = 15; |
| 249 | 250 | _scoreBtn.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20]; |
| 250 | 251 | // [_scoreBtn addTarget:self action:@selector(clickScoreBtn:) forControlEvents:UIControlEventTouchUpInside]; |
| 251 | 252 | [_scoreBtn setTitle:@"+0" forState:UIControlStateNormal]; |
| 252 | - [_scoreBtn setImage:[UIImage imageNamed:@"sign_in_soccer"] forState:UIControlStateNormal]; | |
| 253 | + UIImage *image = [self xw_getImageName:@"sign_in_soccer" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; | |
| 254 | + [_scoreBtn setImage:image forState:UIControlStateNormal]; | |
| 253 | 255 | [_scoreBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| 254 | 256 | _scoreBtn.adjustsImageWhenHighlighted = NO; |
| 255 | 257 | _scoreBtn.userInteractionEnabled = NO; |
| ... | ... | @@ -285,7 +287,8 @@ static const NSInteger margin = 15; |
| 285 | 287 | _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 286 | 288 | _closeBtn.titleLabel.font = UIFontMake(12); |
| 287 | 289 | [_closeBtn addTarget:self action:@selector(clickCloseBtn:) forControlEvents:UIControlEventTouchUpInside]; |
| 288 | - [_closeBtn setImage:[UIImage imageNamed:@"sign_day_close"] forState:UIControlStateNormal]; | |
| 290 | + UIImage *image = [self xw_getImageName:@"sign_day_close" bundleName:@"CNLiveIntegralModule" targetClass:[self class]]; | |
| 291 | + [_closeBtn setImage:image forState:UIControlStateNormal]; | |
| 289 | 292 | _closeBtn.adjustsImageWhenHighlighted = NO; |
| 290 | 293 | |
| 291 | 294 | } |
| ... | ... | @@ -293,4 +296,20 @@ static const NSInteger margin = 15; |
| 293 | 296 | |
| 294 | 297 | } |
| 295 | 298 | |
| 299 | +/** | |
| 300 | + * 创建图片 | |
| 301 | + * | |
| 302 | + * @param imageName 图片名字 | |
| 303 | + * @param bundleName 图片所在的bundle名字 | |
| 304 | + * @param targetClass 类和bundle的同级目录 | |
| 305 | + * @return 返回UIImage | |
| 306 | + */ | |
| 307 | +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 308 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 309 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 310 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 311 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 312 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 313 | +} | |
| 314 | + | |
| 296 | 315 | @end | ... | ... |
Example/CNLiveIntegralModule/CNLIVEAppDelegate.m
| ... | ... | @@ -10,6 +10,8 @@ |
| 10 | 10 | #import "CNLiveEnvironment.h" |
| 11 | 11 | #import "CNLiveTaskListController.h" |
| 12 | 12 | #import "CNLiveGoldWhereaboutsView.h" |
| 13 | +#import "CNLiveAddScoreView.h" | |
| 14 | +#import "CNLiveSignInView.h" | |
| 13 | 15 | |
| 14 | 16 | @implementation CNLIVEAppDelegate |
| 15 | 17 | |
| ... | ... | @@ -30,7 +32,11 @@ |
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | [self.window makeKeyAndVisible]; |
| 33 | - [CNLiveGoldWhereaboutsView showGoldWhereaboutsViewWithDesc:@"asd" delegate:self]; | |
| 35 | +// [CNLiveGoldWhereaboutsView showGoldWhereaboutsViewWithDesc:@"asd" delegate:self]; | |
| 36 | + | |
| 37 | +// [CNLiveAddScoreView showAddScoreViewWithDesc:@"asd" login:@"asdasd" delegate:self]; | |
| 38 | + | |
| 39 | + [CNLiveSignInView showSignInView:@"asd" scores:@"312" day:1 url:@"asd" delegate:self]; | |
| 34 | 40 | return YES; |
| 35 | 41 | } |
| 36 | 42 | ... | ... |