修复冲突的ui约束条件

This commit is contained in:
ylzheng
2015-11-16 22:33:23 +08:00
parent 55b09d3ec9
commit d56b02efb3
3 changed files with 38 additions and 25 deletions
+1 -2
View File
@@ -1151,7 +1151,6 @@
<constraint firstItem="6ZB-oh-mVA" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="cxh-wo-icD"/>
<constraint firstItem="HB2-uZ-jZA" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="fTN-le-X4J"/>
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="top" secondItem="sWV-hY-NHv" secondAttribute="bottom" constant="128" id="gG2-bE-plR"/>
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" constant="0.5" id="hPv-7A-vyN"/>
<constraint firstItem="sWV-hY-NHv" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="kiF-07-yYa"/>
<constraint firstItem="0Xa-9Y-Cal" firstAttribute="centerX" secondItem="HLZ-lg-Qw6" secondAttribute="centerX" id="lJe-8h-QD7"/>
<constraint firstItem="F6i-0U-9Hk" firstAttribute="top" secondItem="6ZB-oh-mVA" secondAttribute="bottom" constant="73" id="lNZ-aW-YmE"/>
@@ -1681,7 +1680,7 @@
<image name="Like" width="32" height="32"/>
<image name="LikeEmpty" width="32" height="32"/>
<image name="Logo_Max" width="200" height="200"/>
<image name="Plus" width="25" height="25"/>
<image name="Plus" width="32" height="32"/>
<image name="Python" width="32" height="32"/>
<image name="Settings" width="25" height="25"/>
<image name="UploadCloud" width="32" height="32"/>
+20 -8
View File
@@ -179,8 +179,6 @@ struct LibrxService {
Alamofire.request(.GET, urlString, headers: headers)
.response{ (request, res, data, error) in
print(urlString)
var posts:[Post] = []
if let _ = error{
return response(posts, error: "Libr失联了,请稍候再试...")
@@ -188,7 +186,8 @@ struct LibrxService {
LocalStore.setLocalCachePosts(data!)
let json = JSON(data: data!)
if !json.isEmpty {
if json != nil {
for index in 0..<json.count {
let postData = json[index]
let post: Post = JsonPaser.parsePost(postData)
@@ -382,7 +381,7 @@ struct LibrxService {
}
static func profile(userId: Int, response: (Profile) -> ()) {
static func profile(userId: Int, response: (Profile?) -> ()) {
let urlString = baseURL + ResourcePath.User(userId: userId).description
let headers:[String: String] = buildHttpRequestHeader()
@@ -391,8 +390,17 @@ struct LibrxService {
(_,_,data,error) in
let json = JSON(data: data!)
let profile = JsonPaser.parseProfile(json)
response(profile)
if let _ = error {
response(nil)
} else {
if json != nil {
let profile = JsonPaser.parseProfile(json)
response(profile)
} else {
response(nil)
}
}
}
@@ -428,8 +436,12 @@ struct LibrxService {
if let _ = error {
response(nil)
} else {
let profile = JsonPaser.parseProfile(json)
response(profile)
if json != nil {
let profile = JsonPaser.parseProfile(json)
response(profile)
} else {
response(nil)
}
}
+17 -15
View File
@@ -91,26 +91,28 @@ class ProfileViewController: UIViewController{
LibrxService.profile(userId) { [weak self](profile) -> () in
if let selfView = self {
let avatar = NSURL(string: profile.avatar)
selfView.avatarImageView.sd_setImageWithURL(avatar, placeholderImage: UIImage(named: "default"))
selfView.nameLabel.text = profile.name
selfView.subTitleLabel.text = "简介:\(profile.email)"
selfView.followerNumLabel.text = String(profile.followersCount)
selfView.follosNumLabel.text = String(profile.followsCount)
if let loginEdUserId = LocalStore.accessUserId() {
if let thatProfile = profile {
let avatar = NSURL(string: thatProfile.avatar)
selfView.avatarImageView.sd_setImageWithURL(avatar, placeholderImage: UIImage(named: "default"))
selfView.nameLabel.text = thatProfile.name
selfView.subTitleLabel.text = "简介:\(thatProfile.email)"
selfView.followerNumLabel.text = String(thatProfile.followersCount)
selfView.follosNumLabel.text = String(thatProfile.followsCount)
if let loginEdUserId = LocalStore.accessUserId() {
if selfView.userId != loginEdUserId {
if selfView.userId != loginEdUserId {
selfView.isFollowed = profile.followed
if profile.followed {
selfView.followButton.setTitle("已关注", forState: .Normal)
} else {
selfView.followButton.setTitle("关注", forState: .Normal)
}
selfView.followButton.hidden = false
selfView.isFollowed = thatProfile.followed
if thatProfile.followed {
selfView.followButton.setTitle("已关注", forState: .Normal)
} else {
selfView.followButton.setTitle("关注", forState: .Normal)
}
selfView.followButton.hidden = false
}
}
}
}