-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
337 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+9.41 KB
(130%)
DanTangSwift.xcworkspace/xcuserdata/ZTX.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// | ||
// UIView+Extension.swift | ||
// DanTangSwift | ||
// | ||
// Created by 赵天旭 on 2017/7/6. | ||
// Copyright © 2017年 ZTX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension UIView { | ||
/// 裁剪 view 的圆角 | ||
func clipRectCorner(direction: UIRectCorner, cornerRadius: CGFloat) { | ||
let cornerSize = CGSize(width: cornerRadius, height: cornerRadius) | ||
let maskPath = UIBezierPath(roundedRect: bounds, byRoundingCorners: direction, cornerRadii: cornerSize) | ||
let maskLayer = CAShapeLayer() | ||
maskLayer.frame = bounds | ||
maskLayer.path = maskPath.cgPath | ||
layer.addSublayer(maskLayer) | ||
layer.mask = maskLayer | ||
} | ||
|
||
/// x | ||
var x: CGFloat { | ||
get { | ||
return frame.origin.x | ||
} | ||
set(newValue) { | ||
var tempFrame: CGRect = frame | ||
tempFrame.origin.x = newValue | ||
frame = tempFrame | ||
} | ||
} | ||
|
||
/// y | ||
var y: CGFloat { | ||
get { | ||
return frame.origin.y | ||
} | ||
set(newValue) { | ||
var tempFrame: CGRect = frame | ||
tempFrame.origin.y = newValue | ||
frame = tempFrame | ||
} | ||
} | ||
|
||
/// height | ||
var height: CGFloat { | ||
get { | ||
return frame.size.height | ||
} | ||
set(newValue) { | ||
var tempFrame: CGRect = frame | ||
tempFrame.size.height = newValue | ||
frame = tempFrame | ||
} | ||
} | ||
|
||
/// width | ||
var width: CGFloat { | ||
get { | ||
return frame.size.width | ||
} | ||
set(newValue) { | ||
var tempFrame: CGRect = frame | ||
tempFrame.size.width = newValue | ||
frame = tempFrame | ||
} | ||
} | ||
|
||
/// size | ||
var size: CGSize { | ||
get { | ||
return frame.size | ||
} | ||
set(newValue) { | ||
var tempFrame: CGRect = frame | ||
tempFrame.size = newValue | ||
frame = tempFrame | ||
} | ||
} | ||
|
||
/// centerX | ||
var centerX: CGFloat { | ||
get { | ||
return center.x | ||
} | ||
set(newValue) { | ||
var tempCenter: CGPoint = center | ||
tempCenter.x = newValue | ||
center = tempCenter | ||
} | ||
} | ||
|
||
/// centerY | ||
var centerY: CGFloat { | ||
get { | ||
return center.y | ||
} | ||
set(newValue) { | ||
var tempCenter: CGPoint = center | ||
tempCenter.y = newValue | ||
center = tempCenter; | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// TXHomeTopModel.swift | ||
// DanTangSwift | ||
// | ||
// Created by 赵天旭 on 2017/7/6. | ||
// Copyright © 2017年 ZTX. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class TXHomeTopModel: NSObject { | ||
var editable: Bool? | ||
var id: Int? | ||
var name: String? | ||
|
||
init(dict: [String: AnyObject]) { | ||
id = dict["id"] as? Int | ||
name = dict["name"] as? String | ||
editable = dict["editable"] as? Bool | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.