-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: BBToolTip Action 처리 및 마이그레이션 작업 해요 (#693)
* feat: BBBaseToolTipView, BBThumbnailToolTipView 추가 - BBAnimatable 로직 수정 - BBToolTipType xPosition, yPosition 분리 - BBToolTipAction Nested Type 추가 * feat: BBTextToolTipView, BBThumbnailToolTipView 모듈 분리 - BBBaseToolTIpView 내부 drawable Method 추가 - BBToolTip Class 추가 - BBDrawable protocol, extension 제거 * fix: BBToolTip createToolTip Method parameter completionHandler 추가 * feat: BBToolTip 관련 에러처리 로직 수정 - ToolTip 관련 주석 추가 * feat: BBToolTipConfiguration maxWidth, maxHeight Properties 추가 - BBToolTip Layout을 frame 기반으로 로직 수정 * feat: BBTextToolTipView, BBThumbnailToolTipView Width, height 동적으로 정의하기 위해 intrinsicContentSize 재정의 - BBTooltip contentView ContentView intrinsicContentSize 기반으로 로직 수정 - BBToolTipConfiguration maxWidth, maxHeight Properties 제거 * fix: BBDrawable Protocol 제거 - BBToolTip property, Intializer 수정 * fix: MemoriesCalendarPageTitleView 기존 TooltipView 로직 수정 - BBTextToolTipView TouchControl 클릭시 Tooltip 사라지는 애니메이션 로직 제거 * fix: BBAnimatable, BBTextToolTipView, BBThumbnailToolTipView, BBToolTIpView 코드리뷰 반영 - ManagementTableHeaderView ToolTipView 추가
- Loading branch information
1 parent
6c4b282
commit 4c8e7e1
Showing
11 changed files
with
428 additions
and
218 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
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
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
77 changes: 77 additions & 0 deletions
77
14th-team5-iOS/Core/Sources/Bibbi/BBCommons/BBToolTip/BBTextToolTipView.swift
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,77 @@ | ||
// | ||
// BBTextToolTipView.swift | ||
// Core | ||
// | ||
// Created by 김도현 on 10/27/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
import Then | ||
|
||
|
||
public class BBTextToolTipView: BBBaseToolTipView { | ||
// MARK: - Properties | ||
private var contentLabel: BBLabel = BBLabel() | ||
|
||
// MARK: - Intializer | ||
public override var intrinsicContentSize: CGSize { | ||
let contentWidth = contentLabel.intrinsicContentSize.width + 32 | ||
let contentHeight = contentLabel.intrinsicContentSize.height + toolTipType.configure.arrowHeight + 20 | ||
return CGSize(width: contentWidth, height: contentHeight) | ||
} | ||
|
||
|
||
public override init(toolTipType: BBToolTipType) { | ||
super.init(toolTipType: toolTipType) | ||
setupToolTipUI() | ||
setupToolTipContent() | ||
setupAutoLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: - Configure | ||
private func setupToolTipUI() { | ||
addSubview(contentLabel) | ||
} | ||
|
||
private func setupToolTipContent() { | ||
contentLabel.do { | ||
$0.text = toolTipType.configure.contentText | ||
$0.fontStyle = toolTipType.configure.font | ||
$0.textAlignment = .center | ||
$0.numberOfLines = 0 | ||
$0.textColor = toolTipType.configure.foregroundColor | ||
$0.sizeToFit() | ||
} | ||
|
||
self.do { | ||
$0.backgroundColor = .clear | ||
} | ||
} | ||
|
||
private func setupAutoLayout() { | ||
let position = toolTipType.configure.yPosition | ||
let arrowHeight: CGFloat = toolTipType.configure.arrowHeight | ||
let textPadding: CGFloat = 10 | ||
|
||
switch position { | ||
case .bottom: | ||
contentLabel.snp.makeConstraints { | ||
$0.horizontalEdges.equalToSuperview().inset(16) | ||
$0.bottom.equalToSuperview().inset((arrowHeight + textPadding)) | ||
$0.top.equalToSuperview().inset(textPadding) | ||
} | ||
case .top: | ||
contentLabel.snp.makeConstraints { | ||
$0.horizontalEdges.equalToSuperview().inset(16) | ||
$0.top.equalToSuperview().inset((arrowHeight + textPadding)) | ||
$0.bottom.equalToSuperview().inset(textPadding) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.