调节图片浏览菜单是否居中的问题
This commit is contained in:
parent
c2268c7228
commit
88b995b95a
Binary file not shown.
@ -46,8 +46,8 @@
|
||||
filePath = "SwiftProject/Project/View/CCSpatialDisplayTypeView/CCSpatialDisplayTypeView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "131"
|
||||
endingLineNumber = "131"
|
||||
startingLineNumber = "140"
|
||||
endingLineNumber = "140"
|
||||
landmarkName = "init(menuWidth:arrow:datas:configures:dissMissCallback:)"
|
||||
landmarkType = "7">
|
||||
<Locations>
|
||||
@ -664,5 +664,37 @@
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "2332D3C8-7CB7-4C2D-9D3C-D9A7D05737DE"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "SwiftProject/Project/View/CCSpatialDisplayTypeView/CCSpatialDisplayTypeView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "171"
|
||||
endingLineNumber = "171"
|
||||
landmarkName = "init(menuWidth:arrow:datas:configures:dissMissCallback:)"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "02F226A8-01C1-4FB7-8724-3FB114CBBC79"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "SwiftProject/Project/View/CCSpatialDisplayTypeView/CCSpatialDisplayTypeView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "169"
|
||||
endingLineNumber = "169"
|
||||
landmarkName = "init(menuWidth:arrow:datas:configures:dissMissCallback:)"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@ -222,9 +222,14 @@ class CCSpatialPhotoDisplayController: BaseController {
|
||||
self.navtionBar?.isHidden = false
|
||||
mTopImgView.isHidden = false
|
||||
edBtn?.isHidden = false
|
||||
menuView.isLandspaceScreen = false
|
||||
|
||||
menuView.dismiss()
|
||||
break
|
||||
case .landscapeLeft , .landscapeRight:
|
||||
isLandscape = true
|
||||
menuView.isLandspaceScreen = true
|
||||
menuView.dismiss()
|
||||
print("Landscape ...")
|
||||
navtionBar?.snp.updateConstraints { make in
|
||||
make.top.equalToSuperview().offset(-30)
|
||||
@ -245,6 +250,9 @@ class CCSpatialPhotoDisplayController: BaseController {
|
||||
default:
|
||||
print("Other")
|
||||
}
|
||||
|
||||
let pointOnScreen = navtionImgView!.convert(CGPointMake(KScreenHeight*0.5, navtionImgView!.bottom), to: KWindow)
|
||||
menuView.exUpdateArrowPointWithIsLandspace(pointOnScreen)
|
||||
}
|
||||
|
||||
|
||||
@ -361,6 +369,12 @@ class CCSpatialPhotoDisplayController: BaseController {
|
||||
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
KAppDelegate?.allowRotation = false
|
||||
self.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
let sec:TimeInterval = ZZHHelper.getSecFromUserDefaultByKey(kNowTimeToUserDefaultKey_PhotoDisplayController)
|
||||
|
||||
@ -72,7 +72,16 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
static let cellID:String = "CCSpatialDisplayTypeCellID"
|
||||
private var myFrame:CGRect! //tableview frame
|
||||
private var arrowView : UIView! = nil
|
||||
|
||||
var isLandspaceScreen = false {
|
||||
didSet{
|
||||
if isLandspaceScreen {
|
||||
self.frame = CGRect(origin: .zero, size: CGSize(width: KScrH, height: KScrW))
|
||||
}
|
||||
else{
|
||||
self.frame = UIScreen.main.bounds
|
||||
}
|
||||
}
|
||||
}
|
||||
var tableView:UITableView! = nil
|
||||
|
||||
var isShowing:Bool = false//是否为显示状态
|
||||
@ -163,6 +172,10 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
|
||||
}
|
||||
|
||||
func exUpdateArrowPointWithIsLandspace(_ point:CGPoint) {
|
||||
arrowPoint = point
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
@ -188,6 +201,8 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//MARK: - 设置UI
|
||||
func initViews() {
|
||||
self.backgroundColor = UIColor.black.withAlphaComponent(popMenuOutAlpha)
|
||||
@ -217,8 +232,8 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
tableView.bounces = false
|
||||
UIView.animate(withDuration: 0.3) {
|
||||
self.addSubview(self.tableView)
|
||||
UIView.animate(withDuration: 0.3) {[weak self] in
|
||||
self?.addSubview((self?.tableView)!)
|
||||
}
|
||||
|
||||
//展示【结束串流】和【开始串流】
|
||||
@ -238,14 +253,14 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
if arrowPoint.x <= popMenuMargin {
|
||||
arrowPoint.x = popMenuMargin
|
||||
}
|
||||
if arrowPoint.x >= KScrW - popMenuMargin{
|
||||
arrowPoint.x = KScrW - popMenuMargin
|
||||
if arrowPoint.x >= (isLandspaceScreen ? KScrH : KScrW) - popMenuMargin{
|
||||
arrowPoint.x = (isLandspaceScreen ? KScrH : KScrW) - popMenuMargin
|
||||
}
|
||||
var originalPoint = CGPoint.zero
|
||||
|
||||
//箭头中间距离左边距离
|
||||
var arrowMargin:CGFloat = popMenuMargin
|
||||
if arrowPoint.x < KScrW/2{
|
||||
if arrowPoint.x < (isLandspaceScreen ? KScrH : KScrW)/2{
|
||||
if (arrowPoint.x > myFrame.width/2) {
|
||||
arrowMargin = myFrame.width/2
|
||||
originalPoint = CGPoint(x: arrowPoint.x - myFrame.width/2, y: arrowPoint.y+arrowViewHeight)
|
||||
@ -256,9 +271,9 @@ public class CCSpatialDisplayTypeView: UIView {
|
||||
|
||||
}else{
|
||||
|
||||
if (KScrW-arrowPoint.x) < myFrame.width/2{
|
||||
arrowMargin = (myFrame.width - KScrW + arrowPoint.x )
|
||||
originalPoint = CGPoint(x: KScrW-popMenuMargin-myFrame.width, y: arrowPoint.y+arrowViewHeight)
|
||||
if ((isLandspaceScreen ? KScrH : KScrW)-arrowPoint.x) < myFrame.width/2{
|
||||
arrowMargin = (myFrame.width - (isLandspaceScreen ? KScrH : KScrW) + arrowPoint.x )
|
||||
originalPoint = CGPoint(x: (isLandspaceScreen ? KScrH : KScrW)-popMenuMargin-myFrame.width, y: arrowPoint.y+arrowViewHeight)
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user