Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP 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
张杰
红星美凯龙管理在线APP IOS
Commits
bd40f854
Commit
bd40f854
authored
Jan 08, 2016
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片自适应高度
parent
4d3c7d9d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
30 deletions
+107
-30
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Url.h
redstar/Classes/Macro/Url.h
+2
-2
PictureTextTableCell.h
...unction/Picture/PictureDetail/Cell/PictureTextTableCell.h
+1
-1
PictureTextTableCell.m
...unction/Picture/PictureDetail/Cell/PictureTextTableCell.m
+20
-2
PicTextModel.h
...odule/Function/Picture/PictureDetail/Model/PicTextModel.h
+5
-0
PictureStoryViewController.m
...PictureDetail/ViewController/PictureStoryViewController.m
+79
-25
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
bd40f854
No preview for this file type
redstar/Classes/Macro/Url.h
View file @
bd40f854
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
#define Url_h
#define Url_h
// url 测试环境
// url 测试环境
#define kRedStarURL @"http://218.244.151.129:7580/"
//
#define kRedStarURL @"http://218.244.151.129:7580/"
// 正式环境
// 正式环境
//
#define kRedStarURL @"http://219.235.234.225:7580/"
#define kRedStarURL @"http://219.235.234.225:7580/"
// 最新正式环境
// 最新正式环境
// #define kRedStarURL @"http://219.235.234.212:7580/"
// #define kRedStarURL @"http://219.235.234.212:7580/"
...
...
redstar/Classes/Module/Function/Picture/PictureDetail/Cell/PictureTextTableCell.h
View file @
bd40f854
...
@@ -14,5 +14,5 @@
...
@@ -14,5 +14,5 @@
//@property (nonatomic, strong) UIButton *bigImageView;
//@property (nonatomic, strong) UIButton *bigImageView;
@property
(
nonatomic
,
strong
)
UILabel
*
descriptionLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
descriptionLabel
;
@property
(
nonatomic
,
strong
)
NSLayoutConstraint
*
bigHeight
;
@end
@end
redstar/Classes/Module/Function/Picture/PictureDetail/Cell/PictureTextTableCell.m
View file @
bd40f854
...
@@ -8,7 +8,21 @@
...
@@ -8,7 +8,21 @@
#import "PictureTextTableCell.h"
#import "PictureTextTableCell.h"
@interface
PictureTextTableCell
()
@property
(
nonatomic
,
assign
)
CGFloat
bigH
;
@end
@implementation
PictureTextTableCell
@implementation
PictureTextTableCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
];
if
(
self
)
{
_bigH
=
170
;
}
return
self
;
}
-
(
UIImageView
*
)
bigImageView
-
(
UIImageView
*
)
bigImageView
{
{
if
(
!
_bigImageView
)
{
if
(
!
_bigImageView
)
{
...
@@ -38,8 +52,12 @@
...
@@ -38,8 +52,12 @@
[
self
.
contentView
addConstraint
:
titleRight
];
[
self
.
contentView
addConstraint
:
titleRight
];
// 高度
// 高度
NSLayoutConstraint
*
titleHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_bigImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
170
];
// NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:170];
[
self
.
contentView
addConstraint
:
titleHeight
];
// [self.contentView addConstraint:titleHeight];
self
.
bigHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_bigImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
_bigH
];
[
self
.
contentView
addConstraint
:
_bigHeight
];
}
}
return
_bigImageView
;
return
_bigImageView
;
}
}
...
...
redstar/Classes/Module/Function/Picture/PictureDetail/Model/PicTextModel.h
View file @
bd40f854
...
@@ -17,4 +17,9 @@
...
@@ -17,4 +17,9 @@
@property
(
nonatomic
,
copy
)
NSString
*
lastModified
;
@property
(
nonatomic
,
copy
)
NSString
*
lastModified
;
@property
(
nonatomic
,
copy
)
NSString
*
uuid
;
@property
(
nonatomic
,
copy
)
NSString
*
uuid
;
@property
(
nonatomic
,
copy
)
NSString
*
imageName
;
@property
(
nonatomic
,
copy
)
NSString
*
describeStr
;
@property
(
nonatomic
,
assign
)
BOOL
isHavePic
;
@end
@end
redstar/Classes/Module/Function/Picture/PictureDetail/ViewController/PictureStoryViewController.m
View file @
bd40f854
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#import <UIImageView+WebCache.h>
#import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h>
#import <UIButton+WebCache.h>
#import <SDWebImageDownloader.h>
#define kPictureDetailTableCell @"PictureDetailTableViewCell"
#define kPictureDetailTableCell @"PictureDetailTableViewCell"
#define kPictureTextTableCell @"PictureTextTableViewCell"
#define kPictureTextTableCell @"PictureTextTableViewCell"
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imageNameArray
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
imageNameArray
;
@end
@end
@implementation
PictureStoryViewController
@implementation
PictureStoryViewController
...
@@ -70,6 +71,11 @@
...
@@ -70,6 +71,11 @@
[
self
setupNav
];
[
self
setupNav
];
_clickNumber
=
0
;
_clickNumber
=
0
;
self
.
allCommentArray
=
[
NSMutableArray
array
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
requestPicturePraiseDetail
];
[
self
requestPicturePraiseDetail
];
}
}
...
@@ -78,7 +84,6 @@
...
@@ -78,7 +84,6 @@
-
(
void
)
requestPicturePraiseDetail
-
(
void
)
requestPicturePraiseDetail
{
{
self
.
allCommentArray
=
[
NSMutableArray
array
];
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
NSString
*
user_uuid
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_uuid"
];
...
@@ -102,20 +107,53 @@
...
@@ -102,20 +107,53 @@
}
}
for
(
NSDictionary
*
picTextDict
in
picDetail
.
attachments
)
{
for
(
NSDictionary
*
picTextDict
in
picDetail
.
attachments
)
{
PicTextModel
*
picText
=
[[
PicTextModel
alloc
]
init
];
PicTextModel
*
picText
=
[[
PicTextModel
alloc
]
init
];
[
picText
setValuesForKeysWithDictionary
:
picTextDict
];
[
picText
setValuesForKeysWithDictionary
:
picTextDict
];
[
_picTextArray
addObject
:
picText
];
[
_picTextArray
addObject
:
picText
];
NSString
*
imageUrl
=
[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
picTextDict
[
@"fileUrl"
]];
[[
SDWebImageDownloader
sharedDownloader
]
downloadImageWithURL
:[
NSURL
URLWithString
:
imageUrl
]
options
:
SDWebImageDownloaderUseNSURLCache
progress
:
nil
completed
:^
(
UIImage
*
image
,
NSData
*
data
,
NSError
*
error
,
BOOL
finished
)
{
picText
.
isHavePic
=
finished
;
NSString
*
imageName
=
nil
;
if
(
image
==
nil
)
{
imageName
=
@""
;
}
else
{
imageName
=
[
CommonFunc
md5Data
:
data
];
NSString
*
fullPath
=
[[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
]
stringByAppendingPathComponent
:[
NSString
stringWithFormat
:
@"%@"
,
imageName
]];
[
_imageNameArray
addObject
:
imageName
];
[
data
writeToFile
:
fullPath
atomically
:
NO
];
}
NSString
*
describe
=
nil
;
if
([
picTextDict
[
@"description"
]
isEqual
:[
NSNull
null
]])
{
describe
=
@""
;
}
else
{
describe
=
[
NSString
stringWithFormat
:
@"%@"
,
picTextDict
[
@"description"
]];
}
picText
.
describeStr
=
describe
;
picText
.
imageName
=
imageName
;
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
self
.
tableView
reloadData
];
});
}];
}
}
//
self
.
tableView
.
delegate
=
self
;
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
self
.
tableView
.
dataSource
=
self
;
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
}];
}];
}
}
-
(
void
)
setupNav
-
(
void
)
setupNav
{
{
UILabel
*
customLab
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
40
,
30
)];
UILabel
*
customLab
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
40
,
30
)];
...
@@ -137,9 +175,27 @@
...
@@ -137,9 +175,27 @@
-
(
void
)
doBack
:
(
id
)
sender
-
(
void
)
doBack
:
(
id
)
sender
{
{
[
self
clear
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
}
}
-
(
void
)
clear
{
dispatch_async
(
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_DEFAULT
,
0
),
^
{
NSString
*
fullPath
=
[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
];
for
(
NSString
*
p
in
_imageNameArray
)
{
NSError
*
error
;
NSString
*
path
=
[
fullPath
stringByAppendingPathComponent
:
p
];
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
path
])
{
[[
NSFileManager
defaultManager
]
removeItemAtPath
:
path
error
:
&
error
];
}
}
});
}
-
(
void
)
addZan
:
(
ZanButton
*
)
sender
-
(
void
)
addZan
:
(
ZanButton
*
)
sender
{
{
_clickNumber
++
;
_clickNumber
++
;
...
@@ -297,7 +353,6 @@
...
@@ -297,7 +353,6 @@
// cell显示的内容
// cell显示的内容
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
{
if
(
indexPath
.
section
==
0
)
{
if
(
indexPath
.
section
==
0
)
{
PictureDetailTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kPictureDetailTableCell
];
PictureDetailTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kPictureDetailTableCell
];
if
(
!
cell
)
{
if
(
!
cell
)
{
...
@@ -347,30 +402,29 @@
...
@@ -347,30 +402,29 @@
if
(
!
cell
)
{
if
(
!
cell
)
{
cell
=
[[
PictureTextTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kPictureTextTableCell
];
cell
=
[[
PictureTextTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kPictureTextTableCell
];
}
}
NSString
*
imageName
=
picText
.
imageName
;
NSString
*
fullPath
=
[[
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
)
objectAtIndex
:
0
]
stringByAppendingPathComponent
:[
NSString
stringWithFormat
:
@"%@"
,
imageName
]];
UIImage
*
image
=
[
UIImage
imageWithContentsOfFile
:
fullPath
];
if
(
image
)
{
if
(
picText
.
isHavePic
)
{
NSURL
*
imageUrl
=
[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"%@%@"
,
kRedStarURL
,
picText
.
fileUrl
]];
CGFloat
bigImageH
=
(
kScreenWidth
-
40
)
/
image
.
size
.
width
*
image
.
size
.
height
;
cell
.
bigHeight
.
constant
=
bigImageH
;
UIImage
*
defaultImage
=
[
UIImage
imageNamed
:
@"default_pic"
];
[
cell
.
bigImageView
layoutIfNeeded
];
}
[
cell
.
bigImageView
sd_setImageWithURL
:
imageUrl
placeholderImage
:
defaultImage
];
cell
.
bigImageView
.
image
=
image
;
UITapGestureRecognizer
*
tap
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapClick
:
)];
[
cell
.
bigImageView
addGestureRecognizer
:
tap
];
NSString
*
str
=
[
NSString
stringWithFormat
:
@"%@"
,
picText
.
descriptionText
];
if
(
picText
.
descriptionText
==
nil
||
picText
.
descriptionText
==
NULL
||
[
picText
.
descriptionText
isEqual
:[
NSNull
null
]])
{
cell
.
descriptionLabel
.
text
=
@""
;
}
else
{
}
else
{
cell
.
descriptionLabel
.
text
=
str
;
cell
.
bigImageView
.
image
=
[
UIImage
imageNamed
:
@"default_pic"
]
;
}
}
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
UITapGestureRecognizer
*
tap
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapClick
:
)];
[
cell
.
bigImageView
addGestureRecognizer
:
tap
];
cell
.
descriptionLabel
.
text
=
picText
.
describeStr
;
return
cell
;
return
cell
;
}
}
}
else
{
}
else
{
// 评论
// 评论
PictureCommentTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kPictureCommentTableCell
];
PictureCommentTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kPictureCommentTableCell
];
...
...
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