Commit 1b1906b8 authored by admin's avatar admin

强制更新

parent 52a40820
......@@ -359,7 +359,7 @@
84DB9BC21BDCD4B600822CC4 /* CustomDropMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomDropMenuView.h; sourceTree = "<group>"; };
84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomDropMenuView.m; sourceTree = "<group>"; };
84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = "<group>"; };
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Extension.m"; path = "../../Other/Category/UIView+Extension.m"; sourceTree = "<group>"; };
84E0ABCB1BFB082E001C8F45 /* TaskDetailModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskDetailModel.h; sourceTree = "<group>"; };
84E0ABCC1BFB082E001C8F45 /* TaskDetailModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskDetailModel.m; sourceTree = "<group>"; };
84E363D01BFAC5200061547E /* TaskListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskListModel.h; sourceTree = "<group>"; };
......@@ -1390,7 +1390,6 @@
isa = PBXGroup;
children = (
84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */,
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */,
84C957491BDB344900083584 /* UIBarButtonItem+Create.h */,
84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */,
84C9574B1BDB344900083584 /* UIView+Frame.h */,
......@@ -1611,6 +1610,7 @@
84DB9BC11BDCD49900822CC4 /* CustomDropMenu */ = {
isa = PBXGroup;
children = (
84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */,
84DB9BC21BDCD4B600822CC4 /* CustomDropMenuView.h */,
84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */,
);
......
......@@ -174,21 +174,61 @@
NSString *imageName0 = _imageNameArray[(indexPath.row - 3) * 2];
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
//UIImage *image00 = [self cutImage:image0];
[cell.photoButton1 setImage:image0 forState:UIControlStateNormal];
UIImage *image00 = [self image:image0 scaledToSize:CGSizeMake((kScreenWidth - 3 * 20) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 3) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
//UIImage *image11 = [self cutImage:image1];
[cell.photoButton2 setImage:image1 forState:UIControlStateNormal];
UIImage *image11 = [self image:image1 scaledToSize:CGSizeMake((kScreenWidth - 3 * 20) / 2, 90)];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
}
- (UIImage *)image:(UIImage*)image scaledToSize:(CGSize)newSize
{
// Create a graphics image context
UIGraphicsBeginImageContext(newSize);
// Tell the old image to draw in this new context, with the desired
// new size
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
// Get the new image from the context
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
// End the context
UIGraphicsEndImageContext();
// Return the new image.
return newImage;
}
////裁剪图片
//- (UIImage *)cutImage:(UIImage*)image
//{
// //压缩图片
// CGSize newSize;
// CGImageRef imageRef = nil;
//
// if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
// newSize.width = image.size.width;
// newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
//
// imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
//
// } else {
// newSize.height = image.size.height;
// newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
//
// imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
//
// }
//
// return [UIImage imageWithCGImage:imageRef];
//}
#pragma mark - lazy loading
- (UITableView *)tableView
......
......@@ -189,7 +189,6 @@
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, kTaxisViewHeight);
CGRect fromFrame = CGRectMake(0, -kTaxisViewHeight, kScreenWidth, kTaxisViewHeight);
_taxisView.alpha = 0.0;
_taxisView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
......@@ -205,7 +204,6 @@
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kTaxisViewHeight, kScreenWidth, kTaxisViewHeight);
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
//_taxisView.frame = fromFrame;
......
......@@ -19,6 +19,8 @@
#import <MBProgressHUD.h>
#import "AddQuestionTableCell.h"
#define kPhotoTag 3339922
#define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil
#define QUESTIONLIST @"15分钟退单", @"便民服务", @"基础管理",@"轻松购系统",@"全员服务",@"人员信息",@"营运物流及服务硬件", nil
......@@ -108,72 +110,6 @@
alert.tag = 9211232;
[alert show];
// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:2 inSection:0];
//
// AddQuestionTableCell *cell = (AddQuestionTableCell *)[_tableView cellForRowAtIndexPath:indexPath];
//
// NSString *title = [cell titleTextView].text;
// NSString *content = [cell contentTextView].text;
//
// NSDictionary *parameters;
// if (_imageNameArray.count == 0) {
// parameters = @{@"category":_selectLabel.text,
// @"group":_selectLabel1.text,
// @"title":content,
// @"content":title
// };
// } else {
// NSMutableArray *imageArray = [NSMutableArray array];
// for (int i = 0; i < _imageNameArray.count; i++) {
// NSString *imageName = _imageNameArray[i];
// NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
// NSData *imageData = UIImageJPEGRepresentation(image, 0.5);
// NSString *imageBase64 = [imageData base64EncodedStringWithOptions:0];
// NSMutableDictionary *dict = [NSMutableDictionary dictionary];
// [dict setObject:imageBase64 forKey:@"fileContent"];
// [dict setObject:imageName forKey:@"fileName"];
// [dict setObject:@(i) forKey:@"index"];
// [imageArray addObject:dict];
// }
//
// parameters = @{@"category":_selectLabel.text,
// @"group":_selectLabel1.text,
// @"title":content,
// @"content":title,
// @"attachments":imageArray};
// }
//
// NSLog(@"par = %@", parameters);
//
//
// NSDate *date = [NSDate date];
// NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// [dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
// NSString *dateString = [dateFormatter stringFromDate:date];
//
// NSString *operId = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"];
// NSString *operName = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"];
//
//
// NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kUpLoadQuestionURL, dateString, operId, operName];
// url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
//
// HttpClient *client = [[HttpClient alloc] initWithUrl:url];
// [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// [client uploadNewQuestionWithParameters:parameters completion:^(id response, NSError *error) {
// NSLog(@"上传新问题 response= %@, error = %@", response, error);
// if (response[@"success"]) {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"新问题提报成功!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
// alert.tag = 90393;
// [alert show];
// [MBProgressHUD hideHUDForView:self.view animated:YES];
// } else {
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"新问题提报失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
// [alert show];
// }
// }];
}
// 返回上一页面
......@@ -181,7 +117,15 @@
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)showPicture:(UIButton *)sender
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
NSString *imageName = _imageNameArray[sender.tag - kPhotoTag];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
checkVC.checkImage = image;
[self.navigationController pushViewController:checkVC animated:YES];
}
- (void)addTableView
{
......@@ -470,6 +414,7 @@
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
cell.photoButton1.tag = kPhotoTag + _imageNameArray.count - 1;
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
cell.photoButton2.tag = 2201;
......@@ -509,6 +454,13 @@
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton1.tag = kPhotoTag + (indexPath.row - 3) * 2;
[cell.photoButton2 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton2.tag = kPhotoTag + (indexPath.row - 3) * 2 + 1;
return cell;
}
......
......@@ -26,6 +26,7 @@
#define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate, ScopeTableViewDelegate, GroupTableViewDelegate, CategoryTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *allQuestionArray;
......@@ -89,7 +90,8 @@
{
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
[self requestQuestionList];
}
......@@ -147,7 +149,6 @@
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
......
......@@ -11,6 +11,7 @@
@protocol InspectUpLoadFootDelegate <NSObject>
- (void)returnParentsViewController;
- (void)showPicture:(UITapGestureRecognizer *)sender;
@end
......
......@@ -9,8 +9,6 @@
#import "InspectUpLoadFootView.h"
#import <UIImageView+WebCache.h>
//#define kImageItemWidth
//#define kImageItemHeigh
@implementation InspectUpLoadFootView
......@@ -19,7 +17,6 @@
self = [super init];
if (self) {
self.backgroundColor = kSectionBackGroundColor;
NSLog(@"answerAttachments.count = %ld referenceAttachments.count = %ld", (unsigned long)answerAttachments.count , (unsigned long)referenceAttachments.count);
CGFloat imageMaginX = 20;
CGFloat imageMaginY = 10;
CGFloat imageW = (kScreenWidth - imageMaginX * 3) / 2;
......@@ -48,9 +45,12 @@
// 现场照片
for (int i = 0; i < answerAttachments.count; i++) {
UIImageView *imageView = [[UIImageView alloc] init];
imageView.userInteractionEnabled = YES;
NSDictionary *dict = (NSDictionary *)answerAttachments[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
[imageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageCilck:)];
[imageView addGestureRecognizer:tap];
int j = 0;
if ((i + 1) % 2 == 0) {
j = (i + 1) / 2;
......@@ -73,9 +73,14 @@
// 参考照片
for (int i = 0; i < referenceAttachments.count; i++) {
UIImageView *imageView = [[UIImageView alloc] init];
imageView.userInteractionEnabled = YES;
NSDictionary *dict = (NSDictionary *)referenceAttachments[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
[imageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageCilck:)];
[imageView addGestureRecognizer:tap];
int j = 0;
if ((i + 1) % 2 == 0) {
j = (i + 1) / 2;
......@@ -163,11 +168,33 @@
- (void)returnClick:(UIButton *)sender
{
if (_delegate) {
if (_delegate && [_delegate respondsToSelector:@selector(returnParentsViewController)]) {
[_delegate returnParentsViewController];
}
}
- (void)imageCilck:(UITapGestureRecognizer *)sender
{
if (_delegate && [_delegate respondsToSelector:@selector(showPicture:)]) {
[_delegate showPicture:sender];
}
}
- (UIImage *)image:(UIImage*)image scaledToSize:(CGSize)newSize
{
// Create a graphics image context
UIGraphicsBeginImageContext(newSize);
// Tell the old image to draw in this new context, with the desired
// new size
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
// Get the new image from the context
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
// End the context
UIGraphicsEndImageContext();
// Return the new image.
return newImage;
}
#pragma - lazy loading
- (UILabel *)titleLabel
{
......
......@@ -14,12 +14,16 @@
#import "CommonFunc.h"
#import "HttpClient.h"
#import "CheckPicViewController.h"
#import "InspectTaskViewController.h"
#import "InspectAddCell.h"
#import "InspectPicAddCell.h"
#import "InpectPictureCell.h"
#define kPhotoTag 2221113
#define kInspectNotUploadCell @"InspectNotUploadCell"
@interface InspectNotUploadViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate , UIScrollViewDelegate, UIAlertViewDelegate, UITextViewDelegate>
......@@ -89,6 +93,16 @@
[self.navigationController popViewControllerAnimated:YES];
}
- (void)showPicture:(UIButton *)sender
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
NSString *imageName = _imageNameArray[sender.tag - kPhotoTag];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
checkVC.checkImage = image;
[self.navigationController pushViewController:checkVC animated:YES];
}
- (void)createImagePicker:(UIButton *)sender
{
......@@ -178,13 +192,14 @@
cell = [[InspectPicAddCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSLog(@"imageName = %@", imageName);
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
NSLog(@"image = %@fullPath = %@", image, fullPath);
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton1.tag = kPhotoTag + _imageNameArray.count - 1;
cell.photoButton2.tag = 2201;
[cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
......@@ -215,17 +230,22 @@
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
UIImage *image00 = [self cutImage:image0];
// UIImage *image00 = [self getSubImage:image0 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1];
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
// UIImage *image11 = [self getSubImage:image1 mCGRect:CGRectMake(0, 0, (kScreenWidth - 20 * 3) / 2, 90) centerBool:YES];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton1.tag = kPhotoTag + (indexPath.row - 1) * 2;
[cell.photoButton2 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
cell.photoButton2.tag = kPhotoTag + (indexPath.row - 1) * 2 + 1;
return cell;
}
}
......@@ -254,65 +274,6 @@
return [UIImage imageWithCGImage:imageRef];
}
- (UIImage*)getSubImage:(UIImage *)image mCGRect:(CGRect)mCGRect centerBool:(BOOL)centerBool
{
/*如若centerBool为Yes则是由中心点取mCGRect范围的图片*/
float imgwidth = image.size.width;
float imgheight = image.size.height;
float viewwidth = mCGRect.size.width;
float viewheight = mCGRect.size.height;
CGRect rect;
if(centerBool)
rect = CGRectMake((imgwidth-viewwidth)/2, (imgheight-viewheight)/2, viewwidth, viewheight);
else{
if (viewheight < viewwidth) {
if (imgwidth <= imgheight) {
rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth);
}else {
float width = viewwidth*imgheight/viewheight;
float x = (imgwidth - width)/2 ;
if (x > 0) {
rect = CGRectMake(x, 0, width, imgheight);
}else {
rect = CGRectMake(0, 0, imgwidth, imgwidth*viewheight/viewwidth);
}
}
}else {
if (imgwidth <= imgheight) {
float height = viewheight*imgwidth/viewwidth;
if (height < imgheight) {
rect = CGRectMake(0, 0, imgwidth, height);
}else {
rect = CGRectMake(0, 0, viewwidth*imgheight/viewheight, imgheight);
}
}else {
float width = viewwidth*imgheight/viewheight;
if (width < imgwidth) {
float x = (imgwidth - width)/2 ;
rect = CGRectMake(x, 0, width, imgheight);
}else {
rect = CGRectMake(0, 0, imgwidth, imgheight);
}
}
}
}
CGImageRef subImageRef = CGImageCreateWithImageInRect(image.CGImage, rect);
CGRect smallBounds = CGRectMake(0, 0, CGImageGetWidth(subImageRef), CGImageGetHeight(subImageRef));
UIGraphicsBeginImageContext(smallBounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, smallBounds, subImageRef);
UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
UIGraphicsEndImageContext();
return smallImage;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
......
......@@ -9,6 +9,7 @@
#import "InspectUploadedViewController.h"
#import "InspectNotUpLoadCell.h"
#import "InspectUpLoadFootView.h"
#import "CheckPicViewController.h"
#define kInspectnotLoadTableViewCell @"InspectnotLoadTableViewCell"
#define kInspectReferencePicCell @"InspectReferencePiccell"
......@@ -59,6 +60,8 @@
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - TableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
......@@ -110,6 +113,16 @@
[self.navigationController popViewControllerAnimated:YES];
}
- (void)showPicture:(UITapGestureRecognizer *)sender
{
// 获取到点击的显示图片的按钮
UIImageView *imageView = (UIImageView *)sender.view;
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
#pragma mark - lazy loading
- (UITableView *)tableView
......
......@@ -77,10 +77,6 @@
self.navigationController.navigationBar.translucent = NO;
}
// 初始化数组
// self.taskListDataArray = [NSMutableArray array];
[self requestInspectList];
[[NSNotificationCenter defaultCenter] addObserver:self
......@@ -100,9 +96,9 @@
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}
- (void)viewWillDisappear:(BOOL)animated
......
......@@ -79,12 +79,12 @@
NSString *newVersion = [NSString stringWithFormat:@"%@", dict[@"version"]];
self.jumpURL = [NSString stringWithFormat:@"%@", dict[@"url"]];
NSLog(@"newVersion = %@, _jumpURL = %@", newVersion, _jumpURL);
[self checkAppUpdate:newVersion];
[self checkAppUpdate:newVersion forceUpdate:[NSString stringWithFormat:@"%@", dict[@"forceUpdate"]]];
}
}];
}
- (void)checkAppUpdate:(NSString *)newVersion
- (void)checkAppUpdate:(NSString *)newVersion forceUpdate:(NSString *)forceUpdate
{
// 获取当前版本
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
......@@ -92,18 +92,33 @@
NSLog(@"当前版本是:%@", currentVersion);
if (![currentVersion isEqualToString:newVersion]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示!" message:[NSString stringWithFormat:@"发现新版本:%@", newVersion] delegate:self cancelButtonTitle:@"稍后再说" otherButtonTitles:@"前往更新", nil];
alert.delegate = self;
[alert show];
alert.tag = 3058284;
if ([forceUpdate isEqualToString:@"1"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示!" message:[NSString stringWithFormat:@"发现新版本:%@,如果不更新,可能造成本应用无法使用!", newVersion] delegate:self cancelButtonTitle:nil otherButtonTitles:@"前往更新", nil];
alert.delegate = self;
alert.tag = 322234;
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示!" message:[NSString stringWithFormat:@"发现新版本:%@", newVersion] delegate:self cancelButtonTitle:@"稍后再说" otherButtonTitles:@"前往更新", nil];
alert.delegate = self;
[alert show];
alert.tag = 3058284;
}
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1 && alertView.tag == 3058284) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
if (alertView.tag == 3058284) {
if (buttonIndex == 1) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
} else if (alertView.tag == 322234){
if (buttonIndex == 0) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment