阶段性完成

This commit is contained in:
kai60 2020-10-17 22:41:26 +08:00
parent 55d25d8fba
commit 3356311c86
13 changed files with 899 additions and 1060 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -2245,6 +2245,9 @@
C024B7B12379668B00509424 /* NSMutableArray+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */; };
C02ED596249E3B7300CAC37D /* InfoByImageViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */; };
C02ED597249E3B7300CAC37D /* InfoByImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */; };
C072196A253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */; };
C072196D253B1F4F0065CF17 /* DatePickerCustomView.h in Headers */ = {isa = PBXBuildFile; fileRef = C072196B253B1F4F0065CF17 /* DatePickerCustomView.h */; };
C072196E253B1F4F0065CF17 /* DatePickerCustomView.m in Sources */ = {isa = PBXBuildFile; fileRef = C072196C253B1F4F0065CF17 /* DatePickerCustomView.m */; };
C0837A57244FF5510034FEC5 /* EGOCache.m in Sources */ = {isa = PBXBuildFile; fileRef = C0837A55244FF5500034FEC5 /* EGOCache.m */; };
C0837A58244FF5510034FEC5 /* EGOCache.h in Headers */ = {isa = PBXBuildFile; fileRef = C0837A56244FF5500034FEC5 /* EGOCache.h */; };
C0873EE12491060000D47D34 /* ESPUDPSocketClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C0873EBE249105FF00D47D34 /* ESPUDPSocketClient.h */; };
@ -5704,6 +5707,9 @@
C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+AvoidCrash.h"; sourceTree = "<group>"; };
C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoByImageViewController.h; sourceTree = "<group>"; };
C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoByImageViewController.m; sourceTree = "<group>"; };
C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IfishP2PPlayBackListViewController.xib; sourceTree = "<group>"; };
C072196B253B1F4F0065CF17 /* DatePickerCustomView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePickerCustomView.h; sourceTree = "<group>"; };
C072196C253B1F4F0065CF17 /* DatePickerCustomView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatePickerCustomView.m; sourceTree = "<group>"; };
C0837A55244FF5500034FEC5 /* EGOCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EGOCache.m; sourceTree = "<group>"; };
C0837A56244FF5500034FEC5 /* EGOCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EGOCache.h; sourceTree = "<group>"; };
C0873EBE249105FF00D47D34 /* ESPUDPSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESPUDPSocketClient.h; sourceTree = "<group>"; };
@ -6606,6 +6612,7 @@
3D1C4FF3221A9EDD0096AE43 /* P2PPlayingbackVC.m */,
3D1C4FEF221A9EDD0096AE43 /* PlayBaseViewController.h */,
3D1C4FF5221A9EDD0096AE43 /* PlayBaseViewController.m */,
C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */,
);
path = IfishP2PPlayBack;
sourceTree = "<group>";
@ -10156,6 +10163,8 @@
883E79771D48B0280030E075 /* mypicView */ = {
isa = PBXGroup;
children = (
C072196B253B1F4F0065CF17 /* DatePickerCustomView.h */,
C072196C253B1F4F0065CF17 /* DatePickerCustomView.m */,
883E79781D48B0280030E075 /* Box.png */,
883E79791D48B0280030E075 /* MydatePickerView.h */,
883E797A1D48B0280030E075 /* MydatePickerView.m */,
@ -12875,6 +12884,7 @@
C0873EF62491060000D47D34 /* ESPTools.h in Headers */,
CB8B6468230F7F980032EB24 /* IfishMainInfoCell.h in Headers */,
C0EA8A2A23AF74F4003DC53B /* SDWebImageOperation.h in Headers */,
C072196D253B1F4F0065CF17 /* DatePickerCustomView.h in Headers */,
CB484E1122B8C8C90075F050 /* version.h in Headers */,
3D1C5122221A9EE00096AE43 /* IfishRecVideoViewCell.h in Headers */,
CB48207C2334E99700A50C92 /* IQTextView.h in Headers */,
@ -14533,6 +14543,7 @@
882956DD1DBDA3A300E9DDD7 /* ifishdropview_add_device@3x.png in Resources */,
881478241E712A2700BFB79C /* task_openShareCamera@3x.png in Resources */,
887492511E7BB58A00CDA284 /* gold_background@3x.png in Resources */,
C072196A253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib in Resources */,
882957961DBDA3A400E9DDD7 /* xutobtn2_on@3x.png in Resources */,
885606AC1E32081C0002C17C /* sharing_v_attestation@3x.png in Resources */,
881A1D331DD2C31500BA1AF4 /* kankanlook_icon_sentiment@2x.png in Resources */,
@ -14628,6 +14639,7 @@
883E78621D48A5E50030E075 /* RightViewController.m in Sources */,
CBA61675228F9AB100ED380D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */,
886FB1A11E5A9D0A00256332 /* FishDocSection0ViewImgCell.m in Sources */,
C072196E253B1F4F0065CF17 /* DatePickerCustomView.m in Sources */,
881672381EA5DE2B00BEBF23 /* UMComSimpleAssociatedFeedTableViewCell.m in Sources */,
883E76431D4897570030E075 /* TwoControlBackmsgmodel.m in Sources */,
3D3512DB2159C172009DDB0F /* IfishHotBarModifyNameVc.m in Sources */,

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UMComLoginViewController">
@ -20,22 +21,22 @@
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rxC-n2-48U" userLabel="account_bar">
<rect key="frame" x="0.0" y="15" width="600" height="108"/>
<rect key="frame" x="0.0" y="15" width="414" height="108"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hKX-4Q-d6g" userLabel="account_color_view">
<rect key="frame" x="0.0" y="0.0" width="600" height="54"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.96470588235294119" blue="0.96862745098039216" alpha="1" colorSpace="calibratedRGB"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="54"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.96470588235294119" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="toK-cn-6hG" userLabel="pwd_color_view">
<rect key="frame" x="0.0" y="54" width="600" height="54"/>
<color key="backgroundColor" red="0.94509803920000002" green="0.96470588239999999" blue="0.96862745100000003" alpha="1" colorSpace="calibratedRGB"/>
<rect key="frame" x="0.0" y="54" width="414" height="54"/>
<color key="backgroundColor" red="0.94509803920000002" green="0.96470588239999999" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入有效邮箱,便于找回密码" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="5J0-WW-KgS" userLabel="account_input">
<rect key="frame" x="57" y="10" width="523" height="34"/>
<rect key="frame" x="57" y="10" width="337" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="34" id="70j-gl-TkV"/>
</constraints>
@ -53,7 +54,7 @@
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入密码" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oIt-Hg-Kdv" userLabel="password_input">
<rect key="frame" x="57" y="64" width="523" height="34"/>
<rect key="frame" x="57" y="64" width="337" height="34"/>
<constraints>
<constraint firstAttribute="height" constant="34" id="95R-ni-5SI"/>
</constraints>
@ -71,14 +72,14 @@
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Jl-HR-dKG" userLabel="line">
<rect key="frame" x="57" y="53.5" width="543" height="1"/>
<color key="backgroundColor" red="0.87450980392156863" green="0.87450980392156863" blue="0.87450980392156863" alpha="1" colorSpace="calibratedRGB"/>
<rect key="frame" x="57" y="53.5" width="357" height="1"/>
<color key="backgroundColor" red="0.87450980392156863" green="0.87450980392156863" blue="0.87450980392156863" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="tH4-Aj-SyM"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="6Jl-HR-dKG" firstAttribute="centerY" secondItem="rxC-n2-48U" secondAttribute="centerY" id="1kF-m0-xBZ"/>
<constraint firstItem="oIt-Hg-Kdv" firstAttribute="leading" secondItem="gE9-uD-XZv" secondAttribute="trailing" constant="15" id="2Yg-VU-Ujm"/>
@ -112,38 +113,38 @@
</mask>
</variation>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="meQ-ij-ubJ" userLabel="forgot">
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="meQ-ij-ubJ" userLabel="forgot">
<rect key="frame" x="528" y="143" width="52" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="xom-j2-nM8"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="忘记密码">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="forgotPassword:" destination="-1" eventType="touchUpInside" id="T58-af-AfP"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Km-Ya-48m" userLabel="line">
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3Km-Ya-48m" userLabel="line">
<rect key="frame" x="528" y="158" width="52" height="1"/>
<color key="backgroundColor" red="0.27843137254901962" green="0.56862745098039214" blue="0.96470588235294119" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.27843137254901962" green="0.56862745098039214" blue="0.96470588235294119" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="F6M-3c-3Za"/>
</constraints>
</view>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2re-uF-wff" userLabel="login">
<rect key="frame" x="20" y="179" width="560" height="44"/>
<color key="backgroundColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="calibratedRGB"/>
<rect key="frame" x="20" y="179" width="374" height="44"/>
<color key="backgroundColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="53G-lE-PzN"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<state key="normal" title="登 录">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted">
<color key="titleColor" red="0.90980392160000001" green="0.91764705879999997" blue="0.93333333330000001" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleColor" red="0.90980392160000001" green="0.91764705879999997" blue="0.93333333330000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
@ -155,17 +156,17 @@
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Bp-56-HWj" userLabel="register">
<rect key="frame" x="20" y="243" width="560" height="44"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<rect key="frame" x="20" y="243" width="374" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="dgO-jX-FE7"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="19"/>
<state key="normal" title="注 册">
<color key="titleColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
@ -177,7 +178,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.88235294117647056" green="0.90196078431372551" blue="0.9137254901960784" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.88235294117647056" green="0.90196078431372551" blue="0.9137254901960784" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="meQ-ij-ubJ" secondAttribute="trailing" constant="20" id="4z7-Lu-UVZ"/>
<constraint firstItem="3Km-Ya-48m" firstAttribute="bottom" secondItem="meQ-ij-ubJ" secondAttribute="bottom" id="6hq-R8-fXz"/>

View File

@ -11,5 +11,8 @@
#import "IfishCameraModel.h"
@interface IfishP2PPlayBackListViewController : BaseViewController
@property (nonatomic,strong) IfishCameraModel *camera;
@property (weak, nonatomic) IBOutlet UIButton *startBtn;
@property (weak, nonatomic) IBOutlet UIButton *endBtn;
@property (weak, nonatomic) IBOutlet UIButton *searchBtn;
@end

View File

@ -10,13 +10,15 @@
#import "CameraNoParyBackVideoView.h"
#import "P2PClient.h"
#import "IfishPlaybackViewCell.h"
#import <GWP2P/GWP2P.h>
#import "DatePickerCustomView.h"
#define BACKVIEW_ROWH 60
#define ANIM_VIEW_WIDTH_AND_HEIGHT 80
//
#import "P2PPlayingbackVC.h"
@interface IfishP2PPlayBackListViewController ()<UITableViewDelegate,UITableViewDataSource,P2PPlaybackDelegate>
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong) IBOutlet UITableView *tableView;
@property(retain, nonatomic) NSMutableArray *playbackFiles;
@property(retain, nonatomic) NSMutableArray *playbackSize;
@property(retain, nonatomic) NSMutableArray *timesData;
@ -26,24 +28,27 @@
@property(retain, nonatomic) NSMutableArray *timesDataMore;
@property(nonatomic,strong) CameraNoParyBackVideoView *noDataView;
@property(strong, nonatomic) NSString *nextEndDate;
@property (nonatomic) BOOL isloadMore;//
@property (nonatomic) BOOL hasSDCard;//
@property(strong, nonatomic) UIView *movieView;
@property (nonatomic) BOOL isInItDevice; //
@property (nonatomic, strong) DatePickerCustomView *datePickView;
@property (nonatomic, strong) NSDate *startDate;
@property (nonatomic, strong) NSDate *endDate;
@end
@implementation IfishP2PPlayBackListViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[P2PClient sharedClient] setIsClearPlaybackFilesLength:YES];//isClearPlaybackFilesLength
// Do any additional setup after loading the view.
_isloadMore = NO;
_isInItDevice = NO;
_hasSDCard = NO;
self.playbackFiles = [NSMutableArray arrayWithCapacity:0];
self.playbackSize = [NSMutableArray arrayWithCapacity:0];
self.playbackFilesMore = [NSMutableArray arrayWithCapacity:0];
self.playbackSizeMore = [NSMutableArray arrayWithCapacity:0];
[self addTitleViewWithTitle:@"回放"];
[self addTitleViewWithTitle:@"视频回放"];
[self connectDevice];
[self initUI];
//[[P2PClient sharedClient] setPlaybackDelegate:self];
@ -53,57 +58,35 @@
-(void)connectDevice{
//LoginResult *loginResult = [UDManager getLoginInfo];
//8225
// NSString * P2PVerifyCode1 = @"1528438234";
// NSString * P2PVerifyCode2 = @"992805759";
// NSString *UserID = @"-2144354932";
UserModel *model=[[DataCenter defaultDtacenter] valueForKey:@"UserLogIn"];
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//
if (!_isInItDevice) {
NSLog(@"正在初始化设备");
_isInItDevice = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
// _isInItDevice = [[P2PClient sharedClient] p2pConnectWithId:model.gwellUserID codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
}
if(_isInItDevice){
NSLog(@"p2pConnect success. 成功 可以操作设备了");
//
usleep(600000);
[self startMonitor];
}else{//new added
NSLog(@"p2pConnect failure.失败,不能操作设备");
//[self connectDevice];
return;
}
}
-(void)startMonitor{
if (_isInItDevice) {
NSLog(@"发送呼叫命令");
[[P2PClient sharedClient] setIsBCalled:NO];
[[P2PClient sharedClient] setP2pCallState:P2PCALL_STATUS_CALLING];
[[P2PClient sharedClient] p2pCallWithId:self.camera.cameraId password:self.camera.cameraPass callType:P2PCALL_TYPE_PLAYBACK];
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
NSLog(@"正在检查P2P连接状态");
BOOL connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
if (connectDevice) {
[[GWP2PClient sharedClient] getDeviceStorageInfomationWithDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
if (success)
{
self.hasSDCard=YES;
}
else
{
[self initNoSDDataViewHidden:NO];
}
}];
}else{
NSLog(@"p2pConnect failure.失败,不能操作设备");
}
}
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[AppDelegate sharedDefault].canFullScreen = YES;
@ -113,36 +96,16 @@
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
//[AppDelegate sharedDefault].canFullScreen = YES;
[[NSNotificationCenter defaultCenter] removeObserver:self name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"read_play_false" object:nil];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveRemoteMessage:) name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readPlayFalse:) name:@"read_play_false" object:nil];
[[P2PClient sharedClient] getSDCardInfoWithId:self.camera.cameraId password:self.camera.cameraPass];
}
-(void)readPlayFalse:(NSNotification*)noti{
///
dispatch_async(dispatch_get_main_queue(), ^{
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 0.3;
}
completion:^(BOOL finished){
[self.movieView setHidden:YES];
[self.view makeToast:NSLocalizedString(@"connection_failed_please_reconnect", nil)];
}
];
});
}
-(void)goBackAction{
@ -152,114 +115,7 @@
}
- (void)receiveRemoteMessage:(NSNotification *)notification{
NSDictionary *parameter = [notification userInfo];
int key = [[parameter valueForKey:@"key"] intValue];
switch (key) {
case RET_GET_PLAYBACK_FILES:
{
//
NSArray *array = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"files"]];
//
NSArray *times = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"times"]];
//
NSArray *sizes = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"sizes"]];
//playbackFiles
//playbackFilesMore
//playbackSize
//playbackSizeMore
if (_isloadMore) {
for (NSString *file in array){
[self.playbackFilesMore addObject:file];
}
for (NSString *size in sizes){
[self.playbackSizeMore addObject:size];
}
//
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
if (self.playbackFilesMore.count < 1) {
//[self.view makeToast:NSLocalizedString(@"no_playback_file", nil)];
[self.view makeToast:@"没有更多视频"];
}
});
self.timesDataMore = [NSMutableArray arrayWithArray:times];
if (self.timesDataMore.count==0) {
return;
}
//13...
//
self.nextEndDate = [self.timesDataMore lastObject];
}else{
for (NSString *file in array){
[self.playbackFiles addObject:file];
}
for (NSString *size in sizes){
[self.playbackSize addObject:size];
}
//
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
if (self.playbackFiles.count < 1) {
//[self.view makeToast:NSLocalizedString(@"no_playback_file", nil)];
[self initNoVideoDataViewHidden:NO];
}
});
self.timesData = [NSMutableArray arrayWithArray:times];
if (self.timesData.count==0) {
return;
}
//13...
//
self.nextEndDate = [self.timesData lastObject];
}
}
break;
case RET_GET_SDCARD_INFO:
{
NSInteger result = [[parameter valueForKey:@"result"] intValue];
dispatch_async(dispatch_get_main_queue(), ^{
if (result == 1) {
//[self.view makeToast:@"sdk卡可使用"];
[[P2PClient sharedClient] setCurrentLabel:1];
[[P2PClient sharedClient] getPlaybackFilesWithId:self.camera.cameraId password:self.camera.cameraPass timeInterval:1];
[[P2PClient sharedClient] setPlaybackDelegate:self];
}else{
//sd
//[self.view makeToast:NSLocalizedString(@"no_storage", nil)];
[self initNoSDDataViewHidden:NO];
}
});
}
break;
default:
break;
}
}
-(void)initNoSDDataViewHidden:(BOOL)hidden
@ -273,7 +129,7 @@
if (!self.noDataView) {
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.view.bounds];
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.tableView.frame];
[self.view addSubview:self.noDataView];
}
@ -288,7 +144,7 @@
{
if (!self.noDataView) {
//CGFloat viewH =200;
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.view.bounds];
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.tableView.frame];
[self.view addSubview:self.noDataView];
}
@ -301,34 +157,90 @@
}
-(void)initUI
{
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height) style:UITableViewStyleGrouped];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.showsVerticalScrollIndicator = NO;
self.tableView.backgroundColor = RGB(241, 241, 241);
[self.view addSubview:self.tableView];
UIView *movieView = [[UIView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, self.view.frame.size.width, self.view.frame.size.height-NAVIGATION_BAR_HEIGHT)];
[movieView setBackgroundColor:XBlack_128];
UIImageView *animView = [[UIImageView alloc] initWithFrame:CGRectMake((movieView.frame.size.width-ANIM_VIEW_WIDTH_AND_HEIGHT)/2, (movieView.frame.size.height-ANIM_VIEW_WIDTH_AND_HEIGHT)/2, ANIM_VIEW_WIDTH_AND_HEIGHT, ANIM_VIEW_WIDTH_AND_HEIGHT)];
NSArray *imagesArray = [NSArray arrayWithObjects:LXImageWithImageName(@"movie1.png"),LXImageWithImageName(@"movie2.png"),LXImageWithImageName(@"movie3.png"),nil];
animView.animationImages = imagesArray;
animView.animationDuration = ((CGFloat)[imagesArray count])*100.0f/1000.0f;
animView.animationRepeatCount = 0;
[animView startAnimating];
[movieView addSubview:animView];
[movieView setHidden:YES];
[self.view addSubview:movieView];
self.movieView = movieView;
NSDate *nowDate = [NSDate date]; //
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm";
NSString *string = [formatter stringFromDate:nowDate]; //
[self.startBtn setTitle:[formatter stringFromDate:[nowDate dateByAddingTimeInterval:-60*60]] forState:UIControlStateNormal];
[self.endBtn setTitle:string forState:UIControlStateNormal];
self.startDate=nowDate;
self.startDate=[nowDate dateByAddingTimeInterval:-60*60*2];
}
- (IBAction)startTimeClick:(UIButton *)sender {
[self.datePickView removeFromSuperview];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier: @"zh_CN"]];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
DatePickerCustomView* dateView = [DatePickerCustomView showInView:self.view Mode:UIDatePickerModeDateAndTime date:[dateFormatter dateFromString:[sender titleForState:UIControlStateNormal]]];
dateView.datePicker.maximumDate=[NSDate date];
self.datePickView=dateView;
WEAK_SELF;
__weak DatePickerCustomView* weakDateView =dateView;
dateView.dateChanged =^{
[sender setTitle:[dateFormatter stringFromDate:weakDateView.datePicker.date] forState:UIControlStateNormal];
weakSelf.startDate=weakDateView.datePicker.date;
};
dateView.cancelBlock = ^{
};
}
- (IBAction)endTimeClick:(UIButton *)sender {
[self.datePickView removeFromSuperview];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier: @"zh_CN"]];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
DatePickerCustomView* dateView = [DatePickerCustomView showInView:self.view Mode:UIDatePickerModeDateAndTime date:[dateFormatter dateFromString:[sender titleForState:UIControlStateNormal]]];
dateView.datePicker.maximumDate=[NSDate date];
self.datePickView=dateView;
__weak DatePickerCustomView* weakDateView =dateView;
WEAK_SELF;
dateView.dateChanged =^{
[sender setTitle:[dateFormatter stringFromDate:weakDateView.datePicker.date] forState:UIControlStateNormal];
weakSelf.endDate=weakDateView.datePicker.date;
};
dateView.cancelBlock = ^{
};
}
- (IBAction)searchClick:(UIButton *)sender {
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[[GWP2PClient sharedClient] getDevicePlaybackFilesWithDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass startDate:self.startDate endDate:self.endDate completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
NSLog(@"dataDictionary=%@",dataDictionary);
[self.playbackFiles removeAllObjects];
if (success&&[dataDictionary[@"error value"] intValue]==0)
{
NSArray*files=dataDictionary[@"files"];
if ([files isKindOfClass:[NSArray class]]&&files.count)
{
[self.playbackFiles addObjectsFromArray:files];
[self.tableView reloadData];
}
else
{
[self initNoVideoDataViewHidden:NO];
}
}
else
{
[self initNoVideoDataViewHidden:NO];
}
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@ -336,17 +248,12 @@
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section ==0) {
return [self.playbackFiles count];
}
return [self.playbackFilesMore count];
return self.playbackFiles.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
@ -359,68 +266,15 @@
IfishPlaybackViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishPlaybackViewCell"];
GWPlaybackFileModel*model=[self.playbackFiles objectAtIndex:indexPath.row];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishPlaybackViewCell" owner:self options:nil]lastObject];
}
cell.model=model;
//
if (indexPath.section ==0) {
if (self.playbackFiles.count!=0) {
NSString* name = [self.playbackFiles objectAtIndex:indexPath.row];
int iSize = 0;
if ([self.playbackFiles count] == [self.playbackSize count]) //
{
NSNumber* number = [self.playbackSize objectAtIndex:indexPath.row];
iSize = [number intValue];
}
if (iSize != 0) {//
//cell.videoTime.text = [NSString stringWithFormat:@"%@ (%02d:%02d)", name, iSize/60, iSize%60];
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = [NSString stringWithFormat:@"%02d分钟",iSize/60];
if (iSize<60) {
cell.videoLongth.text = [NSString stringWithFormat:@"%02d秒钟",iSize%60];
}
}
else
{
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = @"未知";
}
}
}else{
//
if (self.playbackFilesMore.count !=0) {
NSString* name = [self.playbackFilesMore objectAtIndex:indexPath.row];
int iSize = 0;
if ([self.playbackFilesMore count] == [self.playbackSizeMore count]) //
{
NSNumber* number = [self.playbackSizeMore objectAtIndex:indexPath.row];
iSize = [number intValue];
}
if (iSize != 0) {//
//cell.videoTime.text = [NSString stringWithFormat:@"%@ (%02d:%02d)", name, iSize/60, iSize%60];
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = [NSString stringWithFormat:@"%02d分钟",iSize/60];
}
else
{
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = @"未知";
}
}
}
return cell;
@ -450,122 +304,122 @@
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section==0) {
// 1 线
return 50 +BACKVIEW_ROWH +BACKVIEW_ROWH + 1;
}
return 0.1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if (section ==1) {
return BACKVIEW_ROWH;
}
return 0.1;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
CGFloat space = 10;
if (section ==0) {
UIView *section0Header =[[UIView alloc] init];
section0Header.frame = CGRectMake(0, 0, self.view.frame.size.width, 191);
UILabel *describleLabe=[[UILabel alloc] init];
describleLabe.frame = CGRectMake(0, 0,self.view.frame.size.width, 50);
describleLabe.textColor =RGB(102, 102, 102);
describleLabe.textAlignment = NSTextAlignmentCenter;
describleLabe.text = @"30分钟录制一次录像最多存储7日";
describleLabe.font = [UIFont systemFontOfSize:12];
describleLabe.backgroundColor = RGB(241, 245, 246);
[section0Header addSubview:describleLabe];
UIView *listLabeBack =[[UIView alloc] init];
listLabeBack.frame = CGRectMake(0,CGRectGetMaxY(describleLabe.frame), self.view.frame.size.width,BACKVIEW_ROWH);
listLabeBack.backgroundColor = [UIColor whiteColor];
[section0Header addSubview:listLabeBack];
UILabel *listLabe=[[UILabel alloc] init];
listLabe.frame = CGRectMake(space,CGRectGetHeight(listLabeBack.frame)/2,200, 20);
listLabe.textColor =RGB(102, 102, 102);
listLabe.font = [UIFont systemFontOfSize:15];
listLabe.text = @"回放列表";
[listLabeBack addSubview:listLabe];
CGFloat listlW = 50;
UILabel *listl=[[UILabel alloc] init];
listl.frame = CGRectMake(self.view.frame.size.width - space -listlW -4,CGRectGetHeight(listLabeBack.frame)/2,listlW, 20);
listl.textColor =RGB(102, 102, 102);
listl.font = [UIFont systemFontOfSize:14];
listl.text = @"时长";
listl.textAlignment = NSTextAlignmentRight;
[listLabeBack addSubview:listl];
//线
UIView *lineView =[[UIView alloc] init];
lineView.frame = CGRectMake(0, CGRectGetMaxY(listLabeBack.frame), self.view.frame.size.width,1);
lineView.backgroundColor = RGB(241, 241, 241);
[section0Header addSubview:lineView];
//
UIView *todayLabeBack =[[UIView alloc] init];
todayLabeBack.frame = CGRectMake(0,CGRectGetMaxY(lineView.frame),self.view.frame.size.width, BACKVIEW_ROWH);
todayLabeBack.backgroundColor = [UIColor whiteColor];
[section0Header addSubview:todayLabeBack];
UILabel *todayLabe=[[UILabel alloc] init];
todayLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
todayLabe.textColor =RGB(153, 153, 153);
todayLabe.font = [UIFont systemFontOfSize:14];
todayLabe.text = @"最近24小时";
todayLabe.backgroundColor = [UIColor whiteColor];
//todayLabe.text.
[todayLabeBack addSubview:todayLabe];
return section0Header;
}
return nil;
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
CGFloat space = 10;
if (section ==1) {
//
UIView *moreLabeBack =[[UIView alloc] init];
moreLabeBack.frame = CGRectMake(0,0,self.view.frame.size.width, BACKVIEW_ROWH);
moreLabeBack.backgroundColor = [UIColor whiteColor];
UILabel *moreLabe=[[UILabel alloc] init];
moreLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
moreLabe.textColor =RGB(153, 153, 153);
moreLabe.font = [UIFont systemFontOfSize:14];
moreLabe.text = @"查看更多";
moreLabe.backgroundColor = [UIColor whiteColor];
[moreLabeBack addSubview:moreLabe];
moreLabe.userInteractionEnabled = YES;
UITapGestureRecognizer *moreGesture =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moreDataRequset)];
[moreLabe addGestureRecognizer:moreGesture];
return moreLabeBack;
}
return nil;
}
//
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//
// if (section==0) {
// // 1 线
// return 50 +BACKVIEW_ROWH +BACKVIEW_ROWH + 1;
// }
// return 0.1;
//}
//
//-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
//
// if (section ==1) {
//
// return BACKVIEW_ROWH;
// }
// return 0.1;
//}
//-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//
// CGFloat space = 10;
//
// if (section ==0) {
//
// UIView *section0Header =[[UIView alloc] init];
// section0Header.frame = CGRectMake(0, 0, self.view.frame.size.width, 191);
//
// UILabel *describleLabe=[[UILabel alloc] init];
// describleLabe.frame = CGRectMake(0, 0,self.view.frame.size.width, 50);
// describleLabe.textColor =RGB(102, 102, 102);
// describleLabe.textAlignment = NSTextAlignmentCenter;
// describleLabe.text = @"30分钟录制一次录像最多存储7日";
// describleLabe.font = [UIFont systemFontOfSize:12];
// describleLabe.backgroundColor = RGB(241, 245, 246);
//
// [section0Header addSubview:describleLabe];
//
// UIView *listLabeBack =[[UIView alloc] init];
// listLabeBack.frame = CGRectMake(0,CGRectGetMaxY(describleLabe.frame), self.view.frame.size.width,BACKVIEW_ROWH);
// listLabeBack.backgroundColor = [UIColor whiteColor];
//
// [section0Header addSubview:listLabeBack];
//
// UILabel *listLabe=[[UILabel alloc] init];
// listLabe.frame = CGRectMake(space,CGRectGetHeight(listLabeBack.frame)/2,200, 20);
// listLabe.textColor =RGB(102, 102, 102);
// listLabe.font = [UIFont systemFontOfSize:15];
// listLabe.text = @"回放列表";
// [listLabeBack addSubview:listLabe];
// CGFloat listlW = 50;
// UILabel *listl=[[UILabel alloc] init];
// listl.frame = CGRectMake(self.view.frame.size.width - space -listlW -4,CGRectGetHeight(listLabeBack.frame)/2,listlW, 20);
// listl.textColor =RGB(102, 102, 102);
// listl.font = [UIFont systemFontOfSize:14];
// listl.text = @"时长";
// listl.textAlignment = NSTextAlignmentRight;
// [listLabeBack addSubview:listl];
//
//
// //线
// UIView *lineView =[[UIView alloc] init];
// lineView.frame = CGRectMake(0, CGRectGetMaxY(listLabeBack.frame), self.view.frame.size.width,1);
// lineView.backgroundColor = RGB(241, 241, 241);
// [section0Header addSubview:lineView];
// //
// UIView *todayLabeBack =[[UIView alloc] init];
// todayLabeBack.frame = CGRectMake(0,CGRectGetMaxY(lineView.frame),self.view.frame.size.width, BACKVIEW_ROWH);
// todayLabeBack.backgroundColor = [UIColor whiteColor];
//
// [section0Header addSubview:todayLabeBack];
// UILabel *todayLabe=[[UILabel alloc] init];
// todayLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
// todayLabe.textColor =RGB(153, 153, 153);
// todayLabe.font = [UIFont systemFontOfSize:14];
// todayLabe.text = @"最近24小时";
// todayLabe.backgroundColor = [UIColor whiteColor];
// //todayLabe.text.
// [todayLabeBack addSubview:todayLabe];
//
//
//
// return section0Header;
// }
//
// return nil;
//
//}
//
//-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
// CGFloat space = 10;
//
// if (section ==1) {
// //
// UIView *moreLabeBack =[[UIView alloc] init];
// moreLabeBack.frame = CGRectMake(0,0,self.view.frame.size.width, BACKVIEW_ROWH);
// moreLabeBack.backgroundColor = [UIColor whiteColor];
// UILabel *moreLabe=[[UILabel alloc] init];
// moreLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
// moreLabe.textColor =RGB(153, 153, 153);
// moreLabe.font = [UIFont systemFontOfSize:14];
// moreLabe.text = @"查看更多";
// moreLabe.backgroundColor = [UIColor whiteColor];
// [moreLabeBack addSubview:moreLabe];
// moreLabe.userInteractionEnabled = YES;
// UITapGestureRecognizer *moreGesture =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moreDataRequset)];
// [moreLabe addGestureRecognizer:moreGesture];
//
// return moreLabeBack;
//
// }
// return nil;
//}
#pragma mark - moreDataRequset
-(void)moreDataRequset{
_isloadMore =YES;
// //today
NSDate *nowDate = [NSDate date];
NSInteger interval =31;

View File

@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="IfishP2PPlayBackListViewController">
<connections>
<outlet property="endBtn" destination="tn6-eP-Fcy" id="fCN-FK-dN3"/>
<outlet property="searchBtn" destination="pFd-XZ-Jwy" id="bV2-Y5-cFu"/>
<outlet property="startBtn" destination="kku-gY-Q7f" id="rZc-J9-BHd"/>
<outlet property="tableView" destination="4mg-Y4-tdd" id="icl-Nx-NUp"/>
<outlet property="view" destination="iN0-l3-epB" id="ofW-7c-1C6"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="arN-mi-hdC">
<rect key="frame" x="0.0" y="44" width="414" height="260"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HW3-zp-qaz" userLabel="start">
<rect key="frame" x="0.0" y="20" width="414" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="开始日期:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I8c-Yw-b6c">
<rect key="frame" x="0.0" y="0.0" width="100" height="60"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="eRB-vs-cgp"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kku-gY-Q7f" userLabel="startBtn">
<rect key="frame" x="132" y="10" width="150" height="40"/>
<color key="backgroundColor" red="0.85882914070000005" green="0.85481816529999999" blue="0.8588245511" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" constant="150" id="cyL-N8-h3p"/>
</constraints>
<state key="normal" title="2020-10-17 15:44">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="startTimeClick:" destination="-1" eventType="touchUpInside" id="pbD-ic-I7y"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="I8c-Yw-b6c" secondAttribute="bottom" id="9kN-30-AYl"/>
<constraint firstItem="I8c-Yw-b6c" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="top" id="RNn-F5-Xeq"/>
<constraint firstAttribute="bottom" secondItem="kku-gY-Q7f" secondAttribute="bottom" constant="10" id="RjY-yi-2zb"/>
<constraint firstAttribute="height" constant="60" id="bbP-qb-Nyd"/>
<constraint firstItem="I8c-Yw-b6c" firstAttribute="leading" secondItem="HW3-zp-qaz" secondAttribute="leading" id="gvF-ka-pbb"/>
<constraint firstItem="kku-gY-Q7f" firstAttribute="centerX" secondItem="HW3-zp-qaz" secondAttribute="centerX" id="hcl-7j-RES"/>
<constraint firstItem="kku-gY-Q7f" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="top" constant="10" id="ldA-ZL-75A"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gbN-3d-Trv" userLabel="end">
<rect key="frame" x="0.0" y="80" width="414" height="60"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="结束日期:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RAo-9M-Wa2">
<rect key="frame" x="0.0" y="0.0" width="100" height="60"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="Ecq-wU-f1p"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tn6-eP-Fcy" userLabel="endBtn">
<rect key="frame" x="132" y="10" width="150" height="40"/>
<color key="backgroundColor" red="0.86272245650000001" green="0.85881525280000004" blue="0.85882407429999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="width" constant="150" id="X9l-lJ-tdi"/>
</constraints>
<state key="normal" title="2020-10-17 15:44">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="endTimeClick:" destination="-1" eventType="touchUpInside" id="Dk2-9N-clp"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="tn6-eP-Fcy" secondAttribute="bottom" constant="10" id="SUI-cz-yfp"/>
<constraint firstItem="RAo-9M-Wa2" firstAttribute="top" secondItem="gbN-3d-Trv" secondAttribute="top" id="VDB-rV-fB2"/>
<constraint firstItem="tn6-eP-Fcy" firstAttribute="centerX" secondItem="gbN-3d-Trv" secondAttribute="centerX" id="a0d-KX-0lz"/>
<constraint firstAttribute="bottom" secondItem="RAo-9M-Wa2" secondAttribute="bottom" id="b9w-79-N3y"/>
<constraint firstAttribute="height" constant="60" id="lhS-sk-0G5"/>
<constraint firstItem="RAo-9M-Wa2" firstAttribute="leading" secondItem="gbN-3d-Trv" secondAttribute="leading" id="q94-03-dQ9"/>
<constraint firstItem="tn6-eP-Fcy" firstAttribute="top" secondItem="gbN-3d-Trv" secondAttribute="top" constant="10" id="zmh-Za-93K"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="scl-co-ww3" userLabel="bottom">
<rect key="frame" x="0.0" y="210" width="414" height="50"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="zSW-Qs-mlC">
<rect key="frame" x="0.0" y="0.0" width="414" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="开始时间" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ycQ-nI-y8x">
<rect key="frame" x="0.0" y="15" width="138" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="结束时间" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2KQ-jC-hOC">
<rect key="frame" x="138" y="15" width="138" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="点击播放" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c9x-ah-UDf">
<rect key="frame" x="276" y="15" width="138" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.86272245650000001" green="0.85881525280000004" blue="0.85882407429999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="zSW-Qs-mlC" firstAttribute="top" secondItem="scl-co-ww3" secondAttribute="top" id="FXx-hH-bkT"/>
<constraint firstAttribute="bottom" secondItem="zSW-Qs-mlC" secondAttribute="bottom" id="NsQ-qX-yNh"/>
<constraint firstAttribute="trailing" secondItem="zSW-Qs-mlC" secondAttribute="trailing" id="d01-l2-FCR"/>
<constraint firstAttribute="height" constant="50" id="h38-Zb-UEl"/>
<constraint firstItem="zSW-Qs-mlC" firstAttribute="leading" secondItem="scl-co-ww3" secondAttribute="leading" id="mA5-SY-jbp"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pFd-XZ-Jwy" userLabel="searchbtn">
<rect key="frame" x="107" y="155" width="200" height="40"/>
<color key="backgroundColor" red="0.18429952860000001" green="0.30440244080000001" blue="0.60787326100000005" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="1yp-Hf-JjV"/>
<constraint firstAttribute="width" constant="200" id="gx4-BG-yFb"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="搜索">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="22"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="searchClick:" destination="-1" eventType="touchUpInside" id="rSZ-cN-U9H"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="scl-co-ww3" secondAttribute="trailing" id="1VR-WR-e6W"/>
<constraint firstAttribute="trailing" secondItem="gbN-3d-Trv" secondAttribute="trailing" id="KhA-b0-anV"/>
<constraint firstAttribute="bottom" secondItem="scl-co-ww3" secondAttribute="bottom" id="L07-CX-pdS"/>
<constraint firstItem="gbN-3d-Trv" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="bottom" id="Okw-TR-kVK"/>
<constraint firstItem="gbN-3d-Trv" firstAttribute="leading" secondItem="arN-mi-hdC" secondAttribute="leading" id="Opk-FY-W4j"/>
<constraint firstAttribute="height" constant="260" id="SsD-g5-MmX"/>
<constraint firstItem="HW3-zp-qaz" firstAttribute="leading" secondItem="arN-mi-hdC" secondAttribute="leading" id="agv-XB-JbS"/>
<constraint firstItem="pFd-XZ-Jwy" firstAttribute="bottom" secondItem="scl-co-ww3" secondAttribute="top" constant="-15" id="cT0-Zx-pUY"/>
<constraint firstItem="pFd-XZ-Jwy" firstAttribute="centerX" secondItem="arN-mi-hdC" secondAttribute="centerX" id="dHp-bj-eHJ"/>
<constraint firstItem="scl-co-ww3" firstAttribute="leading" secondItem="arN-mi-hdC" secondAttribute="leading" id="haG-gj-UoE"/>
<constraint firstItem="gbN-3d-Trv" firstAttribute="height" secondItem="HW3-zp-qaz" secondAttribute="height" id="kl6-xN-0VO"/>
<constraint firstAttribute="trailing" secondItem="HW3-zp-qaz" secondAttribute="trailing" id="oFM-ba-NAO"/>
<constraint firstItem="HW3-zp-qaz" firstAttribute="top" secondItem="arN-mi-hdC" secondAttribute="top" constant="20" id="p1u-8F-9Ts"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="4mg-Y4-tdd">
<rect key="frame" x="0.0" y="304" width="414" height="558"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="CH5-1Z-Qaq"/>
<outlet property="delegate" destination="-1" id="JH8-Tr-RKB"/>
</connections>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="Lst-Xu-cte"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="arN-mi-hdC" firstAttribute="leading" secondItem="Lst-Xu-cte" secondAttribute="leading" id="30u-N1-5B0"/>
<constraint firstItem="Lst-Xu-cte" firstAttribute="trailing" secondItem="arN-mi-hdC" secondAttribute="trailing" id="8U8-5f-eTf"/>
<constraint firstItem="4mg-Y4-tdd" firstAttribute="leading" secondItem="Lst-Xu-cte" secondAttribute="leading" id="Cze-nN-z6e"/>
<constraint firstItem="arN-mi-hdC" firstAttribute="top" secondItem="Lst-Xu-cte" secondAttribute="top" id="EwH-aK-ekx"/>
<constraint firstItem="Lst-Xu-cte" firstAttribute="bottom" secondItem="4mg-Y4-tdd" secondAttribute="bottom" id="FwL-3f-iZL"/>
<constraint firstItem="4mg-Y4-tdd" firstAttribute="top" secondItem="arN-mi-hdC" secondAttribute="bottom" id="MjI-zf-0B5"/>
<constraint firstItem="Lst-Xu-cte" firstAttribute="trailing" secondItem="4mg-Y4-tdd" secondAttribute="trailing" id="fux-Ym-8Qa"/>
</constraints>
<point key="canvasLocation" x="137.68115942028987" y="81.696428571428569"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@ -7,11 +7,12 @@
//
#import <UIKit/UIKit.h>
#import <GWP2P/GWP2P.h>
@interface IfishPlaybackViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *palybackVideo;
@property (weak, nonatomic) IBOutlet UILabel *videoLongth;
@property (weak, nonatomic) IBOutlet UILabel *videoTime;
@property (weak, nonatomic) IBOutlet UIImageView *playImageView;
@property (weak, nonatomic) IBOutlet UILabel *startTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *endTimeLabel;
@property (nonatomic, strong) GWPlaybackFileModel *model;
@end

View File

@ -13,7 +13,7 @@
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.palybackVideo.image = LXImageWithImageName(@"playback_iocn_video");
self.playImageView.image = LXImageWithImageName(@"playback_iocn_video");
}
@ -22,5 +22,35 @@
// Configure the view for the selected state
}
-(void)setModel:(GWPlaybackFileModel *)model
{
_model=model;
NSString*start=[NSString stringWithFormat:@"%ld%02ld%02ld%02ld%02ld",model.year,model.month,model.day,model.hour,model.minute];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyyMMddHHmm";
NSDate*date=[formatter dateFromString:start];
NSString*end=[NSString stringWithFormat:@"%ld%02ld%02ld%02ld%02ld",model.year,model.month,model.day,model.hour,model.minute];
if (date)
{
if ([model.cType isEqualToString:@"S"])
{
date=[date dateByAddingTimeInterval:model.time];
}
else
{
date=[date dateByAddingTimeInterval:model.time*60];
}
end=[formatter stringFromDate:date];
}
else
{
}
self.startTimeLabel.text=start;
self.endTimeLabel.text=end;
NSLog(@"date =%@ time=%ld",model.date,model.time);
}
@end

View File

@ -1,60 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="IfishPlaybackViewCell" id="KGk-i7-Jjw" customClass="IfishPlaybackViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="70"/>
<rect key="frame" x="0.0" y="0.0" width="539" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="69"/>
<tableViewCellContentView key="contentView" autoresizesSubviews="NO" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="539" height="70"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="录像" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fr5-kU-lL9">
<rect key="frame" x="54" y="13" width="208" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6iO-V5-oJZ">
<rect key="frame" x="54" y="36" width="208" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="30分钟" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uW9-bN-ief">
<rect key="frame" x="270" y="36" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AnP-CM-Ycx">
<rect key="frame" x="0.0" y="68" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.96078431372549022" blue="0.96470588235294119" alpha="1" colorSpace="calibratedRGB"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mrW-Tn-00Y">
<rect key="frame" x="10" y="24" width="30" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="y6h-3U-eVp">
<rect key="frame" x="0.0" y="0.0" width="503" height="539"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="202010171833" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mtl-sb-DhZ">
<rect key="frame" x="0.0" y="261" width="206.5" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="202010171833" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jDd-Rf-aT2">
<rect key="frame" x="206.5" y="261" width="206" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" id="Syh-58-pnu" userLabel="backView">
<rect key="frame" x="412.5" y="269.5" width="90.5" height="0.0"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YVK-ee-AkR">
<rect key="frame" x="30.5" y="-15" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="OAr-LF-mDb"/>
<constraint firstAttribute="height" constant="30" id="y9z-26-RmD"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="YVK-ee-AkR" firstAttribute="centerX" secondItem="Syh-58-pnu" secondAttribute="centerX" id="BlS-n1-JSf"/>
<constraint firstItem="YVK-ee-AkR" firstAttribute="centerY" secondItem="Syh-58-pnu" secondAttribute="centerY" id="GZW-7p-Umo"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="y6h-3U-eVp" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="0BY-ct-2rB"/>
<constraint firstItem="y6h-3U-eVp" firstAttribute="trailing" secondItem="H2p-sc-9uM" secondAttribute="trailing" id="BjQ-0S-K1J"/>
<constraint firstItem="y6h-3U-eVp" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Xxg-jR-ij3"/>
<constraint firstItem="y6h-3U-eVp" firstAttribute="bottom" secondItem="H2p-sc-9uM" secondAttribute="bottom" id="orC-r6-VT1"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="palybackVideo" destination="mrW-Tn-00Y" id="fjd-ft-f5S"/>
<outlet property="videoLongth" destination="uW9-bN-ief" id="xo3-Jd-NaM"/>
<outlet property="videoTime" destination="6iO-V5-oJZ" id="3ar-eN-xk7"/>
<outlet property="endTimeLabel" destination="jDd-Rf-aT2" id="C1n-EA-bru"/>
<outlet property="playImageView" destination="YVK-ee-AkR" id="FUp-PM-im4"/>
<outlet property="startTimeLabel" destination="mtl-sb-DhZ" id="tf7-Iz-LJA"/>
</connections>
<point key="canvasLocation" x="-34.399999999999999" y="400.29985007496254"/>
</tableViewCell>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@ -11,6 +11,9 @@
#import "IfishCameraRecordfirstCell.h"
#import "IfishCameraRecordSecondCell.h"
#import "IfishCameraRecordThirdCell.h"
#import "TemperatureSetModel.h"
#import "TemperatureSetCell.h"
#import "MydatePickerView.h"
#define RECODIEECELL_TIME 911
#define RECODIEECELL_BTN 922
#define RECODIEECELL_SWiTCH 933
@ -32,8 +35,8 @@ static const CGFloat ToastFade = 0.2;
@property(nonatomic) NSIndexPath *buttonIndex;
@property(assign) unsigned int remoteRecordState;
//app
@property(nonatomic) BOOL isManual;
@property(nonatomic,strong) NSMutableArray*array;
@property (nonatomic, strong)MydatePickerView *mydatepicView;
@end
@ -42,42 +45,17 @@ static const CGFloat ToastFade = 0.2;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"手动录制"];
_timestr= @"00:00";
_isRecording = NO;
_isManual = NO;
[self addTitleViewWithTitle:@"录制视频"];
[self creatUI];
self.view.backgroundColor = RGB(242, 242, 242);
// self.view.backgroundColor = RGB(242, 242, 242);
}
-(void)goBackAction{
if (_isRecording) {
UIAlertController*ac=[UIAlertController alertControllerWithTitle:@"" message:@"是否结束手动录制" preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:ac animated:YES completion:nil];
[ac addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction*action){
}]];
[ac addAction:[UIAlertAction actionWithTitle:@"结束" style:UIAlertActionStyleDefault handler:^(UIAlertAction*action){
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_OFF];
[self.navigationController popViewControllerAnimated:YES];
}]];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
[self.navigationController popViewControllerAnimated:YES];
}
-(void)creatUI{
@ -88,7 +66,7 @@ static const CGFloat ToastFade = 0.2;
self.tab.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tab.showsVerticalScrollIndicator = NO;
self.tab.scrollEnabled = NO;
self.tab.backgroundColor = RGB(242, 242, 242);
//self.tab.backgroundColor = RGB(242, 242, 242);
[self.view addSubview:self.tab];
}
@ -102,68 +80,16 @@ static const CGFloat ToastFade = 0.2;
BOOL connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
if (connectDevice) {
[self connectCamera];
}else{
NSLog(@"p2pConnect failure.失败,不能操作设备");
}
}
}
//
-(void)connectCamera{
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.camera.cameraId password:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
if (success) {
_isConnectCamera = YES;
[self monitorP2PCall];
NSLog(@"当前连接设备信息:%@",dataDictionary);
}else{
_isConnectCamera = YES;
[self monitorP2PCall];
// _isConnectCamera = NO;
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self.view makeToast:@"连接设备失败"];
// [self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:NO];
// });
// return;
}
}];
}
#pragma mark --
-(void)monitorP2PCall{
if ([self.player isPlaying]) {//
return;
}
//p2p
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
[self connectDevice];
return;
}
//
if (!_isConnectCamera) {
[self connectCamera];
return;
}
WEAK_SELF;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[weakSelf.player p2pCallDeviceWithDeviceId:self.camera.cameraId password:self.camera.cameraPass definition:GWP2PPTZDefinitionSD calling:^(NSDictionary *parameters) {
//
NSLog(@"[p2pCallDevice-Calling],paras=%@",parameters);
} accept:^(NSDictionary *parameters) {
NSLog(@"[p2pCallDevice-Accept],paras=%@",parameters);
} reject:^(GWP2PCallError error, NSString *errorCode) {
} ready:^{
} allowLAN:YES];
});
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@ -171,577 +97,206 @@ static const CGFloat ToastFade = 0.2;
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveRemoteMessage:) name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ack_receiveRemoteMessage:) name:ACK_RECEIVE_REMOTE_MESSAGE object:nil];
[[P2PClient sharedClient] getNpcSettingsWithId:self.camera.cameraId password:self.camera.cameraPass];
// [[P2PClient sharedClient] getSDCardInfoWithId:self.camera.cameraId password:self.camera.cameraPass];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:ACK_RECEIVE_REMOTE_MESSAGE object:nil];
}
#pragma mark - receiveRemoteMessage
- (void)receiveRemoteMessage:(NSNotification *)notification
{
NSDictionary *parameter = [notification userInfo];
int key = [[parameter valueForKey:@"key"] intValue];
switch (key) {
case RET_GET_SDCARD_INFO:
{
NSInteger result = [[parameter valueForKey:@"result"] intValue];
dispatch_async(dispatch_get_main_queue(), ^{
if (result == 1) {
//[self.view makeToast:@"sdk卡可使用"];
//
// [[P2PClient sharedClient] getNpcSettingsWithId:self.camera.cameraId password:self.camera.cameraPass];
if (_isManual) {
if (self.remoteRecordState ==1){
//[self.view makeToast:@"请先关闭自动录制"];
[self showLableAction:@"请先关闭自动录制"];
dispatch_async(dispatch_get_main_queue(), ^{
[self hiddenTostVIew];
});
[self resetTimerlabel];
return ;
}
NSArray *buttonindex =@[self.buttonIndex];
[self.tab reloadRowsAtIndexPaths:buttonindex withRowAnimation:UITableViewRowAnimationNone];
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
}else{
[self showLableAction:@"请先关闭自动录制"];
dispatch_async(dispatch_get_main_queue(), ^{
[self hiddenTostVIew];
});
[self resetTimerlabel];
}
}else{
//sd
//
dispatch_async(dispatch_get_main_queue(), ^{
[self hiddenTostVIew];
});
[self resetTimerlabel];
[self.view makeToast:NSLocalizedString(@"no_storage", nil)];
}
});
}
break;
case RET_GET_NPCSETTINGS_PRERECORD: //
{
NSInteger state = [[parameter valueForKey:@"state"] intValue];
NSLog(@"预录像开关 获取时state%ld",(long)state);
}
break;
case RET_SET_NPCSETTINGS_PRERECORD: //
{
NSInteger result = [[parameter valueForKey:@"result"] intValue];
if(result==0){
NSLog(@"预录像开关设置result%ld",(long)result);
}else{
NSLog(@"预录像开关设置result%ld",(long)result);
}
}
break;
case RET_SET_NPCSETTINGS_REMOTE_RECORD:
{
NSInteger result = [[parameter valueForKey:@"result"] integerValue];
if(result==0){
//
dispatch_async(dispatch_get_main_queue(), ^{
[self hiddenTostVIew];
});
[[P2PClient sharedClient] getNpcSettingsWithId:self.camera.cameraId password:self.camera.cameraPass];
}else{
NSLog(@"设置失败:%li",(long)result);
}
}
break;
case RET_GET_NPCSETTINGS_REMOTE_RECORD:
{
//
NSInteger state = [[parameter valueForKey:@"state"] intValue];
self.remoteRecordState = (unsigned int)state;
if (state ==0) {
dispatch_async(dispatch_get_main_queue(), ^{
[self resetTimerlabel];
});
}else{
}
if (_isManual) {
//switch
return;
}
NSLog(@"获取 remote record state:%li",(long)state);
dispatch_async(dispatch_get_main_queue(), ^{
NSArray *index =@[self.switchIndex];
[self.tab reloadRowsAtIndexPaths:index withRowAnimation:UITableViewRowAnimationNone];
// NSArray *buttonindex =@[self.buttonIndex];
// [self.tab reloadRowsAtIndexPaths:buttonindex withRowAnimation:UITableViewRowAnimationNone];
});
}
case RET_GET_NPCSETTINGS_RECORD_TYPE:
{
NSInteger type = [[parameter valueForKey:@"type"] intValue];
//0
NSLog(@"获取录像模式类型type%ld",(long)type);
}
break;
case RET_SET_NPCSETTINGS_RECORD_TYPE:
{
NSInteger result = [[parameter valueForKey:@"result"] intValue];
//0
if (result==0) {
//[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
// password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
}
NSLog(@"设置录像模式类型result%ld",(long)result);
}
break;
default:
break;
}
}
#pragma mark -ack_receiveRemoteMessage
- (void)ack_receiveRemoteMessage:(NSNotification *)notification{
NSDictionary *parameter = [notification userInfo];
int key = [[parameter valueForKey:@"key"] intValue];
int result = [[parameter valueForKey:@"result"] intValue];
switch (key) {
case ACK_RET_GET_SDCARD_INFO:
{
dispatch_async(dispatch_get_main_queue(), ^{
if(result==1){
[self.view makeToast:NSLocalizedString(@"device_password_error", nil)];
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// usleep(800000);
//
//
// });
}else if(result==2){
DLog(@"resend do device update");
}
});
DLog(@"ACK_RET_GET_SDCARD_INFO:%i",result);
}
break;
case ACK_RET_SET_SDCARD_INFO:
{
dispatch_async(dispatch_get_main_queue(), ^{
if(result==1){
[self.view makeToast:NSLocalizedString(@"device_password_error", nil)];
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// usleep(800000);
// dispatch_async(dispatch_get_main_queue(), ^{
// });
// });
}else if(result==2){
DLog(@"resend do device update");
}
});
}
break;
default:
break;
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section ==2) {
return 2;
}
return 1;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 3;
return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
TemperatureSetCell*cell=[tableView dequeueReusableCellWithIdentifier:@"TemperatureSetCell"];
if (cell==nil) {
cell=[[[NSBundle mainBundle]loadNibNamed:@"TemperatureSetCell" owner:self options:nil]lastObject];
}
cell.backgroundView=nil;
cell.backgroundColor= RGB(242, 242, 242);
if (indexPath.section ==0 && indexPath.row ==0) {
IfishCameraRecordfirstCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishCameraRecordfirstCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishCameraRecordfirstCell" owner:self options:nil]lastObject];
TemperatureSetModel*model=[[TemperatureSetModel alloc]init];
model.title=@"即时录制";
model.temperatureLabel=@"";
model.status=[[DataCenter defaultDtacenter].cache stringForKey:@"NowRecord"];
cell.titleLabel.text=model.title;
cell.temperaturelabel.text=model.temperatureLabel;
[cell.temPSwitch addTarget:self action:@selector(nowRecordBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.selected=[model.status isEqualToString:@"1"];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (indexPath.section ==2 && indexPath.row ==0){
IfishCameraRecordSecondCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishCameraRecordSecondCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishCameraRecordSecondCell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.tag = RECODIEECELL_TIME;
self.timerIndex = indexPath;
cell.timeLabe.text = _timestr;
_isRecording ? [cell.timeLabe setTextColor:RGB(51, 51, 51)] : [cell.timeLabe setTextColor:RGB(153, 153, 153)];
[cell cellRecordBViewCorner];
return cell;
}else if (indexPath.section ==2 && indexPath.row ==1){
IfishCameraRecordThirdCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishCameraRecordThirdCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishCameraRecordThirdCell" owner:self options:nil]lastObject];
}
cell.tag = RECODIEECELL_BTN;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.recordBtn addTarget:self action:@selector(recordBtnAction:) forControlEvents:UIControlEventTouchUpInside];
if (_isRecording) {
cell.recordBtn.selected = YES;
[cell.recordBtn setBackgroundColor:RGB(255,115,92)];
[cell.recordBtn setTitle:@"结束录制" forState:UIControlStateNormal];
}else{
cell.recordBtn.selected = NO;
[cell.recordBtn setBackgroundColor:RGB(0,184,239)];
[cell.recordBtn setTitle:@"开始录制" forState:UIControlStateNormal];
}
self.buttonIndex =indexPath;
[cell cellSetRecordBtnBackViewCorner];
return cell;
}else if (indexPath.section ==1 && indexPath.row ==0){
self.switchIndex = indexPath;
IfishCameraRecordFourCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishCameraRecordFourCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishCameraRecordFourCell" owner:self options:nil]lastObject];
}
cell.tag = RECODIEECELL_SWiTCH;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.zidongSw addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside];
if (self.remoteRecordState==1) {
[cell.zidongSw setOn:YES];
}else{
[cell.zidongSw setOn:NO];
}
return cell;
TemperatureSetModel*model=[[TemperatureSetModel alloc]init];
model.title=@"定时录制";
model.temperatureLabel=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"].length?[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"]:@"09:00-16:00";
model.status=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecord"];
cell.titleLabel.text=model.title;
cell.temperaturelabel.text=model.temperatureLabel;
[cell.temPSwitch addTarget:self action:@selector(schduleRecordAction:) forControlEvents:UIControlEventTouchUpInside];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.selected=[model.status isEqualToString:@"1"];
}
return nil;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section ==0 && indexPath.row ==0) {
return kScreenSize.width*0.516;
}else if (indexPath.section ==2 && indexPath.row ==0){
return kScreenSize.width*0.357;
}else if (indexPath.section ==1 && indexPath.row ==0){
return 46*KWidth_Scale;
}else if (indexPath.section ==2 && indexPath.row ==1){
return 76*KWidth_Scale;
}
return 0;
return 50;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section==0) {
return kScreenSize.width*0.213;
}
return 5;
return 5;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if (section ==0) {
UIView *sectionV1=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width,kScreenSize.width*0.213)];
sectionV1.backgroundColor = RGB(242, 242, 242);
return sectionV1;
}
UIView *sectionV2=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width,5)];
sectionV2.backgroundColor = RGB(242, 242, 242);
sectionV2.backgroundColor =[UIColor whiteColor];
return sectionV2;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section==1)
{
if (!self.mydatepicView) {
_mydatepicView=[[MydatePickerView alloc]init];
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
[_mydatepicView setIsNewXuanduo:YES];
[_mydatepicView.picView reloadAllComponents];
[_mydatepicView.cancleButton addTarget:self action:@selector(cancleButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
NSString*time=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"].length?[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"]:@"09:00-16:00";
NSString*start=[[time componentsSeparatedByString:@"-"] firstObject];
NSString*end=[[time componentsSeparatedByString:@"-"] lastObject];
NSString*startHour=[[start componentsSeparatedByString:@":"] firstObject];
NSString*startMin=[[start componentsSeparatedByString:@":"] lastObject];
NSString*endHour=[[end componentsSeparatedByString:@":"] firstObject];
NSString*endMin=[[end componentsSeparatedByString:@":"] lastObject];
_mydatepicView.startString=startHour;
_mydatepicView.endString=startMin;
_mydatepicView.startString1=endHour;
_mydatepicView.endString1=endHour;
[_mydatepicView.picView selectRow:[(NSArray*)(_mydatepicView.dataArr[0]) indexOfObject:startHour] inComponent:0 animated:YES];
[_mydatepicView.picView selectRow:[(NSArray*)(_mydatepicView.dataArr[1]) indexOfObject:startMin] inComponent:1 animated:YES];
[_mydatepicView.picView selectRow:[(NSArray*)(_mydatepicView.dataArr[2]) indexOfObject:endHour] inComponent:2 animated:YES];
[_mydatepicView.picView selectRow:[(NSArray*)(_mydatepicView.dataArr[3]) indexOfObject:endMin] inComponent:3 animated:YES];
}
[self.view addSubview:_mydatepicView];
}
}
#pragma mark - recordBtnAction
-(void)recordBtnAction:(UIButton*)btn{
#pragma mark
-(void)doneButtonClick{
if (btn.selected) {
[self resetTimerlabel];
_isManual = NO;
//
[self startTostVIew];
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_OFF];
[self showLableAction:@"录制成功,请在回放中查看"];
}else{
[self startRunTimerlabel];
_isManual = YES;
//
//SDCard
[self startTostVIew];
[[P2PClient sharedClient] getSDCardInfoWithId:self.camera.cameraId password:self.camera.cameraPass];
}
}
-(void)startRunTimerlabel
{
//IfishCameraRecordThirdCell *cell=[self.view viewWithTag:RECODIEECELL_BTN];
//cell.recordBtn.selected =YES;
_isRecording=YES;
__weak typeof(self)weakSelf=self;
NSInteger count = 30*60;
//NSInteger count = -1;
//NSInteger count = 60;
weakSelf.timer = [NSTimer scheduledTimerWithTimeInterval:1 count:count callback:^{
weakSelf.second++;
if (weakSelf.second ==60) {
weakSelf.second = 0;
weakSelf.minute++;
}
if (weakSelf.minute ==30) {
weakSelf.minute =0;
weakSelf.second =0;
[self resetTimerlabel];
_isManual = NO;
//
[self startTostVIew];
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_OFF];
[self showLableAction:@"录制成功,请在回放中查看"];
return ;
}
_timestr= [IfishHelperUtils formatCameraPalybackTime:weakSelf.minute second:weakSelf.second];
NSArray *index =@[self.timerIndex];
[self.tab reloadRowsAtIndexPaths:index withRowAnimation:UITableViewRowAnimationNone];
}];
[[NSRunLoop currentRunLoop] addTimer: weakSelf.timer forMode:NSRunLoopCommonModes];
// NSArray *buttonindex =@[self.buttonIndex];
// [self.tab reloadRowsAtIndexPaths:buttonindex withRowAnimation:UITableViewRowAnimationNone];
}
-(void)resetTimerlabel
{
_isRecording=NO;
if (_timer) {
[_timer unfireTimer];
}
self.minute =0;
self.second =0;
_timestr = @"00:00";
NSArray *index =@[self.timerIndex];
[self.tab reloadRowsAtIndexPaths:index withRowAnimation:UITableViewRowAnimationNone];
NSArray *buttonindex =@[self.buttonIndex];
[self.tab reloadRowsAtIndexPaths:buttonindex withRowAnimation:UITableViewRowAnimationNone];
}
#pragma mark -
-(void)startTostVIew{
self.progressAlert = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:self.progressAlert];
self.progressAlert.mode=MBProgressHUDModeIndeterminate;
self.progressAlert.customView = [[UIView alloc] init];
//self.progressAlert.labelText = [NSString stringWithFormat:@"%@...",NSLocalizedString(@"validating", nil)];
[self.progressAlert show:YES];
//5
[self.progressAlert hide:YES afterDelay:5];
}
-(void)hiddenTostVIew
{
[self.progressAlert hide:YES];
}
#pragma mark - switchAction:
-(void)switchAction:(UISwitch*)sender
{
IfishCameraRecordFourCell *cell =[self.view viewWithTag:RECODIEECELL_SWiTCH];
UISwitch* swt=(UISwitch*)sender;
cell.zidongSw = swt;
if (_isRecording) {
dispatch_async(dispatch_get_main_queue(), ^{
[cell.zidongSw setOn:NO];
});
//[self.view makeToast:@"请先结束手动录制"];
[self showLableAction:@"请先结束手动录制"];
return;
}
[self startTostVIew];
if (swt.isOn) {
_isManual = NO;
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
[[P2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeSchedule withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"data=%@",dataDictionary);
}];;
_mydatepicView.resultString=nil;
if (_mydatepicView.startString==nil||_mydatepicView.endString==nil) {
[self showTitle:@"" messsage:@"请选择时间"];
}else{
_isManual = YES;
[[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId
password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON];
_mydatepicView.resultString=[NSString stringWithFormat:@"%@:%@-%@:%@",_mydatepicView.startString,_mydatepicView.endString,_mydatepicView.startString1,_mydatepicView.endString1];
[[DataCenter defaultDtacenter].cache setString:_mydatepicView.resultString forKey:@"schduleRecordTime"];
[_mydatepicView removeFromSuperview];
TemperatureSetCell*cell=[self.tab cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]];
cell.temperaturelabel.text=_mydatepicView.resultString;
}
}
-(void)cancleButtonClick{
[_mydatepicView removeFromSuperview];
}
-(void)nowRecordBtnAction:(UIButton*)btn{
btn.selected=!btn.selected;
[[DataCenter defaultDtacenter].cache setString:[NSString stringWithFormat:@"%ld",btn.selected] forKey:@"NowRecord"];
if (btn.selected)
{
}else
{
}
}
-(void)schduleRecordAction:(UISwitch*)btn
{
btn.selected=!btn.selected;
[[DataCenter defaultDtacenter].cache setString:[NSString stringWithFormat:@"%ld",btn.selected] forKey:@"schduleRecord"];
if (btn.selected) {
[[GWP2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeSchedule withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"data=%@",dataDictionary);
}];
}else{
}
}
- (void)showLableAction:(NSString *)str{
UILabel *laberAction =[[UILabel alloc]init];
CGFloat labW = 200;
laberAction.frame =CGRectMake(kScreenSize.width/2 - labW/2,kScreenSize.height*3/4 - 50 , labW, 40);
laberAction.clipsToBounds =YES;
laberAction.layer.cornerRadius =5;
laberAction.layer.backgroundColor = [UIColor blackColor].CGColor;
laberAction.alpha =1;
laberAction.text =str;
laberAction.textAlignment =NSTextAlignmentCenter;
//laberAction.backgroundColor =IndicatorBack_COLOR;
laberAction.font=[UIFont systemFontOfSize:14];
laberAction.textColor=[UIColor whiteColor];
[self.view addSubview:laberAction];
[UIView animateWithDuration:ToastFade
delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
laberAction.alpha = 1.0;
} completion:^(BOOL finished) {
[UIView animateWithDuration:ToastFade
delay:1.5
options:UIViewAnimationOptionCurveEaseIn
animations:^{
laberAction.alpha = 0.0;
} completion:^(BOOL finished) {
[laberAction removeFromSuperview];
}];
}];
}
@end

View File

@ -11,5 +11,5 @@
@interface TemperatureSetModel : NSObject
@property(nonatomic,copy)NSString*title;
@property(nonatomic,copy)NSString*temperatureLabel;
//@property(nonatomic);
@property(nonatomic,copy)NSString*status;//开关状态,新增
@end

View File

@ -0,0 +1,16 @@
//
// DatePickerCustomView.h
// E-Mobile
//
// Created by Yang on 15/9/18.
//
//
#import <UIKit/UIKit.h>
@interface DatePickerCustomView : UIView
@property(nonatomic,copy)dispatch_block_t dateChanged;
@property(nonatomic,copy)dispatch_block_t cancelBlock;
@property(nonatomic,strong)UIDatePicker* datePicker;
+(instancetype)showInView:(UIView*)view Mode:(UIDatePickerMode)mode date:(NSDate*)date;
@end

View File

@ -0,0 +1,114 @@
//
// DatePickerCustomView.m
// E-Mobile
//
// Created by Yang on 15/9/18.
//
//
#import "DatePickerCustomView.h"
@interface DatePickerCustomView(){
}
@property(nonatomic,strong)UIButton* timePickerCancelBtn;
@property(nonatomic,strong)UIView* buttonView;
@end
@implementation DatePickerCustomView
+(instancetype)showInView:(UIView*)view Mode:(UIDatePickerMode)mode date:(NSDate*)date
{
DatePickerCustomView* customView = [[self alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];
if (customView) {
customView.backgroundColor=RGBA(0, 0, 0, 0.3);
UIButton* timePickerCancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
customView.timePickerCancelBtn = timePickerCancelBtn;
timePickerCancelBtn.tag = 100;
timePickerCancelBtn.frame = customView.bounds;
[timePickerCancelBtn addTarget:customView action:@selector(datePickerCancelBtnPressed:) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:timePickerCancelBtn];
UIDatePicker* datePicker = [[UIDatePicker alloc] initWithFrame: CGRectMake(0, customView.frame.size.height+40, customView.frame.size.width, 216)];
customView.datePicker = datePicker;
[datePicker setLocale:[NSLocale autoupdatingCurrentLocale]];
[datePicker setDatePickerMode:mode];
datePicker.backgroundColor=[UIColor whiteColor];
datePicker.tag = 101;
if (date) {
[datePicker setDate:date];
}
// [datePicker addTarget:customView action:@selector(datePickerChanged:) forControlEvents:UIControlEventValueChanged];
[customView addSubview:datePicker];
UIView *buttonView = [[UIView alloc] initWithFrame:CGRectMake(0, customView.frame.size.height, customView.frame.size.width, 40)];
customView.buttonView = buttonView;
buttonView.backgroundColor = [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1];
[customView addSubview:buttonView];
UIButton *cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 40)];
[cancelBtn addTarget:customView action:@selector(datePickerCancelBtnPressed:) forControlEvents:UIControlEventTouchUpInside];
[cancelBtn setTitle:NSLocalizedString(@"取消", nil) forState:UIControlStateNormal];
[cancelBtn setTitle:NSLocalizedString(@"取消", nil) forState:UIControlStateSelected];
cancelBtn.titleLabel.font = [UIFont systemFontOfSize:15];
[cancelBtn setTitleColor:[UIColor colorWithRed:21.0/255 green:126.0/255 blue:251.0/255 alpha:1] forState:UIControlStateNormal];
[cancelBtn setTitleColor:[UIColor colorWithRed:21.0/255 green:126.0/255 blue:251.0/255 alpha:1] forState:UIControlStateSelected];
[buttonView addSubview:cancelBtn];
UIButton *commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(customView.frame.size.width-60, 0, 60, 40)];
[commitBtn addTarget:customView action:@selector(datePickerCommitBtnPressed:) forControlEvents:UIControlEventTouchUpInside];
[commitBtn setTitle:NSLocalizedString(@"确定", nil) forState:UIControlStateNormal];
[commitBtn setTitle:NSLocalizedString(@"确定", nil) forState:UIControlStateSelected];
commitBtn.titleLabel.font = [UIFont systemFontOfSize:15];
[commitBtn setTitleColor:[UIColor colorWithRed:21.0/255 green:126.0/255 blue:251.0/255 alpha:1] forState:UIControlStateNormal];
[commitBtn setTitleColor:[UIColor colorWithRed:21.0/255 green:126.0/255 blue:251.0/255 alpha:1] forState:UIControlStateSelected];
[buttonView addSubview:commitBtn];
[customView showDatePickerInView:view];
}
return customView;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
/*init code*/
}
return self;
}
-(void)datePickerCancelBtnPressed:(UIButton*)btn{
[UIView animateWithDuration:0.2 animations:^{
self.datePicker.frame = CGRectMake(0, self.frame.size.height+40, self.frame.size.width, 216);
self.buttonView.frame = CGRectMake(0, self.frame.size.height, self.frame.size.width, 40);
}completion:^(BOOL finished) {
if (self.cancelBlock) {
self.cancelBlock();
}
[self removeFromSuperview];
}];
}
-(void)datePickerCommitBtnPressed:(UIButton*)btn {
[UIView animateWithDuration:0.2 animations:^{
self.datePicker.frame = CGRectMake(0, self.frame.size.height+40, self.frame.size.width, 216);
self.buttonView.frame = CGRectMake(0, self.frame.size.height, self.frame.size.width, 40);
}completion:^(BOOL finished) {
self.dateChanged();
[self removeFromSuperview];
}];
}
-(void)showDatePickerInView:(UIView*)view{
[view addSubview:self];
[UIView animateWithDuration:0.2 animations:^{
self.datePicker.frame = CGRectMake(0, self.frame.size.height-216, self.frame.size.width, 216);
self.buttonView.frame = CGRectMake(0, self.frame.size.height-216-40, self.frame.size.width, 40);
}];
}
-(void)datePickerChanged:(id)sender{
self.dateChanged();
}
@end