Commit f18657e1 authored by luyueming's avatar luyueming

无效的文件

parent aedadf30
//
// GMLiveLikeView.h
// Gengmei
//
// Created by licong on 2017/1/6.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
//直播点赞按钮
typedef void(^LiveLikeClickedBlock)(void);
@interface GMLiveLikeView : UIView
@property (nonatomic, copy) LiveLikeClickedBlock liveLikeClickedBlock;
@end
//
// GMLiveLikeView.m
// Gengmei
//
// Created by licong on 2017/1/6.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMLiveLikeView.h"
#import "GMButton.h"
@import GMKit;
@interface GMLiveLikeView ()
@property (strong ,nonatomic) GMButton *button;
@end
@implementation GMLiveLikeView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup{
_button = [GMButton buttonWithType:UIButtonTypeCustom];
_button.frame = self.bounds;
_button.enableAdaptive = YES;
_button.adjustsImageWhenHighlighted = NO;
[_button setImage:[UIImage imageNamed:@"live_heart_nor"] forState:UIControlStateNormal];
[_button addTarget:self action:@selector(likeButtonClicked) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_button];
}
- (void)layoutSubviews{
[super layoutSubviews];
_button.frame = self.bounds;
}
- (void)likeButtonClicked{
UIView * gradientView = [[UIView alloc]
initWithFrame:self.bounds];
gradientView.frame = self.bounds;
gradientView.layer.cornerRadius = self.frame.size.height/2;
gradientView.userInteractionEnabled = NO;
gradientView.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
gradientView.layer.cornerRadius = self.frame.size.height/2;
gradientView.backgroundColor = RGBCOLOR_HEX(0xFF7690);
gradientView.hidden = YES;
[self addSubview:gradientView];
gradientView.alpha = 1;
gradientView.hidden = NO;
gradientView.transform = CGAffineTransformMakeScale(1, 1);
[_button setImage:[UIImage imageNamed:@"live_heart_pre"] forState:UIControlStateNormal];
[UIView animateWithDuration:0.3
animations:^{
gradientView.alpha = 0.3;
gradientView.transform = CGAffineTransformMakeScale(2, 2);
}completion:^(BOOL finish){
[gradientView removeFromSuperview];
[_button setImage:[UIImage imageNamed:@"live_heart_nor"] forState:UIControlStateNormal];
}];
if (self.liveLikeClickedBlock) {
self.liveLikeClickedBlock();
}
}
@end
//
// UIView+GMGradient.h
// Gengmei
//
// Created by zhouLiang on 2020/2/23.
// Copyright © 2020 更美互动信息科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (GMGradient)
@property(nullable, copy) NSArray *colors;
@property(nullable, copy) NSArray<NSNumber *> *locations;
@property CGPoint startPoint;
@property CGPoint endPoint;
+ (UIView *_Nullable)gradientViewWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
- (void)setGradientBackgroundWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
@end
NS_ASSUME_NONNULL_END
//
// UIView+GMGradient.m
// Gengmei
//
// Created by zhouLiang on 2020/2/23.
// Copyright © 2020 更美互动信息科技有限公司. All rights reserved.
//
#import "UIView+GMGradient.h"
@implementation UIView (GMGradient)
+ (Class)layerClass {
return [CAGradientLayer class];
}
+ (UIView *)gradientViewWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
UIView *view = [[self alloc] init];
[view setGradientBackgroundWithColors:colors locations:locations startPoint:startPoint endPoint:endPoint];
return view;
}
- (void)setGradientBackgroundWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
NSMutableArray *colorsM = [NSMutableArray array];
for (UIColor *color in colors) {
[colorsM addObject:(__bridge id)color.CGColor];
}
self.colors = [colorsM copy];
self.locations = locations;
self.startPoint = startPoint;
self.endPoint = endPoint;
}
@end
//UIView+AZGradient.m
//
// UIView+Gradient.h
// Gengmei
//
// Created by Terminator on 2018/8/15.
// Copyright © 2018年 更美互动信息科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (Gradient)
@property(nullable, copy) NSArray *colors;
@property(nullable, copy) NSArray<NSNumber *> *locations;
@property CGPoint startPoint;
@property CGPoint endPoint;
+ (UIView *_Nullable)gradientViewWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
- (void)setGradientBackgroundWithColors:(NSArray<UIColor *> *_Nullable)colors locations:(NSArray<NSNumber *> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
/**
从一个颜色变化到另一个颜色
@param beginColor 开始颜色
@param endColor 结束颜色
@param percent 百分比
*/
- (void)getColorWithColor:(UIColor *_Nullable)beginColor endColor:(UIColor *_Nullable)endColor percent:(double)percent;
@end
//
// UIView+Gradient.m
// Gengmei
//
// Created by Terminator on 2018/8/15.
// Copyright © 2018年 更美互动信息科技有限公司. All rights reserved.
//
#import "UIView+Gradient.h"
#import <objc/runtime.h>
@implementation UIView (Gradient)
+ (Class)layerClass {
return [CAGradientLayer class];
}
+ (UIView *)gradientViewWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
UIView *view = [[self alloc] init];
[view setGradientBackgroundWithColors:colors locations:locations startPoint:startPoint endPoint:endPoint];
return view;
}
- (void)setGradientBackgroundWithColors:(NSArray<UIColor *> *)colors locations:(NSArray<NSNumber *> *)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint {
NSMutableArray *colorsM = [NSMutableArray array];
for (UIColor *color in colors) {
[colorsM addObject:(__bridge id)color.CGColor];
}
self.colors = [colorsM copy];
self.locations = locations;
self.startPoint = startPoint;
self.endPoint = endPoint;
}
- (NSArray *)getRGBDictionaryByColor:(UIColor *)originColor {
CGFloat r = 0,g = 0,b = 0,a = 0;
if ([self respondsToSelector:@selector(getRed:green:blue:alpha:)]) {
[originColor getRed:&r green:&g blue:&b alpha:&a];
} else {
const CGFloat *components = CGColorGetComponents(originColor.CGColor);
r = components[0];
g = components[1];
b = components[2];
a = components[3];
}
return @[@(r),@(g),@(b)];
}
- (NSArray *)transColorBeginColor:(UIColor *)beginColor andEndColor:(UIColor *)endColor {
NSArray<NSNumber *> *beginColorArr = [self getRGBDictionaryByColor:beginColor];
NSArray<NSNumber *> *endColorArr = [self getRGBDictionaryByColor:endColor];
return @[@([endColorArr[0] doubleValue] - [beginColorArr[0] doubleValue]),@([endColorArr[1] doubleValue] - [beginColorArr[1] doubleValue]),@([endColorArr[2] doubleValue] - [beginColorArr[2] doubleValue])];
}
- (void)getColorWithColor:(UIColor *)beginColor endColor:(UIColor *)endColor percent:(double)percent {
NSArray *colorArray = [self transColorBeginColor:beginColor andEndColor:endColor];
NSArray *beginColorArr = [self getRGBDictionaryByColor:beginColor];
double red = [beginColorArr[0] doubleValue] + percent * [colorArray[0] doubleValue];
double green = [beginColorArr[1] doubleValue]+ percent * [colorArray[1] doubleValue];
double blue = [beginColorArr[2] doubleValue] + percent * [colorArray[2] doubleValue];
self.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1];
}
#pragma mark - Getter&Setter
- (NSArray *)colors {
return objc_getAssociatedObject(self, _cmd);
}
- (void)setColors:(NSArray *)colors {
objc_setAssociatedObject(self, @selector(colors), colors, OBJC_ASSOCIATION_COPY_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[(CAGradientLayer*)self.layer setColors:self.colors];
}
}
- (NSArray<NSNumber *> *)locations {
return objc_getAssociatedObject(self, _cmd);
}
- (void)setLocations:(NSArray<NSNumber *> *)locations {
objc_setAssociatedObject(self, @selector(locations), locations, OBJC_ASSOCIATION_COPY_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setLocations:self.locations];
}
}
- (CGPoint)startPoint {
return [objc_getAssociatedObject(self, _cmd) CGPointValue];
}
- (void)setStartPoint:(CGPoint)startPoint {
objc_setAssociatedObject(self, @selector(startPoint), [NSValue valueWithCGPoint:startPoint], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setStartPoint:self.startPoint];
}
}
- (CGPoint)endPoint {
return [objc_getAssociatedObject(self, _cmd) CGPointValue];
}
- (void)setEndPoint:(CGPoint)endPoint {
objc_setAssociatedObject(self, @selector(endPoint), [NSValue valueWithCGPoint:endPoint], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if ([self.layer isKindOfClass:[CAGradientLayer class]]) {
[((CAGradientLayer *)self.layer) setEndPoint:self.endPoint];
}
}
@end
//
// WMTagObject.h
// Gengmei
//
// Created by Sean Lee on 1/21/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import <GMBase/GMObject.h>
@class GMZoneTagsObject;
@protocol WMTagObject @end
/**
* @brief 创建日记本时使用
*/
@interface WMTagObject : GMObject
/** @brief tag名称 name*/
@property (nonatomic, strong) NSString *name;
/** @brief tagId概念一样,服务器返回来的是int */
@property (nonatomic, assign) NSInteger tagId;
/*** @brief 是否选中 在3级选择项目页使用*/
@property (nonatomic, assign) BOOL isSelected;
@property (nonatomic, assign) BOOL freeToAdd;
@property (nonatomic, assign) BOOL isShowImg;
/** 活动标签tag, 7770 */
@property (nonatomic, assign) BOOL isActivityTags;
#pragma mark - since 7110
/** 热度分 */
@property (nonatomic, copy) NSString *hotScore;
/** 标签样式 */
@property (nonatomic, copy) NSString *style;
/** 标签对应图片 */
@property (nonatomic, copy) NSString *styleImageUrl;
/** 高亮 */
@property (nonatomic, copy) NSString *highlight;
/** 标签点击来源 */
@property (nonatomic, copy) NSString *tagSource;
@property (nonatomic,copy) NSString *isNewTag;
+ (WMTagObject *)constructionModel:(GMZoneTagsObject *)zoneObject;
@end
//
// WMTagObject.m
// Gengmei
//
// Created by Sean Lee on 1/21/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import "WMTagObject.h"
#import "GMZoneTagsObject.h"
@implementation WMTagObject
+ (WMTagObject *)constructionModel:(GMZoneTagsObject *)zoneObject {
WMTagObject *tagObject = [[WMTagObject alloc] init];
tagObject.tagId = zoneObject.id;
tagObject.name = zoneObject.name;
tagObject.style = zoneObject.tagType;
return tagObject;
}
@end
//
// GMSegmentViewWithRedBadge.h
// Gengmei
//
// Created by 汪俊 on 2016/11/15.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
@import GMKit;
/**
带小红点的segmentView
*/
@interface GMSegmentViewWithRedBadge : WYSegmentView
- (void)showBadge:(BOOL)isShow atIndex:(NSInteger)index NS_SWIFT_NAME(show(badge:at:));
- (BOOL)isShowBadgeAtIndex:(NSInteger)index;
@end
//
// GMSegmentViewWithRedBadge.m
// Gengmei
//
// Created by 汪俊 on 2016/11/15.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMSegmentViewWithRedBadge.h"
@implementation GMSegmentViewWithRedBadge {
NSArray<UIImageView *> *_badgeViews;
}
- (void)setup {
[super setup];
self.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH, 40);
self.backgroundColor = [UIColor whiteColor];
self.titleTextAttributes = @{NSFontAttributeName:[UIFont gmFont:15],
NSForegroundColorAttributeName:UIColor.auxiliaryTextDark};
self.selectedTitleTextAttributes = @{NSFontAttributeName:[UIFont gmBoldFont:15],
NSForegroundColorAttributeName:UIColor.headlineText};
self.showIndicator = YES;
self.widthStyle = WYSegmentViewWidthStyleEqual;
self.indicatorColor = UIColor.auxiliaryTextGreen;
}
- (void)layoutSegments {
[super layoutSegments];
NSMutableArray *badges = [NSMutableArray array];
//添加小红点
for (UIView *subview in self.scrollView.subviews) {
for (UIView *view in subview.subviews) {
if ([view isKindOfClass:[UIButton class]]) {
UIImageView *redBadge = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_badge"]];
redBadge.hidden = YES;
UIButton *button = (UIButton *)view;
[button.titleLabel addSubview:redBadge];
[redBadge mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(-1);
make.left.mas_equalTo(button.titleLabel.width);
}];
[badges addObject:redBadge];
}
}
}
_badgeViews = badges;
}
- (void)showBadge:(BOOL)isShow atIndex: (NSInteger)index {
UIImageView *badgeView = _badgeViews[index];
badgeView.hidden = !isShow;
}
- (BOOL)isShowBadgeAtIndex:(NSInteger)index {
return !_badgeViews[index].hidden;
}
@end
//
// WYSegmentView+Factory.h
// Gengmei
//
// Created by wangyang on 16/2/17.
// Copyright © 2016年 Wanmeichuangyi. All rights reserved.
//
#import <GMKit/WYSegmentView.h>
NS_ASSUME_NONNULL_BEGIN
@interface WYSegmentView (Factory)
/**
提供一个基础的,字体大小、颜色符合UI规范的segment。
*/
+ (WYSegmentView *)baseThemeSegment;
/**
* @author wangyang, 16-02-18 15:02:23
*
* @brief 用于多个标题,segment可以滑动的设计
* @since 5.9.1
*/
+ (WYSegmentView *)dynamicSegment;
/**
* @author wangyang, 16-02-18 15:02:49
*
* @brief 用于标题个数固定,segment宽度一样的设计
* @since 5.9.1
*/
+ (WYSegmentView *)fullWidthSegment;
/**
* @author wangyang, 16-02-18 16:02:51
*
* @brief 用于我的订单页的segment
* @since 5.9.1
*/
+ (WYSegmentView *)myOrderListSegment;
@end
NS_ASSUME_NONNULL_END
//
// WYSegmentView+Factory.m
// Gengmei
//
// Created by wangyang on 16/2/17.
// Copyright © 2016年 Wanmeichuangyi. All rights reserved.
//
#import "WYSegmentView+Factory.h"
@import GMKit;
@implementation WYSegmentView (Factory)
+ (WYSegmentView *)baseThemeSegment {
WYSegmentView *segment = [[WYSegmentView alloc] initWithFrame:CGRectMake(0, 0, MAINSCREEN_WIDTH, 40)];
segment.backgroundColor = [UIColor whiteColor];
segment.showIndicator = YES;
return segment;
}
+ (WYSegmentView *)dynamicSegment {
WYSegmentView *segment = [self baseThemeSegment];
segment.titleTextAttributes = @{NSFontAttributeName:[UIFont gmFont:15],
NSForegroundColorAttributeName:UIColor.auxiliaryTextDark};
segment.selectedTitleTextAttributes = @{NSFontAttributeName:[UIFont gmBoldFont:15],
NSForegroundColorAttributeName:UIColor.headlineText};
segment.scrollView.contentInset = UIEdgeInsetsMake(0, 6, 0, 6);
segment.widthStyle = WYSegmentViewWidthStyleDynamic;
segment.itemHorizonalPadding = 14;
return segment;
}
+ (WYSegmentView *)fullWidthSegment {
WYSegmentView *segment = [self baseThemeSegment];
segment.titleTextAttributes = @{NSFontAttributeName:[UIFont gmFont:15],
NSForegroundColorAttributeName:UIColor.auxiliaryTextDark};
segment.selectedTitleTextAttributes = @{NSFontAttributeName:[UIFont gmBoldFont:15],
NSForegroundColorAttributeName:UIColor.headlineText};
segment.widthStyle = WYSegmentViewWidthStyleEqual;
return segment;
}
+ (WYSegmentView *)myOrderListSegment {
WYSegmentView *segment = [self baseThemeSegment];
segment.titleTextAttributes = @{NSFontAttributeName:[UIFont gmFont:15],
NSForegroundColorAttributeName:UIColor.auxiliaryTextDark};
segment.selectedTitleTextAttributes = @{NSFontAttributeName:[UIFont gmBoldFont:15],
NSForegroundColorAttributeName:UIColor.headlineText};
segment.widthStyle = WYSegmentViewWidthStyleEqual;
return segment;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment