Skip to content

Commit

Permalink
🕰2019-09-30 15:50:23🕰 适配iOS13, 增加一些RJTextViewCell结构配置,增加默认Config,其他细节
Browse files Browse the repository at this point in the history
  • Loading branch information
shenruijie_vendor committed Sep 30, 2019
1 parent 2cbd517 commit 9ec6c85
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 18 deletions.
2 changes: 1 addition & 1 deletion RJTableViewAgent.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "RJTableViewAgent"
s.version = "1.1.0.3"
s.version = "1.1.1.0"
s.summary = "你是追求效率的人呀~"
s.homepage = "https://github.com/shenguanjiejie/RJTableViewAgent"
s.license = { :type => 'MIT'}
Expand Down
1 change: 1 addition & 0 deletions RJTableViewAgent/RJTableViewAgent/Cells/RJCycleCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ - (NSInteger)yb_numberOfCellsInImageBrowser:(YBImageBrowser *)imageBrowser{
- (id<YBIBDataProtocol>)yb_imageBrowser:(YBImageBrowser *)imageBrowser dataForCellAtIndex:(NSInteger)index{
YBIBImageData *data = [YBIBImageData new];
RJImage *image = self.cycleImages[index];
data.projectiveView = self.imageView;
if (image.image) {
data.image = ^UIImage * _Nullable{
return image.image;
Expand Down
16 changes: 10 additions & 6 deletions RJTableViewAgent/RJTableViewAgent/Cells/RJTextViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
_numLab.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:_numLab];

NSDictionary *views = @{@"_textView":_textView,@"_lineView":self.lineView,@"_numLab":_numLab};
NSDictionary *metrics = @{@"margin":@15,@"labelH":@20};
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-margin-[_textView]-margin-|" options:0 metrics:metrics views:views]];
// [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-margin-[_lineView]-margin-|" options:0 metrics:metrics views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_lineView]-5-[_numLab(10)]|" options:NSLayoutFormatAlignAllLeft | NSLayoutFormatAlignAllRight metrics:metrics views:views]];
// NSDictionary *views = @{@"_textView":_textView,@"_lineView":self.lineView,@"_numLab":_numLab};
// NSDictionary *metrics = @{@"margin":@15,@"labelH":@20};
// [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-margin-[_textView]-margin-|" options:0 metrics:metrics views:views]];
// [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_lineView]-5-[_numLab(10)]|" options:NSLayoutFormatAlignAllLeft | NSLayoutFormatAlignAllRight metrics:metrics views:views]];
[_textView addLeftMarginConstraintWithConstant:0];
[_textView addRightMarginConstraintWithConstant:0];
[self.contentView addBottomAlignConstraintToView:_numLab constant:0];
[_numLab addRightMarginConstraintWithConstant:0];
[_numLab addHeightConstraintWithConstant:10];

_topConstraint = [NSLayoutConstraint constraintWithItem:_textView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:_topMargin];
_minHeightConstraint = [NSLayoutConstraint constraintWithItem:_textView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
Expand All @@ -70,7 +74,7 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
}

- (void)setLineViewBottomLayout{

[self.contentView addBottomAlignConstraintToView:self.lineView constant:15];
}

- (void)setTopMargin:(CGFloat)topMargin{
Expand Down
8 changes: 8 additions & 0 deletions RJTableViewAgent/RJTableViewAgent/Infos/RJTextViewCellInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ typedef NS_ENUM(NSUInteger, RJTextViewCellType) {
//@property (nonatomic, assign) CGFloat minHeight;
@property (nonatomic, strong) UIColor *numLabTextColor;

/**RJ 2019-09-30 15:35:46 _lineView到contentView底部的距离 default: 15*/
@property (nonatomic, assign) CGFloat lineViewBottomMargin;

/**RJ 2019-09-30 15:28:28 default: 0*/
@property (nonatomic, assign) CGFloat textViewTopMargin;

/**RJ 2019-09-30 15:28:28 为到_lineView的距离 default: 0*/
@property (nonatomic, assign) CGFloat textViewBottomMargin;

/**RJ 2019-09-30 15:30:25 default: 0*/
@property (nonatomic, assign) CGFloat numLabBottomMargin;

@property (nonatomic, assign) CGFloat textViewCellCurrentHeight;

@property (nonatomic, assign) CGFloat textViewMaxHeight;
Expand Down
3 changes: 3 additions & 0 deletions RJTableViewAgent/RJTableViewAgent/Infos/RJTextViewCellInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ - (instancetype)initWithIndexPath:(NSIndexPath *)indexPath placeholder:(NSString
self.lineColor = [RJTableViewAgentConfig sharedConfig].separateColor;
self.lineHeight = 1;
self.topMargin = 0;
self.lineViewBottomMargin = 15;
self.bottomMargin = 0;
self.numLabBottomMargin = 0;
self.autoNumLabHidden = YES;
self.textViewUserInteractionEnabled = YES;
self.placeholderColor = [RJTableViewAgentConfig sharedConfig].placeholderColor;
Expand Down
2 changes: 2 additions & 0 deletions RJTableViewAgent/RJTableViewAgent/RJTableViewAgent.m
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
textViewCell.textView.placeholder = textViewInfo.placeholder;
textViewCell.textView.placeholderColor = textViewInfo.placeholderColor;

textViewCell.lineView.bottomConstraint.constant = -textViewInfo.lineViewBottomMargin;
textViewCell.topMargin = textViewInfo.topMargin;
textViewCell.minHeight = textViewInfo.minHeight;
textViewCell.bottomMargin = textViewInfo.bottomMargin;
textViewCell.numLab.bottomConstraint.constant = -textViewInfo.numLabBottomMargin;
textViewCell.textView.textViewMaxLength = textViewInfo.maxTextLength;
textViewCell.textView.font = textViewInfo.font;
textViewCell.textView.userInteractionEnabled = textViewInfo.textViewUserInteractionEnabled;
Expand Down
20 changes: 18 additions & 2 deletions RJTableViewAgent/RJTableViewAgent/Utils/RJTableViewAgentConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,45 @@
//

#import "RJTableViewAgentConfig.h"
#import "RJTableViewAgentMacros.h"

@implementation RJTableViewAgentConfig

static RJTableViewAgentConfig *_instance;

+ (id)allocWithZone:(NSZone *)zone{
static dispatch_once_t onceToken;
if (_instance) {
return _instance;
}

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [super allocWithZone:zone];
[self config];
});

return _instance;
}

+ (RJTableViewAgentConfig *)sharedConfig{

if (_instance) {
return _instance;
}
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[self alloc] init];
[self config];
});

return _instance;
}

+ (void)config{
_instance.textColor = kRJBlackColor;
_instance.subTextColor = kRJRGBAColor(153, 153, 153, 1);
_instance.separateColor = kRJSeparateColor;
_instance.placeholderColor = kRJSeparateColor;
_instance.placeholderImage = [UIImage imageNamed:@"rj_placeholderImage"];
_instance.rightArrow = [UIImage imageNamed:@"rj_right_arrow"];
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

/**RJ 2019-01-02 14:25:22 参考 https://github.com/shenguanjiejie/UITextView-Placeholder*/
/**RJ 2019-01-02 14:25:22 参考 https://github.com/shenguanjiejie/UITextView-Placeholder */

@import UIKit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ + (UIColor *)defaultPlaceholderColor {
dispatch_once(&onceToken, ^{
UITextField *textField = [[UITextField alloc] init];
textField.placeholder = @" ";
color = [textField valueForKeyPath:@"_placeholderLabel.textColor"];
color = [UIColor colorWithRed:199/255.0 green:199/255.0 blue:205/255.0 alpha:1.0];
});
return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

- (void)showAutohideMessage:(NSString *)message;

- (void)hideHud;
- (void)removeHud;

-(void)showHudWithMessage:(NSString *)message;

Expand Down
11 changes: 5 additions & 6 deletions RJTableViewAgent/RJTableViewAgent/Utils/UIView+RJMBProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ -(MBProgressHUD *)rj_hud{

-(void)show:(NSString *)text icon:(NSString *)icon autohide:(BOOL)autohide
{
[self hideHud];
[self removeHud];

self.rj_hud = [MBProgressHUD showHUDAddedTo:self animated:YES];
self.rj_hud.detailsLabel.font = [UIFont systemFontOfSize:16];
Expand All @@ -56,7 +56,7 @@ -(void)show:(NSString *)text icon:(NSString *)icon autohide:(BOOL)autohide
self.rj_hud.customView = imageView;

if (autohide) {
[self.rj_hud hideAnimated:YES afterDelay:1 + text.length * 0.05];
[self.rj_hud hideAnimated:YES afterDelay:1 + text.length * 0.1];
}
}

Expand Down Expand Up @@ -85,9 +85,8 @@ -(void)showHudWithMessage:(NSString *)message{
if (self.rj_hud.mode == MBProgressHUDModeIndeterminate) {
self.rj_hud.detailsLabel.text = message;
return;
}else if (self.rj_hud.mode == MBProgressHUDModeCustomView || self.rj_hud.mode == MBProgressHUDModeText){
[self.rj_hud removeFromSuperview];
self.rj_hud = nil;
}else{
[self removeHud];
}
}

Expand All @@ -99,7 +98,7 @@ -(void)showHudWithMessage:(NSString *)message{
self.rj_hud.detailsLabel.text = message;
}

- (void)hideHud{
- (void)removeHud{
if (self.rj_hud) {
[self.rj_hud hideAnimated:YES];
[self.rj_hud removeFromSuperview];
Expand Down
1 change: 1 addition & 0 deletions RJTableViewAgent/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ - (void)addTextViewCell{
textViewInfo.bindingStringValidatePrefix = @"椭圆框框内";
/**RJ 2019-01-01 16:28:08 用来设置固定cell高度*/
textViewInfo.cellHeight = 150;
textViewInfo.maxTextLength = 150;
}

- (void)addCollectionViewCell{
Expand Down

0 comments on commit 9ec6c85

Please sign in to comment.