- MJFooter下拉刷新时候, 不显示刷新中和没有数据等的文字
MJRefreshAutoStateFooter *footer = [MJRefreshAutoStateFooter footerWithRefreshingBlock:^{
[weakSelf requestMatchScheduleMoreDataNoLoadingView];
}];
[footer setTitle:@"" forState:MJRefreshStateNoMoreData];
[footer setTitle:@"" forState:MJRefreshStateRefreshing];
- NSUrl 解析 url scheme
- (void)test3{
NSString *urlStr = @"https://www.jianshu123.com/p/d32351b5c1dfs#aaa?wd=UIScrollview嵌套&rsv_spt=1&rsv_iqid=0xd3e7235e000812de&issp=1&f=3&rsv_bp=1&rsv_idx=2&ie=utf-8&rqlang=cn&tn=baiduhome_pg&rsv_enter=1";
NSCharacterSet *allowedCharacters = [NSCharacterSet URLQueryAllowedCharacterSet];
NSString *encodedUrl = [urlStr stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
NSURL *url = [NSURL URLWithString:encodedUrl];
NSDictionary *dictM = [NSMutableDictionary dictionaryWithCapacity:2];
NSArray *arrayQuery = [url.query componentsSeparatedByString:@"&"];
for (NSString *paramsStr in arrayQuery) {
NSArray *keyValueArray = [paramsStr componentsSeparatedByString:@"="];
if ([keyValueArray isKindOfClass:[NSArray class]] && keyValueArray.count == 2) {
[dictM setValue:keyValueArray[1] forKey:keyValueArray[0]];
NSLog(@"%@---%@",keyValueArray[0],keyValueArray[1]);
}
}
}
- 键盘弹起时, 视图跟着动画
- (void)viewDidLoad {
[super viewDidLoad];
[self bindActiveAndAppear];
}
- (void)bindActiveAndAppear
{
@weakify(self);
[[RACSignal combineLatest:@[RACObserve(self, appear),RACObserve([PTVAppStatusModule sharedInstance], appActive)] reduce:^id (NSNumber* appear, NSNumber* active){
return @(appear.boolValue && active.boolValue);
}] subscribeNext:^(NSNumber* x) {
@strongify(self);
if(x.boolValue) {
[self an_subscribeKeyboardWithAnimations:^(CGRect keyboardRect, NSTimeInterval duration, BOOL isShowing) {
[self.groupMsgView mas_updateConstraints:^(MASConstraintMaker *make) {
if (isShowing) {
make.bottom.equalTo(self.view).offset(-keyboardRect.size.height);
} else {
make.bottom.equalTo(self.view);
}
}];
[self.view layoutIfNeeded];
} completion:nil];
} else {
[self an_unsubscribeKeyboard];
}
}];
}
- 只响应当前视图中的热区的事件
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
if (_eggTaskView && !_eggTaskView.hidden ) {
CGPoint newpoint = [self convertPoint:point toView:_eggTaskView.introBtn];
if (CGRectContainsPoint(_eggTaskView.introBtn.bounds, newpoint)) {
return [super hitTest:point withEvent:event];
}
}
return nil;
}
- 沉浸式点击显示/隐藏
- (void)onTap{
if (_isHeaderViewAnimating) {
return;
}
_isHeaderViewAnimating = YES;
if (_isHeaderViewShow){
_isHeaderViewShow = NO;
CGFloat headerViewTop = [self.headerView getHeaderViewHeight];
[UIView animateWithDuration:0.35 animations:^{
self.headerView.transform = CGAffineTransformMakeTranslation(0, -headerViewTop-20);
self.bottomView.transform = CGAffineTransformMakeTranslation(0, [self.bottomView getBottomViewHeight]);
} completion:^(BOOL finished) {
_isHeaderViewAnimating = NO;
}];
} else {
_isHeaderViewShow = YES;
[UIView animateWithDuration:0.35 animations:^{
self.headerView.transform = CGAffineTransformIdentity;
self.bottomView.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
_isHeaderViewAnimating = NO;
}];
}
}