Commit 682e596d cgx

我的反馈列表UI

1 个父辈 d918ad95
正在显示 28 个修改的文件 包含 534 行增加11 行删除
......@@ -82,6 +82,10 @@
D09D0E96280D3FE9008DEDAB /* NSDate+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E95280D3FE9008DEDAB /* NSDate+Extras.m */; };
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E99280D507F008DEDAB /* ProfileAlertView.m */; };
D09D0E9D280D73B6008DEDAB /* InviteController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09D0E9C280D73B6008DEDAB /* InviteController.m */; };
D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE78281781CF00230DC6 /* MyFeedModel.m */; };
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */; };
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE7E2817DD1500230DC6 /* MyFeedCell.m */; };
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0AEFE802817DD1500230DC6 /* MyFeedListController.m */; };
D0B5ECA627F2D9DE003EDFE3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D0B5ECA527F2D9DE003EDFE3 /* AppDelegate.m */; };
D0B5ECAF27F2D9DE003EDFE3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D0B5ECAD27F2D9DE003EDFE3 /* Main.storyboard */; };
D0B5ECB127F2D9E0003EDFE3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D0B5ECB027F2D9E0003EDFE3 /* Assets.xcassets */; };
......@@ -269,6 +273,14 @@
D09D0E99280D507F008DEDAB /* ProfileAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProfileAlertView.m; sourceTree = "<group>"; };
D09D0E9B280D73B6008DEDAB /* InviteController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InviteController.h; sourceTree = "<group>"; };
D09D0E9C280D73B6008DEDAB /* InviteController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InviteController.m; sourceTree = "<group>"; };
D0AEFE77281781CF00230DC6 /* MyFeedModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyFeedModel.h; sourceTree = "<group>"; };
D0AEFE78281781CF00230DC6 /* MyFeedModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyFeedModel.m; sourceTree = "<group>"; };
D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableViewCell+CardRadius.m"; sourceTree = "<group>"; };
D0AEFE7B2817D13400230DC6 /* UITableViewCell+CardRadius.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableViewCell+CardRadius.h"; sourceTree = "<group>"; };
D0AEFE7D2817DD1500230DC6 /* MyFeedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyFeedCell.h; sourceTree = "<group>"; };
D0AEFE7E2817DD1500230DC6 /* MyFeedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyFeedCell.m; sourceTree = "<group>"; };
D0AEFE7F2817DD1500230DC6 /* MyFeedListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyFeedListController.h; sourceTree = "<group>"; };
D0AEFE802817DD1500230DC6 /* MyFeedListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyFeedListController.m; sourceTree = "<group>"; };
D0B5ECA127F2D9DE003EDFE3 /* DreamSleepDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DreamSleepDev.app; sourceTree = BUILT_PRODUCTS_DIR; };
D0B5ECA427F2D9DE003EDFE3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
D0B5ECA527F2D9DE003EDFE3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
......@@ -817,8 +829,16 @@
D0D3826428124E34005BB219 /* Feedback */ = {
isa = PBXGroup;
children = (
D0AEFE7D2817DD1500230DC6 /* MyFeedCell.h */,
D0AEFE7E2817DD1500230DC6 /* MyFeedCell.m */,
D0AEFE7F2817DD1500230DC6 /* MyFeedListController.h */,
D0AEFE802817DD1500230DC6 /* MyFeedListController.m */,
D0AEFE7B2817D13400230DC6 /* UITableViewCell+CardRadius.h */,
D0AEFE7A2817D13400230DC6 /* UITableViewCell+CardRadius.m */,
D0D3826528124E8A005BB219 /* FeedbackController.h */,
D0D3826628124E8A005BB219 /* FeedbackController.m */,
D0AEFE77281781CF00230DC6 /* MyFeedModel.h */,
D0AEFE78281781CF00230DC6 /* MyFeedModel.m */,
);
path = Feedback;
sourceTree = "<group>";
......@@ -1102,6 +1122,7 @@
D0B5ECB727F2D9E0003EDFE3 /* main.m in Sources */,
D07DACA62810557D0067A1BF /* RSKTouchView.m in Sources */,
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */,
D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */,
D0506B0C280503A800229278 /* UIButton+Extras.m in Sources */,
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
......@@ -1126,6 +1147,7 @@
D0930F1B2801874B006B497A /* UINavigationController+Pop.m in Sources */,
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D0AEFE812817DD1500230DC6 /* MyFeedCell.m in Sources */,
D0506B1528051ED400229278 /* SafeSleepModel.m in Sources */,
D0874BBF2816E61000CECB3C /* RescuePlanView.m in Sources */,
D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */,
......@@ -1134,6 +1156,8 @@
D0878F4C280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m in Sources */,
D0F80907280431100097899F /* UILabel+Extras.m in Sources */,
D04B3DAC27F6EEB50022F8DF /* DSTabBarController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D09BF331280E570D00E5F06C /* UserModel.m in Sources */,
D0C50B4F27FD832300DC68F0 /* LeadView.m in Sources */,
D0BE32E9281551EB006539BE /* ShareAlertView.m in Sources */,
......
......@@ -6,7 +6,6 @@
//
#import "HomeTableView.h"
#import "DSGifHeader.h"
#import "HomeHeaderView.h"
#import "SafeSleepCell.h"
#import "HomeRequestModel.h"
......@@ -24,10 +23,7 @@
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
self.separatorStyle = UITableViewCellSeparatorStyleNone;
self.showsVerticalScrollIndicator = NO;
// iOS 15适配UITableView内容自动下移22像素BUG
if (@available(iOS 15.0, *)) {
self.sectionHeaderTopPadding = 0;
}
[self.homeDataSource addDataArray:[SafeSleepModel getDatas]];
self.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
......
......@@ -44,6 +44,9 @@
[self initUM];
[self initWeChat];
// 全局适配:iOS15适配UITableView内容自动下移22像素BUG
if (@available(iOS 15.0, *)) { [UITableView appearance].sectionHeaderTopPadding = 0; }
return YES;
}
......
......@@ -6,6 +6,7 @@
//
#import "FeedbackController.h"
#import "MyFeedListController.h"
@interface FeedbackController ()
@property (strong, nonatomic) UITextView *feedTV;
......@@ -52,6 +53,11 @@
}];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.feedTV endEditing:YES];
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
......@@ -59,7 +65,8 @@
#pragma mark - Actions
- (void)myFeedAction {
MyFeedListController *myFeedVC = [MyFeedListController new];
[self.navigationController pushViewController:myFeedVC animated:YES];
}
- (void)commitAction {
......@@ -75,10 +82,9 @@
if (!_feedTV) {
_feedTV = [[UITextView alloc] init];
_feedTV.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xf0f0f0), CornerViewDarkColor, DSWhite);
_feedTV.dk_textColorPicker = DKColorPickerWithColors(ColorFromHex(0x777777), DSWhite, DSWhite);
_feedTV.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DarkTextColor, DSWhite);
_feedTV.font = SysFont(14);
[_feedTV cornerRadius:12];
[_feedTV becomeFirstResponder];
}
return _feedTV;
}
......
#import <UIKit/UIKit.h>
#import "UITableViewCell+CardRadius.h"
NS_ASSUME_NONNULL_BEGIN
static NSString *const cardRadiusCellIdentifier = @"cardRadiusCellIdentifier";
@interface MyFeedCell : UITableViewCell
@end
NS_ASSUME_NONNULL_END
#import "MyFeedCell.h"
@interface MyFeedCell ()
@property (nonatomic, strong) UIImageView *replyStatusIV;
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *contentLab;
@property (nonatomic, strong) UILabel *createdDate;
@end
@implementation MyFeedCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.contentView addSubview:self.replyStatusIV];
[self.contentView addSubview:self.titleLab];
[self.contentView addSubview:self.createdDate];
[self.contentView addSubview:self.contentLab];
[self updateUI];
}
return self;
}
- (void)layoutSubviews {
[self.replyStatusIV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(23);
make.top.equalTo(self.contentView).offset(22.5);
make.height.width.equalTo(@20);
}];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.replyStatusIV.mas_right).offset(8);
make.centerY.equalTo(self.replyStatusIV);
}];
[self.createdDate mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(@(-23));
make.centerY.equalTo(self.replyStatusIV);
}];
[self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.replyStatusIV);
make.top.equalTo(self.replyStatusIV.mas_bottom).offset(5);
make.right.equalTo(self.createdDate);
make.bottom.equalTo(self.contentView).offset(-22.5);
}];
}
- (void)updateUI {
self.replyStatusIV.image = [UIImage imageNamed:@"waiting_reply"];
self.titleLab.text = @"新回复";
[self.titleLab sizeToFit];
self.createdDate.text = @"06-21 22:00";
[self.createdDate sizeToFit];
self.contentLab.text = @"睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠睡眠";
}
#pragma mark - lazy
- (UIImageView *)replyStatusIV {
if (!_replyStatusIV) {
_replyStatusIV = [UIImageView new];
}
return _replyStatusIV;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel labWithFont:BoldFont(15)];
_titleLab.textAlignment = NSTextAlignmentLeft;
_titleLab.dk_textColorPicker = DKColorPickerWithColors(MainTextColor, ColorFromHex(0xE8E9E9), DSWhite);
}
return _titleLab;
}
- (UILabel *)createdDate {
if (!_createdDate) {
_createdDate = [UILabel labWithFont:SysFont(12)];
_titleLab.textAlignment = NSTextAlignmentRight;
_createdDate.dk_textColorPicker = DKColorPickerWithColors(SmallTextColor, ColorFromHex(0x5C6274), DSWhite);
}
return _createdDate;
}
- (UILabel *)contentLab {
if (!_contentLab) {
_contentLab = [UILabel labWithFont:SysFont(14)];
_contentLab.numberOfLines = 0;
_contentLab.dk_textColorPicker = DKColorPickerWithColors(SubTitleColor, DarkTextColor, DSWhite);
}
return _contentLab;
}
@end
#import <UIKit/UIKit.h>
@interface MyFeedListController : UIViewController
@end
#import "MyFeedListController.h"
#import "MyFeedCell.h"
@interface MyFeedListController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *feedbackIV;
@end
@implementation MyFeedListController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"我的反馈";
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self.view addSubview:self.feedbackIV];
// WS(weakSelf);
// self.feedbackIV.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
// [weakSelf.feedbackIV.mj_header endRefreshing];
// }];
// [self.feedbackIV.mj_header beginRefreshing];
}
#pragma mark - UITableViewDelegate && UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 110.f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 7.5;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 7.5)];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 7.5;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 7.5)];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MyFeedCell *cell = [tableView dequeueReusableCellWithIdentifier:cardRadiusCellIdentifier];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
UIRectCorner corner = UIRectCornerAllCorners;
[cell insetCardViewWithCorners:corner
edgeInsets:UIEdgeInsetsMake(7.5, 15.0, 7.5, 15.0)
radius:12.f
borderWidth:1.f
borderCorlor:DSClearColor
backgroundColor:([self.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? DSWhite : CornerViewDarkColor)];
}
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath {
dispatch_async(dispatch_get_main_queue(), ^{
[self setupSlideBtnWithEditingIndexPath:indexPath];
});
}
- (NSArray*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"删除按钮宽度" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// 删除反馈请求
// 这句很重要,退出编辑模式,隐藏左滑菜单
[tableView setEditing:NO animated:YES];
}];
return @[deleteAction];
}
#pragma mark - 设置左滑按钮的样式
- (void)setupSlideBtnWithEditingIndexPath:(NSIndexPath *)editingIndexPath {
// 判断系统是否是iOS13及以上版本
if (@available(iOS 13.0, *)) {
for (UIView *subView in self.feedbackIV.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"_UITableViewCellSwipeContainerView")] && [subView.subviews count] >= 1) {
// 修改图片
UIView *remarkContentView = subView.subviews.firstObject;
[self setupRowActionView:remarkContentView];
}
}
return;
}
// 判断系统是否是 iOS11 及以上版本
if (@available(iOS 11.0, *)) {
for (UIView *subView in self.feedbackIV.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UISwipeActionPullView")] && [subView.subviews count] >= 1) {
// 修改图片
UIView *remarkContentView = subView;
[self setupRowActionView:remarkContentView];
}
}
return;
}
// iOS11 以下的版本
MyFeedCell *cell = [self.feedbackIV cellForRowAtIndexPath:editingIndexPath];
for (UIView *subView in cell.subviews) {
if ([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")] && [subView.subviews count] >= 1) {
// 修改图片
UIView *remarkContentView = subView;
[self setupRowActionView:remarkContentView];
}
}
}
- (void)setupRowActionView:(UIView *)rowActionView {
CGRect frame = rowActionView.frame;
frame.origin.y += (7.5);
frame.size.height -= (15);
rowActionView.frame = frame;
rowActionView.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
// 拿到原来的删除按钮
UIButton *oriDeleteBtn = rowActionView.subviews.firstObject;
oriDeleteBtn.hidden = YES;
// 自定义删除按钮
UIButton *cusDeleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, oriDeleteBtn.width - 15, oriDeleteBtn.height)];
[cusDeleteBtn cornerRadius:12];
cusDeleteBtn.dk_backgroundColorPicker = DKColorPickerWithColors(DSWhite, CornerViewDarkColor, DSWhite);
[cusDeleteBtn dk_setImage:DKImagePickerWithNames(@"delete_feed_icon", @"dk_delete_feed_icon", @"delete_feed_icon") forState:UIControlStateNormal];
[rowActionView addSubview:cusDeleteBtn];
}
#pragma mark - lazy
- (UITableView *)feedbackIV {
if (!_feedbackIV) {
_feedbackIV = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0)) style:UITableViewStylePlain];
_feedbackIV.delegate = self;
_feedbackIV.dataSource = self;
_feedbackIV.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
_feedbackIV.showsVerticalScrollIndicator = NO;
[_feedbackIV registerClass:[MyFeedCell class] forCellReuseIdentifier:cardRadiusCellIdentifier];
_feedbackIV.separatorStyle = UITableViewCellSeparatorStyleNone;
}
return _feedbackIV;
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
@end
//
// MyFeedModel.h
// DreamSleep
//
// Created by peter on 2022/4/26.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 我的反馈数据model
@interface MyFeedModel : NSObject
// 反馈建议id
@property (nonatomic, assign) int feed_id;
// 标题
@property (nonatomic, copy) NSString *title;
// 反馈内容
@property (nonatomic, copy) NSString *content;
// 反馈图片
@property (nonatomic, copy) NSString *content_img;
// 反馈时间
@property (nonatomic, copy) NSString *created_at;
// 是否回复
@property (nonatomic, assign) int reply_status;
// 是否查阅
@property (nonatomic, assign) int read_status;
@end
NS_ASSUME_NONNULL_END
//
// MyFeedModel.m
// DreamSleep
//
// Created by peter on 2022/4/26.
//
#import "MyFeedModel.h"
@implementation MyFeedModel
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
return @{@"feed_id" : @"id"};
}
@end
//
// UITableViewCell+CardRadius.h
// CardRadius
//
// Created by le tong on 2019/2/22.
// Copyright © 2019 iOS. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableViewCell (CardRadius)
- (void)insetCardViewWithCorners:(UIRectCorner)byRoundingCorners
edgeInsets:(UIEdgeInsets)edgeInsets
radius:(CGFloat)radius
borderWidth:(CGFloat)borderWidth
borderCorlor:(UIColor *)borderCorlor
backgroundColor:(UIColor *)backgroundColor;
@end
@interface CardRadiusImageViews : UIImageView
+ (UIImage *)drawRectWithRoundedCornerRadius:(CGFloat)radius
size:(CGSize)size
byRoundingCorners:(UIRectCorner)byRoundingCorners
borderWidth:(CGFloat)borderWidth
backgroundColor:(UIColor *)backgroundColor
borderCorlor:(UIColor *)borderColor;
@end
NS_ASSUME_NONNULL_END
//
// UITableViewCell+CardRadius.m
// CardRadius
//
// Created by le tong on 2019/2/22.
// Copyright © 2019 iOS. All rights reserved.
//
#import "UITableViewCell+CardRadius.h"
#import <Masonry.h>
@implementation UITableViewCell (CardRadius)
- (void)insetCardViewWithCorners:(UIRectCorner)byRoundingCorners
edgeInsets:(UIEdgeInsets)edgeInsets
radius:(CGFloat)radius
borderWidth:(CGFloat)borderWidth
borderCorlor:(UIColor *)borderCorlor
backgroundColor:(UIColor *)backgroundColor
{
if ([self.contentView.subviews.firstObject isKindOfClass:[CardRadiusImageViews class]]) {
return;
}
self.backgroundColor = [UIColor clearColor];
CardRadiusImageViews *imgCornerRadiu = [[CardRadiusImageViews alloc] init];
imgCornerRadiu.image = [CardRadiusImageViews drawRectWithRoundedCornerRadius:radius size:self.contentView.bounds.size byRoundingCorners:byRoundingCorners borderWidth:borderWidth backgroundColor:backgroundColor borderCorlor:borderCorlor];
[self.contentView insertSubview:imgCornerRadiu atIndex:0];
[imgCornerRadiu mas_makeConstraints:^(MASConstraintMaker *make){
make.edges.insets(edgeInsets);
}];
}
@end
@implementation CardRadiusImageViews
+ (UIImage *)drawRectWithRoundedCornerRadius:(CGFloat)radius
size:(CGSize)size
byRoundingCorners:(UIRectCorner)byRoundingCorners
borderWidth:(CGFloat)borderWidth
backgroundColor:(UIColor *)backgroundColor
borderCorlor:(UIColor *)borderColor
{
// 绘制大小
CGSize sizeToFit = size;
backgroundColor = backgroundColor == nil ? [UIColor whiteColor] :backgroundColor;
CGFloat halfBorderWidth = borderWidth / 2.0;
UIGraphicsBeginImageContextWithOptions(sizeToFit, NO, [UIScreen mainScreen].scale);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, borderWidth);
CGContextSetStrokeColorWithColor(context, borderColor.CGColor);
CGContextSetFillColorWithColor(context, backgroundColor.CGColor);
CGFloat width = sizeToFit.width, height = sizeToFit.height;
CGContextMoveToPoint(context, width - halfBorderWidth, radius + halfBorderWidth);
// 弧度
CGContextAddArcToPoint(context, width - halfBorderWidth, height - halfBorderWidth, width - radius - halfBorderWidth, height - halfBorderWidth, (byRoundingCorners & UIRectCornerBottomRight) ? radius : 0);
CGContextAddArcToPoint(context, halfBorderWidth, height - halfBorderWidth, halfBorderWidth, height - radius - halfBorderWidth, (byRoundingCorners & UIRectCornerBottomLeft) ? radius : 0);
CGContextAddArcToPoint(context, halfBorderWidth, halfBorderWidth, width - halfBorderWidth, halfBorderWidth, (byRoundingCorners & UIRectCornerTopLeft) ? radius : 0);
CGContextAddArcToPoint(context, width - halfBorderWidth, halfBorderWidth, width - halfBorderWidth, radius + halfBorderWidth, (byRoundingCorners & UIRectCornerTopRight) ? radius : 0);
CGContextDrawPath(UIGraphicsGetCurrentContext(), kCGPathFillStroke);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
......@@ -113,7 +113,7 @@
#pragma mark - others
- (UIButton *)btnWithTitle:(NSString *)title index:(int)index imgName:(NSString *)imgName superView:(UIView *)sv {
UIButton *btn = [UIButton btnWithTitle:title font:SysFont(12)];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(ColorFromHex(0x777777), DSWhite, DSWhite) forState:UIControlStateNormal];
[btn dk_setTitleColorPicker:DKColorPickerWithColors(SubTitleColor, DSWhite, DSWhite) forState:UIControlStateNormal];
btn.tag = index;
[btn setImage:[UIImage imageNamed:imgName] forState:UIControlStateNormal];
[btn adjustLayoutWithType:UIButtonLayoutTypeUpImageBottomTitle midSpace:2 sizeToFit:YES];
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "delete_feed_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "delete_feed_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "delete_feed_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_delete_feed_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_delete_feed_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_delete_feed_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "waiting_reply.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "waiting_reply@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "waiting_reply@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -70,9 +70,11 @@
#define CornerViewDarkColor ColorFromHex(0x1F263F)
// 分割线颜色
#define DivideLineColor ColorFromHex(0xE6E6E6)
// 不使用透明度,直接用颜色值
#define DarkTextColor ColorFromHex(0x6D7282)
// 小文案颜色
#define SmallTextColor ColorFromHex(0xAAAAAA)
/** 副文案颜色 */
#define SubTextColor [UIColor colorWithHexString:@"#A0A0A0"]
/** 突出显示文案颜色 */
#define HighlightColor ColorFromHex(0x1AB69A)
/** 紧急提示文案颜色 */
......
......@@ -33,6 +33,7 @@
#import "DsWebController.h"
#import "DSProgressHUD.h"
#import "DSGifHeader.h"
#import "LoginUtils.h"
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!