Commit 264dbf52 authored by leijunbo's avatar leijunbo

Initial commit

parent 3794084a
...@@ -19,6 +19,11 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -19,6 +19,11 @@ NS_ASSUME_NONNULL_BEGIN
//判断字符串是否为nil; //判断字符串是否为nil;
+ (BOOL)blankString:(NSString *)string; + (BOOL)blankString:(NSString *)string;
//编码
- (NSString *)CT_MD5;
- (NSString *)CT_SHA1;
- (NSString *)CT_Base64Encode;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -7,7 +7,15 @@ ...@@ -7,7 +7,15 @@
// //
#import "NSString+AttributedString.h" #import "NSString+AttributedString.h"
#include <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonCryptor.h>
#import <GTMBase64.h>
static char base64EncodingTable[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
@implementation NSString (AttributedString) @implementation NSString (AttributedString)
/** /**
* 设置段落样式 * 设置段落样式
...@@ -80,6 +88,68 @@ ...@@ -80,6 +88,68 @@
return NO; return NO;
} }
- (NSString *)CT_MD5
{
NSData* inputData = [self dataUsingEncoding:NSUTF8StringEncoding];
unsigned char outputData[CC_MD5_DIGEST_LENGTH];
CC_MD5([inputData bytes], (unsigned int)[inputData length], outputData);
NSMutableString* hashStr = [NSMutableString string];
int i = 0;
for (i = 0; i < CC_MD5_DIGEST_LENGTH; ++i)
[hashStr appendFormat:@"%02x", outputData[i]];
return hashStr;
}
- (NSString *)CT_SHA1
{
const char *cstr = [self cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:self.length];
//使用对应的CC_SHA1,CC_SHA256,CC_SHA384,CC_SHA512的长度分别是20,32,48,64
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
//使用对应的CC_SHA256,CC_SHA384,CC_SHA512
CC_SHA1(data.bytes, (unsigned int)data.length, digest);
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}
- (NSString *)CT_Base64Encode
{
NSData * data = [self dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
data = [GTMBase64 encodeData:data];
NSString * output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return output;
}
#pragma mark - private methods
- (int)char2Int:(char)c
{
if (c >= 'A' && c <= 'Z') {
return c - 65;
} else if (c >= 'a' && c <= 'z') {
return c - 97 + 26;
} else if (c >= '0' && c <= '9') {
return c - 48 + 26 + 26;
} else {
switch(c) {
case '+':
return 62;
case '/':
return 63;
case '=':
return 0;
default:
return -1;
}
}
}
@end @end
//
// NSString+Timestamp.h
// APP启动页广告
//
// Created by 雷俊博 on 2019/7/31.
// Copyright © 2019 雷俊博. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (Timestamp)
//以秒为单位
+(NSString *)getNowTimeTimestamp;
//以毫秒为单位
+(NSString *)getNowTimeTimestamp3;
@end
NS_ASSUME_NONNULL_END
//
// NSString+Timestamp.m
// APP启动页广告
//
// Created by 雷俊博 on 2019/7/31.
// Copyright © 2019 雷俊博. All rights reserved.
//
#import "NSString+Timestamp.h"
@implementation NSString (Timestamp)
//以秒为单位
+(NSString *)getNowTimeTimestamp{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
//设置时区,这个对于时间的处理有时很重要
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]];
return timeSp;
}
//以毫秒为单位
+(NSString *)getNowTimeTimestamp3{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss SSS"]; // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
//设置时区,这个对于时间的处理有时很重要
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
[formatter setTimeZone:timeZone];
NSDate *datenow = [NSDate date];//现在时间,你可以输出来看下是什么格式
NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[datenow timeIntervalSince1970]*1000];
return timeSp;
}
@end
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#import "SSPaymenyViewController.h" #import "SSPaymenyViewController.h"
#import "SSTerminationViewController.h" #import "SSTerminationViewController.h"
#import "tabViewController.h" #import "tabViewController.h"
#import "WebViewco.h"
...@@ -176,6 +177,9 @@ ...@@ -176,6 +177,9 @@
NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(skipCoinDetailVC:) name:@"authenticationCoinsSkip" object:nil]; [center addObserver:self selector:@selector(skipCoinDetailVC:) name:@"authenticationCoinsSkip" object:nil];
//观察跳转广告页
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToAd:) name:@"ZLPushToAdvert" object:nil];
} }
-(void)viewWillDisappear:(BOOL)animated -(void)viewWillDisappear:(BOOL)animated
...@@ -339,6 +343,7 @@ ...@@ -339,6 +343,7 @@
} }
-(void)changeABC{ -(void)changeABC{
AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate]; AppDelegate *delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
if ([delegate.changeProgress isEqualToString:@"开始"]) { if ([delegate.changeProgress isEqualToString:@"开始"]) {
...@@ -352,6 +357,7 @@ ...@@ -352,6 +357,7 @@
{ {
NSLog(@"首页被销毁了"); NSLog(@"首页被销毁了");
[[NSNotificationCenter defaultCenter ]removeObserver:self name:@"authenticationCoinsSkip" object:nil]; [[NSNotificationCenter defaultCenter ]removeObserver:self name:@"authenticationCoinsSkip" object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"ZLPushToAdvert" object:nil];
} }
-(void)searchProgress{ -(void)searchProgress{
...@@ -1069,6 +1075,22 @@ if([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlog"]){ ...@@ -1069,6 +1075,22 @@ if([[NSUserDefaults standardUserDefaults] boolForKey:@"firstlog"]){
[self.navigationController pushViewController:vc animated:YES]; [self.navigationController pushViewController:vc animated:YES];
} }
#pragma mark - 跳转广告业
- (void)pushToAd:(NSNotification *)noti
{
UIStoryboard *sb =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
WebViewController *tc=[sb instantiateViewControllerWithIdentifier:@"webViewController"];
//urlPath
NSDictionary *dict = noti.userInfo;
tc.URL =[NSURL URLWithString: dict[@"url"]];
tc.hidesBottomBarWhenPushed =YES;
[self.navigationController pushViewController:tc animated:YES];
}
#pragma mark - UITableViewDataSource #pragma mark - UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
......
...@@ -574,6 +574,7 @@ ...@@ -574,6 +574,7 @@
446935C322FBCE5600D465FF /* PXChartBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C222FBCE5600D465FF /* PXChartBackgroundView.m */; }; 446935C322FBCE5600D465FF /* PXChartBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C222FBCE5600D465FF /* PXChartBackgroundView.m */; };
446935C622FBEEFA00D465FF /* PointItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C522FBEEF900D465FF /* PointItem.m */; }; 446935C622FBEEFA00D465FF /* PointItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C522FBEEF900D465FF /* PointItem.m */; };
446935C922FBEF6500D465FF /* CoinsDetailListVC2.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C822FBEF6500D465FF /* CoinsDetailListVC2.m */; }; 446935C922FBEF6500D465FF /* CoinsDetailListVC2.m in Sources */ = {isa = PBXBuildFile; fileRef = 446935C822FBEF6500D465FF /* CoinsDetailListVC2.m */; };
448158BF230420CE0016E45E /* NSString+Timestamp.m in Sources */ = {isa = PBXBuildFile; fileRef = 448158BE230420CE0016E45E /* NSString+Timestamp.m */; };
44A338EB22DAD3FB0076A550 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D8F83A21D7EA60B00ABF221 /* Assets.xcassets */; }; 44A338EB22DAD3FB0076A550 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D8F83A21D7EA60B00ABF221 /* Assets.xcassets */; };
44F9A77822D5F663002A3025 /* CoinsDetailFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 44F9A77722D5F663002A3025 /* CoinsDetailFooterView.m */; }; 44F9A77822D5F663002A3025 /* CoinsDetailFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 44F9A77722D5F663002A3025 /* CoinsDetailFooterView.m */; };
44F9A78022D60639002A3025 /* GreenChannelVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 44F9A77F22D60639002A3025 /* GreenChannelVC.m */; }; 44F9A78022D60639002A3025 /* GreenChannelVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 44F9A77F22D60639002A3025 /* GreenChannelVC.m */; };
...@@ -1622,6 +1623,8 @@ ...@@ -1622,6 +1623,8 @@
446935C522FBEEF900D465FF /* PointItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PointItem.m; sourceTree = "<group>"; }; 446935C522FBEEF900D465FF /* PointItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PointItem.m; sourceTree = "<group>"; };
446935C722FBEF6500D465FF /* CoinsDetailListVC2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoinsDetailListVC2.h; sourceTree = "<group>"; }; 446935C722FBEF6500D465FF /* CoinsDetailListVC2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoinsDetailListVC2.h; sourceTree = "<group>"; };
446935C822FBEF6500D465FF /* CoinsDetailListVC2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CoinsDetailListVC2.m; sourceTree = "<group>"; }; 446935C822FBEF6500D465FF /* CoinsDetailListVC2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CoinsDetailListVC2.m; sourceTree = "<group>"; };
448158BD230420CD0016E45E /* NSString+Timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Timestamp.h"; sourceTree = "<group>"; };
448158BE230420CE0016E45E /* NSString+Timestamp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Timestamp.m"; sourceTree = "<group>"; };
44D9B86622AA2ED900EBC3BD /* UIImage+WebP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WebP.m"; sourceTree = "<group>"; }; 44D9B86622AA2ED900EBC3BD /* UIImage+WebP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+WebP.m"; sourceTree = "<group>"; };
44D9B86722AA2ED900EBC3BD /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKAnnotationView+WebCache.m"; sourceTree = "<group>"; }; 44D9B86722AA2ED900EBC3BD /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKAnnotationView+WebCache.m"; sourceTree = "<group>"; };
44D9B86822AA2ED900EBC3BD /* UIImageView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+WebCache.h"; sourceTree = "<group>"; }; 44D9B86822AA2ED900EBC3BD /* UIImageView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+WebCache.h"; sourceTree = "<group>"; };
...@@ -4243,6 +4246,8 @@ ...@@ -4243,6 +4246,8 @@
44061E8222E85E8B0089A774 /* NSString */ = { 44061E8222E85E8B0089A774 /* NSString */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
448158BD230420CD0016E45E /* NSString+Timestamp.h */,
448158BE230420CE0016E45E /* NSString+Timestamp.m */,
44061E8322E85EB80089A774 /* NSString+AttributedString.h */, 44061E8322E85EB80089A774 /* NSString+AttributedString.h */,
44061E8422E85EB80089A774 /* NSString+AttributedString.m */, 44061E8422E85EB80089A774 /* NSString+AttributedString.m */,
); );
...@@ -5434,6 +5439,7 @@ ...@@ -5434,6 +5439,7 @@
3E81400C1DD2C805008F7FD6 /* TRNavigationController.m in Sources */, 3E81400C1DD2C805008F7FD6 /* TRNavigationController.m in Sources */,
4408F83522FAE42500CFECBD /* PXXview.m in Sources */, 4408F83522FAE42500CFECBD /* PXXview.m in Sources */,
007562B81FE36A1500C22C4A /* getAppleyPayGeogle.m in Sources */, 007562B81FE36A1500C22C4A /* getAppleyPayGeogle.m in Sources */,
448158BF230420CE0016E45E /* NSString+Timestamp.m in Sources */,
005A13261F18B4E80039AFB0 /* XHChatQQ.m in Sources */, 005A13261F18B4E80039AFB0 /* XHChatQQ.m in Sources */,
4400514022F9835F001552DC /* CoinCenterTableViewCell.m in Sources */, 4400514022F9835F001552DC /* CoinCenterTableViewCell.m in Sources */,
00E7FB4A211C41E8000D9233 /* VideoCaptureDevice.m in Sources */, 00E7FB4A211C41E8000D9233 /* VideoCaptureDevice.m in Sources */,
......
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
moduleName = "Open" moduleName = "Open"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/leijunbo/Desktop/1.5-2.2%E7%9A%84%E5%89%AF%E6%9C%ACnew/Open/thirdMainViewController/socialSecurityViewController.m" urlString = "file:///Users/leijunbo/Desktop/1.5-2.2%E7%9A%84%E5%89%AF%E6%9C%ACnew/Open/thirdMainViewController/socialSecurityViewController.m"
timestampString = "587469949.206701" timestampString = "587479646.228562"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "1917" startingLineNumber = "1917"
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
moduleName = "Open" moduleName = "Open"
usesParentBreakpointCondition = "Yes" usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/leijunbo/Desktop/1.5-2.2%E7%9A%84%E5%89%AF%E6%9C%ACnew/Open/thirdMainViewController/socialSecurityViewController.m" urlString = "file:///Users/leijunbo/Desktop/1.5-2.2%E7%9A%84%E5%89%AF%E6%9C%ACnew/Open/thirdMainViewController/socialSecurityViewController.m"
timestampString = "587469949.208311" timestampString = "587479646.2301559"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "1918" startingLineNumber = "1918"
......
...@@ -10,10 +10,16 @@ ...@@ -10,10 +10,16 @@
#import "WKWebViewController.h" #import "WKWebViewController.h"
#import "WebViewco.h" #import "WebViewco.h"
#import "TRNavigationController.h" #import "TRNavigationController.h"
#import "NSString+AttributedString.h"
#import "NSString+Timestamp.h"
@interface tabViewController () @interface tabViewController ()
@property(nonatomic,strong)UIViewController *vc; @property(nonatomic,strong)UIViewController *vc;
@property(nonatomic,strong)NSString *UrlStr; @property(nonatomic,strong)NSString *UrlStr;
@property(nonatomic,strong)NSString *ur; @property(nonatomic,strong)NSString *ur;
@property (nonatomic, strong)NSMutableArray *dataArray;
@end @end
@implementation tabViewController @implementation tabViewController
...@@ -26,6 +32,11 @@ ...@@ -26,6 +32,11 @@
self.vc = [[UIStoryboard storyboardWithName:@"LaunchScreen" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"sbID"]; self.vc = [[UIStoryboard storyboardWithName:@"LaunchScreen" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"sbID"];
[self.view addSubview: self.vc.view]; [self.view addSubview: self.vc.view];
[self loadAdData];
return;
[NewsNetModel acquirePicture:nil andlocationCoordinate:nil andint:2 complete:^(homePageNewsModel* model, NSError *error) { [NewsNetModel acquirePicture:nil andlocationCoordinate:nil andint:2 complete:^(homePageNewsModel* model, NSError *error) {
//2017年7月11日修改 //2017年7月11日修改
/* /*
...@@ -128,14 +139,161 @@ ...@@ -128,14 +139,161 @@
}]; }];
} }
#pragma mark - 加载广告
- (void)loadAdData
{
//NSString *url = @"http://sandbox.mmp.marketin.cn/mmps/v1/req_ad";
NSString *url = @"http://mobquery.marketin.cn/mmps/v1/c_10028/req_ad";
NSDictionary *params = @{
@"id":[NSString getNowTimeTimestamp],
@"app":@{
@"id":@"10095",
@"publisher":@{
@"id":@"10028"
}
},
@"device":@{
@"make":@"apple",
@"size":[NSString stringWithFormat:@"%dx%d",(int)[UIScreen mainScreen].bounds.size.width,(int)[UIScreen mainScreen].bounds.size.height]
},
@"network":@{
@"type":@0,
@"operator":@0,
@"cellular_id":@"1111"
},
@"adpos":@[@{
@"capacity":@1,
@"pos_id":@"10154"
}]
};
//AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
NSString *appId = @"f250daff6a09865ff432821b2adac54f";
NSString *user_id = @"10040";
NSString *app_key = @"CE91C478-34A5-4276-8E32-0CDB6E1FF8F4";
NSString *timeStamp = [NSString getNowTimeTimestamp];
// NSString *appId = @"4ccea3161064506dda8e0c9fd416d1ae";
// NSString *user_id = @"10037";
// NSString *app_key = @"56669853-8430-4534-BCE8-01FADE1010B5";
// NSString *timeStamp = @"1513937374";
NSString *signature = [[NSString stringWithFormat:@"%@%@%@",appId,app_key,timeStamp] CT_SHA1];
NSString *token = [[NSString stringWithFormat:@"%@,%@,%@,%@",appId,user_id,timeStamp,signature] CT_Base64Encode];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
NSMutableURLRequest *request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:url parameters:params error:nil];
request.timeoutInterval = 10.f;
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:[NSString stringWithFormat:@"Bearer %@",token] forHTTPHeaderField:@"Authorization"];
NSURLSessionDataTask *task = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
NSLog(@"-----responseObject===%@+++++",responseObject);
NSLog(@"-----error%@+++",error);
if(error){
// [SVProgressHUD showErrorWithStatus:@"当前网络状态差"];
[self.vc.view removeFromSuperview];
[self.vc.view setUserInteractionEnabled:NO];
return;
}
NSNumber *success = responseObject[@"success"];
if (success.boolValue) {
NSArray *array = responseObject[@"ads"];
NSMutableArray *array1 =[NSMutableArray new];
for (NSDictionary *dic in array) {
[array1 addObject:dic[@"creative_elements"][@"image"]];
self.UrlStr =dic[@"click_through_url"];
self.ur = dic[@"creative_elements"][@"image"];
[[NSUserDefaults standardUserDefaults]setObject:self.UrlStr forKey:@"urlPath"];
[[NSUserDefaults standardUserDefaults]setObject:self.ur forKey:@"imageu"];
}
self.vc.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height);
UIImageView *imageV = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
if (array1.count <=0) {
[self.vc.view removeFromSuperview];
return;
}
NSData * ss = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.ur]];
imageV.image = [UIImage imageWithData:ss];
[self.vc.view addSubview:imageV];
// 添加按钮
UIButton *showDetailBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[showDetailBtn setTitle:@"跳过>>" forState:UIControlStateNormal];
[showDetailBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[showDetailBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
showDetailBtn.titleLabel.font = [UIFont systemFontOfSize:13];
CGRect f = [UIScreen mainScreen].bounds;
showDetailBtn.frame = CGRectMake(f.size.width - 70, 30, 60, 30);
showDetailBtn.layer.borderColor = [UIColor whiteColor].CGColor;
showDetailBtn.layer.borderWidth = 1.0f;
showDetailBtn.layer.cornerRadius = 3.0f;
imageV.userInteractionEnabled =YES;
// [showDetailBtn addTarget:self action:@selector(showAdDetail:) forControlEvents:UIControlEventTouchUpInside];
[imageV addSubview:showDetailBtn];
UITapGestureRecognizer * PrivateLetterTap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAvatarView:)];
UITapGestureRecognizer * PrivateLetterTap_2=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(removeLun)];
PrivateLetterTap.numberOfTouchesRequired = 1; //手指数
PrivateLetterTap.numberOfTapsRequired = 1; //tap次数
PrivateLetterTap_2.numberOfTouchesRequired = 1; //手指数
PrivateLetterTap_2.numberOfTapsRequired = 1; //tap次数
// PrivateLetterTap.delegate= self;
imageV.contentMode = UIViewContentModeScaleToFill;
[imageV addGestureRecognizer:PrivateLetterTap];
[showDetailBtn addGestureRecognizer:PrivateLetterTap_2];
}else {
[self.vc.view removeFromSuperview];
[self.vc.view setUserInteractionEnabled:NO];
return;
}
}];
[task resume];
}
-(void)tapAvatarView:(UITapGestureRecognizer*)gg -(void)tapAvatarView:(UITapGestureRecognizer*)gg
{ {
if (self.UrlStr) {
NSDictionary *dic = @{
@"url":self.UrlStr
};
[[NSNotificationCenter defaultCenter] postNotificationName:@"ZLPushToAdvert" object:nil userInfo:dic];
}
[self removeLun];
return;
UIStoryboard *sb =[UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIStoryboard *sb =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
WebViewco *tc=[sb instantiateViewControllerWithIdentifier:@"WebViewco"]; WebViewco *tc=[sb instantiateViewControllerWithIdentifier:@"WebViewco"];
//urlPath //urlPath
tc.urlStr =[NSURL URLWithString: [[NSUserDefaults standardUserDefaults]objectForKey:@"urlPath"]]; tc.urlStr =[NSURL URLWithString: [[NSUserDefaults standardUserDefaults]objectForKey:@"urlPath"]];
tc.hidesBottomBarWhenPushed =YES; tc.hidesBottomBarWhenPushed =YES;
[self presentViewController:tc animated:YES completion:nil]; //[self presentViewController:tc animated:YES completion:nil];
[self.navigationController pushViewController:tc animated:YES];
} }
-(void)removeLun -(void)removeLun
...@@ -161,5 +319,14 @@ ...@@ -161,5 +319,14 @@
} }
#pragma mark - getters and setters
- (NSMutableArray *)dataArray
{
if (!_dataArray) {
_dataArray = [[NSMutableArray alloc]init];
}
return _dataArray;
}
@end @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