Browse Source

【代码优化】优化时间在12小时制情况下,时间选择器选择时间后出现上午下午问题

master
公司电脑 1 year ago
parent
commit
24bbf2dc59
  1. 2
      tongxin.xcodeproj/xcshareddata/xcschemes/yisai-LeKan.xcscheme
  2. BIN
      tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate
  3. 48
      tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 4
      tongxin/Helpers/myHelper.h
  5. 5
      tongxin/Helpers/myHelper.m
  6. 29
      tongxin/VC/WatchHome/DeviceInfo/CallVideo/Agora/CallViewController.m
  7. 9
      tongxin/VC/WatchHome/DeviceInfo/Course/AddCourseViewController.m
  8. 8
      tongxin/VC/WatchHome/DeviceInfo/TimingSwitchVC/TimingSwitchVC.m
  9. 9
      tongxin/VC/WatchHome/DisturbBan/AddDBViewController.m
  10. 2
      tongxin/VC/WatchHome/DisturbBan/DurationTimeTableViewCell.m
  11. 3
      tongxin/VC/WatchHome/VoiceAlarm/AddVAViewController.m
  12. 2
      tongxin/xBase/View/cell/TableCell.m

2
tongxin.xcodeproj/xcshareddata/xcschemes/yisai-LeKan.xcscheme

@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

BIN
tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

48
tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@ -1385,53 +1385,5 @@ @@ -1385,53 +1385,5 @@
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "814C7350-A371-4258-BC80-0DB1815FDD90"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "tongxin/VC/DeviceTab/DeviceTabViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "61"
endingLineNumber = "61"
landmarkName = "-viewDidLoad"
landmarkType = "7">
<Locations>
<Location
uuid = "814C7350-A371-4258-BC80-0DB1815FDD90 - 223457a31b3e4996"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__38-[DeviceTabViewController viewDidLoad]_block_invoke.11"
moduleName = "&#x4e50;&#x5eb7;&#x5b88;&#x62a4;"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/ecell/leKanShouHu-ios/tongxin/VC/DeviceTab/DeviceTabViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "61"
endingLineNumber = "61"
offsetFromSymbolStart = "0">
</Location>
<Location
uuid = "814C7350-A371-4258-BC80-0DB1815FDD90 - 223457a31b3e4996"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__38-[DeviceTabViewController viewDidLoad]_block_invoke.11"
moduleName = "&#x4e50;&#x5eb7;&#x5b88;&#x62a4;"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/ecell/leKanShouHu-ios/tongxin/VC/DeviceTab/DeviceTabViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "61"
endingLineNumber = "61"
offsetFromSymbolStart = "60">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

4
tongxin/Helpers/myHelper.h

@ -56,10 +56,10 @@ @@ -56,10 +56,10 @@
// 39.108.227.227 api.ecellsz.com
//#ifdef DEBUG
//测试环境
#define xBaseUrl @"http://api.test.ecellsz.com"
//#define xBaseUrl @"http://api.test.ecellsz.com"
//#else
//正式环境
//#define xBaseUrl @"http://39.108.227.227"
#define xBaseUrl @"http://39.108.227.227"
//#endif
//#define xBaseUrl @"http://39.108.227.227"
//#define xBaseUrl @"http://api.test.ecellsz.com"

5
tongxin/Helpers/myHelper.m

@ -29,7 +29,12 @@ @@ -29,7 +29,12 @@
}
+ (NSString *)getDateFormatWithStr:(NSString *)dateFormat date:(NSDate *)date{
NSDateFormatter*dateFormatter = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
dateFormatter.locale = zh_CNLocale;
dateFormatter.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[dateFormatter setDateFormat:dateFormat];
return [dateFormatter stringFromDate:date];
}

29
tongxin/VC/WatchHome/DeviceInfo/CallVideo/Agora/CallViewController.m

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
#import "MJExtension.h"
#import "AppDelegate.h"
#import "GCDTimerManager.h"
//CXCallObserverDelegate
@interface CallViewController ()<AgoraRtcEngineDelegate>
@ -79,7 +80,7 @@ @@ -79,7 +80,7 @@
@property (nonatomic) int timeLength;
@property (strong, nonatomic) NSTimer *timeTimer;
@property (nonatomic ,assign) NSInteger timeNumber;
/**
是否是接通状态
@ -300,6 +301,8 @@ @@ -300,6 +301,8 @@
//[callObserver setDelegate:self queue:dispatch_get_main_queue()];
}
if (self.isReceiveCall)
[self zhudong];
}
@ -469,6 +472,7 @@ @@ -469,6 +472,7 @@
self.isCall = YES;
[self joinChannel];
[self stopRing];
[self quxiao];
}
/**
@ -479,6 +483,7 @@ @@ -479,6 +483,7 @@
{
[self stopRing];
[self leaveChannel];
[self quxiao];
if(!hangUping)
{
WEAKSELF
@ -517,6 +522,7 @@ @@ -517,6 +522,7 @@
- (void)hangUpButton:(UIButton *)sender {
[self stopRing];
[self leaveChannel];
[self quxiao];
if(!hangUping){
hangUping = YES;
WEAKSELF
@ -945,5 +951,26 @@ @@ -945,5 +951,26 @@
// Dispose of any resources that can be recreated.
}
- (void)zhudong
{
WEAKSELF
NSLog(@"开启计时");
weakSelf.timeNumber = 0;
[GCDTimerManager.sharedInstance cancelTimerWithName:@"VIDEO"];
[GCDTimerManager.sharedInstance scheduleGCDTimerWithName:@"VIDEO" interval:1 queue:dispatch_get_main_queue() repeats:YES option:CancelPreviousTimerAction action:^{
weakSelf.timeNumber++;
if (weakSelf.timeNumber >= 30)
{
[weakSelf hangUpButton:nil];
NSLog(@"主动挂断,取消计时");
}
}];
}
- (void)quxiao
{
[GCDTimerManager.sharedInstance cancelTimerWithName:@"VIDEO"];
}
@end

9
tongxin/VC/WatchHome/DeviceInfo/Course/AddCourseViewController.m

@ -60,8 +60,10 @@ @@ -60,8 +60,10 @@
}
//比较2个时间段 结束时间需大于开始时间
self.zx_navRightBtn.enabled = NO;
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
double startTime = [df dateFromString:self.tfStartTime.text].timeIntervalSince1970;
double endTime =[df dateFromString:self.tfEndTime.text].timeIntervalSince1970;
@ -73,6 +75,7 @@ @@ -73,6 +75,7 @@
return;
}
self.zx_navRightBtn.enabled = NO;
CourseModel *model = [CourseModel courseWithName:_tfCourseName.text dayIndex:_curWeek startCourseIndex:_curLession endCourseIndex:_curLession];
NSString *time = [NSString stringWithFormat:@"%@%@",_tfStartTime.text, _tfEndTime.text];
@ -157,6 +160,8 @@ @@ -157,6 +160,8 @@
label.layer.masksToBounds = YES;
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[datePicker setLocale:locale];
datePicker.datePickerMode = UIDatePickerModeTime;
datePicker.date = [NSDate new];
@ -178,6 +183,8 @@ @@ -178,6 +183,8 @@
label.layer.masksToBounds = YES;
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[datePicker setLocale:locale];
datePicker.datePickerMode = UIDatePickerModeTime;
datePicker.date = [NSDate new];

8
tongxin/VC/WatchHome/DeviceInfo/TimingSwitchVC/TimingSwitchVC.m

@ -99,9 +99,11 @@ @@ -99,9 +99,11 @@
[view addSubview:lable];
return view;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 49;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *title = self.myDataSource[indexPath.row];
WEAKSELF
@ -139,6 +141,9 @@ @@ -139,6 +141,9 @@
}
cell.textLabel.text = title;
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
cell.textField.tintColor = [UIColor clearColor]; //使光标不可见
cell.textField.font = DefineFontSize;
@ -174,6 +179,9 @@ @@ -174,6 +179,9 @@
-(BOOL)checkTimeRuleStartTime:(NSString*)aStartTime endTime:(NSString*)aEndTime{
//比较2个时间段 开始时间需小于结束时间
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
double startTime =[df dateFromString:aStartTime].timeIntervalSince1970;
double endTime =[df dateFromString:aEndTime].timeIntervalSince1970;

9
tongxin/VC/WatchHome/DisturbBan/AddDBViewController.m

@ -69,6 +69,9 @@ @@ -69,6 +69,9 @@
//比较2个时间段 结束时间需大于开始时间
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
double startTime =[df dateFromString:self.infoDisturBan.starttime].timeIntervalSince1970;
double endTime =[df dateFromString:self.infoDisturBan.endedtime].timeIntervalSince1970;
@ -122,6 +125,9 @@ @@ -122,6 +125,9 @@
weakSelf.infoDisturBan.starttime = textStr;
//比较2个时间段 开始时间需小于结束时间
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
double startTime =[df dateFromString:weakSelf.infoDisturBan.starttime].timeIntervalSince1970;
double endTime =[df dateFromString:weakSelf.infoDisturBan.endedtime].timeIntervalSince1970;
@ -142,6 +148,9 @@ @@ -142,6 +148,9 @@
//比较2个时间段 结束时间需大于开始时间
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
double startTime =[df dateFromString:weakSelf.infoDisturBan.starttime].timeIntervalSince1970;
double endTime =[df dateFromString:weakSelf.infoDisturBan.endedtime].timeIntervalSince1970;

2
tongxin/VC/WatchHome/DisturbBan/DurationTimeTableViewCell.m

@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
textField.layer.borderWidth = 1;
textField.textAlignment = 1;
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[datePicker setLocale:locale];
if([textField isEqual:self.startTextField]){
datePicker.tag = StartTAG;
}else{

3
tongxin/VC/WatchHome/VoiceAlarm/AddVAViewController.m

@ -124,6 +124,9 @@ @@ -124,6 +124,9 @@
cell.textLabel.text = title;
if ([title isEqualToString:@"时间"]) {
NSDateFormatter * df = [[NSDateFormatter alloc]init];
NSLocale *zh_CNLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
df.locale = zh_CNLocale;
df.calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSCalendarIdentifierISO8601];
[df setDateFormat:@"HH:mm"];
[cell timeInputViewWithModel:UIDatePickerModeTime WithData:[df dateFromString:self.infoVoiceAlarm.time]];
cell.textField.text = self.infoVoiceAlarm.time;

2
tongxin/xBase/View/cell/TableCell.m

@ -149,6 +149,8 @@ @@ -149,6 +149,8 @@
self.textField.layer.borderWidth = 1;
self.textField.textAlignment = 1;
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[datePicker setLocale:locale];
datePicker.datePickerMode = mode;
// datePicker.datePickerMode = UIDatePickerModeTime;
datePicker.date = nowDate;

Loading…
Cancel
Save