Commit d51796be by 刘卓鑫

no message

parent 7f6720e0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>
//
//
// ZXBDSteamTableViewCell.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/5/28.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXBDSteamTableViewCell : UITableViewCell
@property (nonatomic, weak) UIViewController *fromVc;
@property (nonatomic, strong) UIWebView *webView;
@property (nonatomic, assign) BOOL isOpenScrool;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXBDSteamTableViewCell.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/5/28.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXBDSteamTableViewCell.h"
#import "LoginJump.h"
#import <AdSupport/ASIdentifierManager.h>
#import "ZXNewsViewController.h"
@interface ZXBDSteamTableViewCell()<UIWebViewDelegate, UIScrollViewDelegate>
@property (nonatomic, copy) NSString *webUrl;
@property (nonatomic, assign) BOOL scrollIsUp;
@end
@implementation ZXBDSteamTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
LoginJump *m = [LoginJump findAll].lastObject;
NSDictionary *diccc = [ZXTool dictionaryWithJsonString:[m.modelUrl mj_JSONString]];
UILabel *la;
if (diccc[@"title"] != nil && ![diccc[@"title"] isEqualToString:@""]) {
la = [[UILabel alloc] init];
[self.contentView addSubview:la];
[la mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView).offset(15 * k6Scale);
}];
la.textAlignment = NSTextAlignmentCenter;
la.backgroundColor = [UIColor whiteColor];
la.text = diccc[@"title"]?diccc[@"title"]:@"热点资讯";
UIView *line = [[UIView alloc] init];
[self.contentView addSubview:line];
line.backgroundColor = kRGBColor(239, 239, 239, 1);
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(la.mas_bottom).offset(15 * k6Scale);
make.height.mas_equalTo(1);
make.left.equalTo(self.contentView.mas_left).offset(15 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-15 * k6Scale);
}];
}
self.webView = [[UIWebView alloc] init];
[self.contentView addSubview:self.webView];
self.webView.delegate = self;
[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.contentView);
if (la) {
make.top.equalTo(la.mas_bottom).offset(16 * k6Scale);
} else {
make.top.equalTo(self.contentView);
}
}];
self.webView.scrollView.delegate = self;
CGFloat bottomMargin = 49;
if (iPhoneX) {
bottomMargin = 83;
}
if (diccc && diccc[@"url"]) {
ASIdentifierManager *asIM = [[ASIdentifierManager alloc] init];
NSString *idfa = [asIM.advertisingIdentifier UUIDString];
NSString *jumpUrl = [[[[[[[diccc[@"url"] stringByReplacingOccurrencesOfString:@"${schoolid}" withString:CacheCampusId] stringByReplacingOccurrencesOfString:@"${userid}" withString:CacheUserId] stringByReplacingOccurrencesOfString:@"${im}" withString:@"none"] stringByReplacingOccurrencesOfString:@"${ia}" withString:idfa] stringByReplacingOccurrencesOfString:@"${imMD5}" withString:@"none"] stringByReplacingOccurrencesOfString:@"${androidId}" withString:@"none"] stringByReplacingOccurrencesOfString:@"${versionid}" withString:APPversion];
self.webUrl = jumpUrl;
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:jumpUrl]]];
}
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (![request.URL.absoluteString isEqualToString:self.webUrl]) {
ZXNewsViewController *VC = [[ZXNewsViewController alloc] init];
VC.jumpUrl = request.URL.absoluteString;
[self.fromVc.navigationController pushViewController:VC animated:YES];
return NO;
}
return YES;
}
//-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
// CGRect startRact = [self.webView convertRect:self.webView.bounds toView:kAppWindow];
// CGPoint sliderMargin = [scrollView.panGestureRecognizer velocityInView:scrollView];
// if (sliderMargin.y > 0) {
// NSLog(@"向下-%f---%@", scrollView.contentOffset.y, NSStringFromCGRect(startRact));
// self.scrollIsUp = NO;
// } else {
// NSLog(@"向上-%f---%@", scrollView.contentOffset.y, NSStringFromCGRect(startRact));
// self.scrollIsUp = YES;
//
// }
//}
- (void)setIsOpenScrool:(BOOL)isOpenScrool {
_isOpenScrool = isOpenScrool;
self.webView.scrollView.scrollEnabled = _isOpenScrool;
}
@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