|
|
@@ -75,15 +75,15 @@
|
|
|
// return YES;
|
|
|
|
|
|
NSString *title = NSLocalizedString(@"select_val", nil);//UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? @"Select value" : @"Select value";
|
|
|
- UIActionSheet *selBool = [[UIActionSheet alloc] initWithTitle:title
|
|
|
- delegate:self
|
|
|
- cancelButtonTitle:NSLocalizedString(@"no", nil)
|
|
|
- destructiveButtonTitle:NSLocalizedString(@"clear", nil)
|
|
|
- otherButtonTitles:NSLocalizedString(@"yes", nil),
|
|
|
- nil];
|
|
|
- selBool.tag = 1;
|
|
|
- //dateDialog.actionSheetStyle = self.navigationController.navigationBar.barStyle;
|
|
|
- [selBool showInView:self.view];
|
|
|
+// UIActionSheet *selBool = [[UIActionSheet alloc] initWithTitle:title
|
|
|
+// delegate:self
|
|
|
+// cancelButtonTitle:NSLocalizedString(@"no", nil)
|
|
|
+// destructiveButtonTitle:NSLocalizedString(@"clear", nil)
|
|
|
+// otherButtonTitles:NSLocalizedString(@"yes", nil),
|
|
|
+// nil];
|
|
|
+// selBool.tag = 1;
|
|
|
+// //dateDialog.actionSheetStyle = self.navigationController.navigationBar.barStyle;
|
|
|
+// [selBool showInView:self.view];
|
|
|
self.boolBtntmp = sender;
|
|
|
|
|
|
// UIDatePicker *datePicker = [[UIDatePicker alloc] init];
|
|
|
@@ -96,6 +96,71 @@
|
|
|
// 此处编写弹出日期选择器的代码。
|
|
|
// self.textFieldtmp=textField;
|
|
|
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
+ UIAlertAction *noAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"no", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ TableCellBool *cell = (TableCellBool *)[[weakSelf.boolBtntmp superview] superview];
|
|
|
+
|
|
|
+ NSIndexPath *indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ if(indexPath==nil)
|
|
|
+ {//for ios7
|
|
|
+ cell = (TableCellBool *) weakSelf.boolBtntmp.superview.superview.superview;
|
|
|
+ indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ [weakSelf.boolBtntmp setTitle:@"No" forState:UIControlStateNormal];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:@"false" forKey:@"value"];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIAlertAction *clearAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"no", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ TableCellBool *cell = (TableCellBool *)[[weakSelf.boolBtntmp superview] superview];
|
|
|
+
|
|
|
+ NSIndexPath *indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ if(indexPath==nil)
|
|
|
+ {//for ios7
|
|
|
+ cell = (TableCellBool *) weakSelf.boolBtntmp.superview.superview.superview;
|
|
|
+ indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+ [self.boolBtntmp setTitle:@"Not set" forState:UIControlStateNormal];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:@"" forKey:@"value"];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIAlertAction *yesAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"no", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ TableCellBool *cell = (TableCellBool *)[[weakSelf.boolBtntmp superview] superview];
|
|
|
+
|
|
|
+ NSIndexPath *indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ if(indexPath==nil)
|
|
|
+ {//for ios7
|
|
|
+ cell = (TableCellBool *) weakSelf.boolBtntmp.superview.superview.superview;
|
|
|
+ indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ [weakSelf.boolBtntmp setTitle:@"Yes" forState:UIControlStateNormal];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:@"true" forKey:@"value"];
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ [alertVC addAction:noAction];
|
|
|
+ [alertVC addAction:clearAction];
|
|
|
+ [alertVC addAction:yesAction];
|
|
|
+
|
|
|
+ [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
+
|
|
|
|
|
|
}
|
|
|
- (void)viewWillAppear:(BOOL)animated
|
|
|
@@ -298,27 +363,32 @@
|
|
|
|
|
|
}
|
|
|
- (IBAction)ClearBtnOnClick:(UIButton *)sender {
|
|
|
- UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"attention", nil) message:NSLocalizedString(@"alert_title_confirm_clear", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"no", nil) otherButtonTitles:NSLocalizedString(@"yes", nil), nil];
|
|
|
- [alert show];
|
|
|
+
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"attention", nil) message:NSLocalizedString(@"alert_title_confirm_clear", nil) preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
|
-}
|
|
|
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
-{
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ UIAlertAction *noAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"no", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
|
|
|
- if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
- {
|
|
|
- [self.view endEditing:YES];
|
|
|
- _adapter=[[SearchTableAdapter alloc] init];
|
|
|
- [_adapter initfields:_function_name];
|
|
|
+ UIAlertAction *yesAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"yes", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
|
- [self.table reloadData];
|
|
|
- }
|
|
|
+ [weakSelf.view endEditing:YES];
|
|
|
+ weakSelf.adapter=[[SearchTableAdapter alloc] init];
|
|
|
+ [weakSelf.adapter initfields:weakSelf.function_name];
|
|
|
+ [weakSelf.table reloadData];
|
|
|
+
|
|
|
+ }];
|
|
|
|
|
|
+ [alertVC addAction:noAction];
|
|
|
+ [alertVC addAction:yesAction];
|
|
|
|
|
|
+ [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
- (IBAction)SearchBtnOnClick:(UIButton *)sender {
|
|
|
|
|
|
[self.textFieldtmp endEditing:true];
|
|
|
@@ -412,7 +482,7 @@
|
|
|
return YES;
|
|
|
}
|
|
|
|
|
|
-- (NSUInteger)supportedInterfaceOrientations
|
|
|
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
|
|
{
|
|
|
return UIInterfaceOrientationMaskPortrait;
|
|
|
}
|
|
|
@@ -548,9 +618,9 @@
|
|
|
}
|
|
|
|
|
|
if([weakSelf.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"from"];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"from"];
|
|
|
else
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"to"];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"to"];
|
|
|
|
|
|
|
|
|
}];
|
|
|
@@ -566,10 +636,10 @@
|
|
|
indexPath = [weakSelf.table indexPathForCell:cell];
|
|
|
}
|
|
|
|
|
|
- if([self.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"from"];
|
|
|
+ if([weakSelf.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:@"" forKey:@"from"];
|
|
|
else
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"to"];
|
|
|
+ [[weakSelf.adapter get_item:[indexPath row]] setValue:@"" forKey:@"to"];
|
|
|
}];
|
|
|
|
|
|
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"cancel",nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
@@ -595,103 +665,103 @@
|
|
|
|
|
|
return NO;
|
|
|
}
|
|
|
-- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
|
|
|
-
|
|
|
- if(actionSheet.tag==0)
|
|
|
- {
|
|
|
-
|
|
|
- if(buttonIndex==actionSheet.cancelButtonIndex)
|
|
|
- return;
|
|
|
- if(buttonIndex==actionSheet.destructiveButtonIndex)
|
|
|
- {
|
|
|
- self.textFieldtmp.text=nil;
|
|
|
- UITableViewCell *cell = (UITableViewCell *)[[self.textFieldtmp superview] superview];
|
|
|
-
|
|
|
- NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
- if(indexPath==nil)
|
|
|
- {//for ios7
|
|
|
- cell = (UITableViewCell *) self.textFieldtmp.superview.superview.superview;
|
|
|
- indexPath = [self.table indexPathForCell:cell];
|
|
|
- }
|
|
|
-
|
|
|
- if([self.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"from"];
|
|
|
- else
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"to"];
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UIDatePicker *datePicker = (UIDatePicker *)[actionSheet viewWithTag:101];
|
|
|
- NSDate *date = [datePicker date];
|
|
|
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
|
- //设定时间格式,这里可以设置成自己需要的格式
|
|
|
- [dateFormatter setDateFormat:@"MM/dd/yyyy"];
|
|
|
- //用[NSDate date]可以获取系统当前时间
|
|
|
- self.textFieldtmp.text = [dateFormatter stringFromDate:date];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // DebugLog(@"textFieldShouldBeginEditing text=%@",textField.text);
|
|
|
- UITableViewCell *cell = (UITableViewCell *)[[self.textFieldtmp superview] superview];
|
|
|
- // DebugLog(@"reuseid:%@",cell.reuseIdentifier);
|
|
|
- // // UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];
|
|
|
-
|
|
|
- NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
- if(indexPath==nil)
|
|
|
- {//for ios7
|
|
|
- cell = (UITableViewCell *) self.textFieldtmp.superview.superview.superview;
|
|
|
- indexPath = [self.table indexPathForCell:cell];
|
|
|
- }
|
|
|
- // NSMutableDictionary * field =[_adapter get_item:[indexPath row]];
|
|
|
-
|
|
|
- if([self.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"from"];
|
|
|
- else
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"to"];
|
|
|
- // DebugLog(@"textFieldShouldBeginEditing row=%ld type=%@",(long)[indexPath row], [field valueForKey:@"type"]);
|
|
|
- // if(![[field valueForKey:@"type"] isEqualToString:@"time"])
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // self.boolBtntmp = sender;
|
|
|
- TableCellBool *cell = (TableCellBool *)[[self.boolBtntmp superview] superview];
|
|
|
-
|
|
|
- NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
- if(indexPath==nil)
|
|
|
- {//for ios7
|
|
|
- cell = (TableCellBool *) self.boolBtntmp.superview.superview.superview;
|
|
|
- indexPath = [self.table indexPathForCell:cell];
|
|
|
- }
|
|
|
-
|
|
|
- if(buttonIndex==actionSheet.cancelButtonIndex)
|
|
|
- {
|
|
|
- [self.boolBtntmp setTitle:@"No" forState:UIControlStateNormal];
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"false" forKey:@"value"];
|
|
|
- }
|
|
|
- else if(buttonIndex==actionSheet.destructiveButtonIndex)
|
|
|
- {
|
|
|
- [self.boolBtntmp setTitle:@"Not set" forState:UIControlStateNormal];
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"value"];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [self.boolBtntmp setTitle:@"Yes" forState:UIControlStateNormal];
|
|
|
-
|
|
|
-// cell.anameLabel.text =@"aaa";
|
|
|
- // [self.boolBtntmp.titleLabel setText:@"yes"];
|
|
|
- // self.boolBtntmp.titleLabel.text = @"Yes";
|
|
|
- [[_adapter get_item:[indexPath row]] setValue:@"true" forKey:@"value"];
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- // TODO:
|
|
|
-}
|
|
|
+//- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
|
|
|
+//
|
|
|
+// if(actionSheet.tag==0)
|
|
|
+// {
|
|
|
+//
|
|
|
+// if(buttonIndex==actionSheet.cancelButtonIndex)
|
|
|
+// return;
|
|
|
+// if(buttonIndex==actionSheet.destructiveButtonIndex)
|
|
|
+// {
|
|
|
+// self.textFieldtmp.text=nil;
|
|
|
+// UITableViewCell *cell = (UITableViewCell *)[[self.textFieldtmp superview] superview];
|
|
|
+//
|
|
|
+// NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
+// if(indexPath==nil)
|
|
|
+// {//for ios7
|
|
|
+// cell = (UITableViewCell *) self.textFieldtmp.superview.superview.superview;
|
|
|
+// indexPath = [self.table indexPathForCell:cell];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if([self.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"from"];
|
|
|
+// else
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"to"];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// UIDatePicker *datePicker = (UIDatePicker *)[actionSheet viewWithTag:101];
|
|
|
+// NSDate *date = [datePicker date];
|
|
|
+// NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
|
+// //设定时间格式,这里可以设置成自己需要的格式
|
|
|
+// [dateFormatter setDateFormat:@"MM/dd/yyyy"];
|
|
|
+// //用[NSDate date]可以获取系统当前时间
|
|
|
+// self.textFieldtmp.text = [dateFormatter stringFromDate:date];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // DebugLog(@"textFieldShouldBeginEditing text=%@",textField.text);
|
|
|
+// UITableViewCell *cell = (UITableViewCell *)[[self.textFieldtmp superview] superview];
|
|
|
+// // DebugLog(@"reuseid:%@",cell.reuseIdentifier);
|
|
|
+// // // UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];
|
|
|
+//
|
|
|
+// NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
+// if(indexPath==nil)
|
|
|
+// {//for ios7
|
|
|
+// cell = (UITableViewCell *) self.textFieldtmp.superview.superview.superview;
|
|
|
+// indexPath = [self.table indexPathForCell:cell];
|
|
|
+// }
|
|
|
+// // NSMutableDictionary * field =[_adapter get_item:[indexPath row]];
|
|
|
+//
|
|
|
+// if([self.textFieldtmp.restorationIdentifier isEqualToString:@"edit_from"])
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"from"];
|
|
|
+// else
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:[dateFormatter stringFromDate:date] forKey:@"to"];
|
|
|
+// // DebugLog(@"textFieldShouldBeginEditing row=%ld type=%@",(long)[indexPath row], [field valueForKey:@"type"]);
|
|
|
+// // if(![[field valueForKey:@"type"] isEqualToString:@"time"])
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// // self.boolBtntmp = sender;
|
|
|
+// TableCellBool *cell = (TableCellBool *)[[self.boolBtntmp superview] superview];
|
|
|
+//
|
|
|
+// NSIndexPath *indexPath = [self.table indexPathForCell:cell];
|
|
|
+// if(indexPath==nil)
|
|
|
+// {//for ios7
|
|
|
+// cell = (TableCellBool *) self.boolBtntmp.superview.superview.superview;
|
|
|
+// indexPath = [self.table indexPathForCell:cell];
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(buttonIndex==actionSheet.cancelButtonIndex)
|
|
|
+// {
|
|
|
+// [self.boolBtntmp setTitle:@"No" forState:UIControlStateNormal];
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:@"false" forKey:@"value"];
|
|
|
+// }
|
|
|
+// else if(buttonIndex==actionSheet.destructiveButtonIndex)
|
|
|
+// {
|
|
|
+// [self.boolBtntmp setTitle:@"Not set" forState:UIControlStateNormal];
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:@"" forKey:@"value"];
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [self.boolBtntmp setTitle:@"Yes" forState:UIControlStateNormal];
|
|
|
+//
|
|
|
+//// cell.anameLabel.text =@"aaa";
|
|
|
+// // [self.boolBtntmp.titleLabel setText:@"yes"];
|
|
|
+// // self.boolBtntmp.titleLabel.text = @"Yes";
|
|
|
+// [[_adapter get_item:[indexPath row]] setValue:@"true" forKey:@"value"];
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// // TODO:
|
|
|
+//}
|
|
|
//-(void)changedDate:(id)sender{
|
|
|
//
|
|
|
// //实例化一个NSDateFormatter对象
|