Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Opple-iOS
Commits
18c31cf2
Commit
18c31cf2
authored
Sep 02, 2016
by
曹云霄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新计算网络图片SIze算法
parent
3894a2ff
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
99 deletions
+24
-99
OrderdetailsViewController.m
Lighting/Class/OrderdetailsViewController.m
+1
-0
ProductDetailsViewController.m
Lighting/Class/ProductDetailsViewController.m
+17
-93
RebateViewController.m
Lighting/Class/RebateViewController.m
+3
-3
PrefixHeader.pch
Lighting/Tools/PrefixHeader.pch
+3
-3
No files found.
Lighting/Class/OrderdetailsViewController.m
View file @
18c31cf2
...
...
@@ -517,6 +517,7 @@
ShareGoodsViewController
*
shareController
=
[[
ShareGoodsViewController
alloc
]
init
];
shareController
.
isShareOrderbill
=
YES
;
shareController
.
orderBillNumber
=
self
.
orderCode
;
shareController
.
shareImage
=
[
UIImage
imageNamed
:
@"aboutus"
];
shareController
.
preferredContentSize
=
CGSizeMake
(
290
,
120
);
shareController
.
modalPresentationStyle
=
UIModalPresentationPopover
;
UIPopoverPresentationController
*
popover
=
shareController
.
popoverPresentationController
;
...
...
Lighting/Class/ProductDetailsViewController.m
View file @
18c31cf2
...
...
@@ -158,8 +158,20 @@
self
.
headerView
.
goodsBrotherScrollview
.
userInteractionEnabled
=
YES
;
//图文大图
self
.
goodsDetailsArray
=
[
NSMutableArray
arrayWithArray
:[
self
.
entity
.
detailedIntro
componentsSeparatedByString
:
@","
]];
[
self
.
productDetilsTableview
reloadData
];
self
.
goodsDetailsArray
=
[
NSMutableArray
array
];
WS
(
weakSelf
);
NSArray
*
imagesArray
=
[
self
.
entity
.
detailedIntro
componentsSeparatedByString
:
@","
];
//加载图片计算大小
[
imagesArray
enumerateObjectsUsingBlock
:
^
(
id
_Nonnull
obj
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
[[
SDWebImageManager
sharedManager
]
downloadImageWithURL
:[
NSURL
URLWithString
:
obj
]
options
:
SDWebImageProgressiveDownload
progress
:
nil
completed
:^
(
UIImage
*
image
,
NSError
*
error
,
SDImageCacheType
cacheType
,
BOOL
finished
,
NSURL
*
imageURL
)
{
NSDictionary
*
dict
=
@{
@"image"
:
obj
,
@"height"
:
@
(
image
.
size
.
height
)};
[
weakSelf
.
goodsDetailsArray
addObject
:
dict
];
if
(
weakSelf
.
goodsDetailsArray
.
count
==
imagesArray
.
count
)
{
[
weakSelf
.
productDetilsTableview
reloadData
];
}
}];
}];
}
#pragma mark -小图点击手势、切换图片显示
...
...
@@ -169,8 +181,6 @@
[
self
.
headerView
.
goodsImageview
sd_setImageWithURL
:[
self
.
imagesArray
objectAtIndex_opple
:
tap
.
view
.
tag
-
100
]
placeholderImage
:
REPLACEIMAGE
];
}
#pragma mark -图片放大点击
-
(
void
)
amplificationButtonClick
{
...
...
@@ -194,7 +204,7 @@
}
else
if
(
indexPath
.
section
==
1
)
{
goodsDetailsTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"goodsdetailscell"
forIndexPath
:
indexPath
];
[
cell
.
detailsImageView
sd_setImageWithURL
:[
NSURL
URLWithString
:[
self
.
goodsDetailsArray
objectAtIndex_opple
:
indexPath
.
row
]]
placeholderImage
:
TCImage
(
@"bg-big"
)];
[
cell
.
detailsImageView
sd_setImageWithURL
:[
NSURL
URLWithString
:[
self
.
goodsDetailsArray
objectAtIndex_opple
:
indexPath
.
row
]
[
@"image"
]
]
placeholderImage
:
TCImage
(
@"bg-big"
)];
return
cell
;
}
...
...
@@ -217,94 +227,8 @@
return
170
;
}
NSURL
*
url
=
[
NSURL
URLWithString
:[
self
.
goodsDetailsArray
objectAtIndex_opple
:
indexPath
.
row
]];
return
[
ProductDetailsViewController
getImageSizeWithURL
:
url
].
height
;
}
#pragma mark -计算图片高度
+
(
CGSize
)
getImageSizeWithURL
:
(
id
)
imageURL
{
NSURL
*
URL
=
nil
;
if
([
imageURL
isKindOfClass
:[
NSURL
class
]]){
URL
=
imageURL
;
}
if
([
imageURL
isKindOfClass
:[
NSString
class
]]){
URL
=
[
NSURL
URLWithString
:
imageURL
];
}
if
(
URL
==
nil
)
return
CGSizeZero
;
// url不正确返回CGSizeZero
NSMutableURLRequest
*
request
=
[[
NSMutableURLRequest
alloc
]
initWithURL
:
URL
];
NSString
*
pathExtendsion
=
[
URL
.
pathExtension
lowercaseString
];
CGSize
size
=
CGSizeZero
;
if
([
pathExtendsion
isEqualToString
:
@"jpg"
]){
size
=
[
self
getJPGImageSizeWithRequest
:
request
];
}
if
(
CGSizeEqualToSize
(
CGSizeZero
,
size
))
// 如果获取文件头信息失败,发送异步请求请求原图
{
NSData
*
data
=
[
NSURLConnection
sendSynchronousRequest
:[
NSURLRequest
requestWithURL
:
URL
]
returningResponse
:
nil
error
:
nil
];
UIImage
*
image
=
[
UIImage
imageWithData
:
data
];
if
(
image
)
{
size
=
image
.
size
;
}
}
return
size
;
}
+
(
CGSize
)
getJPGImageSizeWithRequest
:
(
NSMutableURLRequest
*
)
request
{
[
request
setValue
:
@"bytes=0-209"
forHTTPHeaderField
:
@"Range"
];
NSData
*
data
=
[
NSURLConnection
sendSynchronousRequest
:
request
returningResponse
:
nil
error
:
nil
];
if
([
data
length
]
<=
0x58
)
{
return
CGSizeZero
;
}
if
([
data
length
]
<
210
)
{
// 肯定只有一个DQT字段
short
w1
=
0
,
w2
=
0
;
[
data
getBytes
:
&
w1
range
:
NSMakeRange
(
0x60
,
0x1
)];
[
data
getBytes
:
&
w2
range
:
NSMakeRange
(
0x61
,
0x1
)];
short
w
=
(
w1
<<
8
)
+
w2
;
short
h1
=
0
,
h2
=
0
;
[
data
getBytes
:
&
h1
range
:
NSMakeRange
(
0x5e
,
0x1
)];
[
data
getBytes
:
&
h2
range
:
NSMakeRange
(
0x5f
,
0x1
)];
short
h
=
(
h1
<<
8
)
+
h2
;
return
CGSizeMake
(
w
,
h
);
}
else
{
short
word
=
0x0
;
[
data
getBytes
:
&
word
range
:
NSMakeRange
(
0x15
,
0x1
)];
if
(
word
==
0xdb
)
{
[
data
getBytes
:
&
word
range
:
NSMakeRange
(
0x5a
,
0x1
)];
if
(
word
==
0xdb
)
{
// 两个DQT字段
short
w1
=
0
,
w2
=
0
;
[
data
getBytes
:
&
w1
range
:
NSMakeRange
(
0xa5
,
0x1
)];
[
data
getBytes
:
&
w2
range
:
NSMakeRange
(
0xa6
,
0x1
)];
short
w
=
(
w1
<<
8
)
+
w2
;
short
h1
=
0
,
h2
=
0
;
[
data
getBytes
:
&
h1
range
:
NSMakeRange
(
0xa3
,
0x1
)];
[
data
getBytes
:
&
h2
range
:
NSMakeRange
(
0xa4
,
0x1
)];
short
h
=
(
h1
<<
8
)
+
h2
;
return
CGSizeMake
(
w
,
h
);
}
else
{
// 一个DQT字段
short
w1
=
0
,
w2
=
0
;
[
data
getBytes
:
&
w1
range
:
NSMakeRange
(
0x60
,
0x1
)];
[
data
getBytes
:
&
w2
range
:
NSMakeRange
(
0x61
,
0x1
)];
short
w
=
(
w1
<<
8
)
+
w2
;
short
h1
=
0
,
h2
=
0
;
[
data
getBytes
:
&
h1
range
:
NSMakeRange
(
0x5e
,
0x1
)];
[
data
getBytes
:
&
h2
range
:
NSMakeRange
(
0x5f
,
0x1
)];
short
h
=
(
h1
<<
8
)
+
h2
;
return
CGSizeMake
(
w
,
h
);
}
}
else
{
return
CGSizeZero
;
}
}
NSDictionary
*
dict
=
[
self
.
goodsDetailsArray
objectAtIndex_opple
:
indexPath
.
row
];
return
[
dict
[
@"height"
]
floatValue
];
}
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
...
...
Lighting/Class/RebateViewController.m
View file @
18c31cf2
...
...
@@ -154,9 +154,9 @@
[
weakSelf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
weakSelf
.
model
=
[[
EarningsResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
weakSelf
.
currentAmountLabel
.
text
=
[
returnValue
[
@"data"
][
@"accountTotal"
]
stringValue
];
weakSelf
.
yesterdayAmountLabel
.
text
=
[
returnValue
[
@"data"
][
@"yesterdayEarnings"
]
stringValue
];
weakSelf
.
historyAmountLabel
.
text
=
[
returnValue
[
@"data"
][
@"historyEarning"
]
stringValue
];
weakSelf
.
currentAmountLabel
.
text
=
[
NSString
stringWithFormat
:
@"%.2f"
,[
returnValue
[
@"data"
][
@"accountTotal"
]
floatValue
]
];
weakSelf
.
yesterdayAmountLabel
.
text
=
[
NSString
stringWithFormat
:
@"%.2f"
,[
returnValue
[
@"data"
][
@"yesterdayEarnings"
]
floatValue
]
];
weakSelf
.
historyAmountLabel
.
text
=
[
NSString
stringWithFormat
:
@"%.2f"
,[
returnValue
[
@"data"
][
@"historyEarning"
]
floatValue
]
];
}
else
{
[
weakSelf
SHOWPrompttext
:
returnValue
[
@"message"
]];
...
...
Lighting/Tools/PrefixHeader.pch
View file @
18c31cf2
...
...
@@ -112,7 +112,7 @@
/**
* 服务器开发地址
*/
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
//
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
/**
* 服务器测试地址
...
...
@@ -122,8 +122,8 @@
///**
// * 服务器正式地址
// */
//
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg.opple.com/opple-web/app%@",URL]
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg.opple.com/opple-web/app%@",URL]
//
/**
* 搜索框输入通知
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment