Skip to content

Finish issue #128 #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
### Fixes
- Fix the background view origin when presenting
[#183](https://github.com/alexaubry/BulletinBoard/pull/183)
-Fix the ability to change alignment for title, description and image
[#128](https://github.com/alexisakers/BulletinBoard/pull/200)


## 🔖 v4.1.2
### Fixes
Expand Down
5 changes: 5 additions & 0 deletions Example/Swift/Bulletin/BulletinDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ enum BulletinDataSource {
static func makeIntroPage() -> FeedbackPageBLTNItem {

let page = FeedbackPageBLTNItem(title: "Welcome to\nPetBoard")

page.titleAlignment = .right
page.descriptionAlignment = .right
page.imageContentMode = .right

page.image = #imageLiteral(resourceName: "RoundedIcon")
page.imageAccessibilityLabel = "😻"
page.appearance = makeLightAppearance()
Expand Down
10 changes: 5 additions & 5 deletions Sources/InterfaceBuilder/BLTNInterfaceBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import UIKit
* Creates a standard title label.
*/

@objc(makeTitleLabelNextToCloseButton:)
open func makeTitleLabel(isNextToCloseButton: Bool) -> BLTNTitleLabelContainer {
@objc(makeTitleLabelNextToCloseButton:titleAlginment:)
open func makeTitleLabel(isNextToCloseButton: Bool, titleAlginment: NSTextAlignment) -> BLTNTitleLabelContainer {

let titleLabel = UILabel()
titleLabel.textAlignment = .center
titleLabel.textAlignment = titleAlginment
titleLabel.textColor = appearance.titleTextColor
titleLabel.accessibilityTraits.insert(.header)
titleLabel.numberOfLines = 2
Expand All @@ -45,10 +45,10 @@ import UIKit
* Creates a standard description label.
*/

@objc open func makeDescriptionLabel() -> UILabel {
@objc open func makeDescriptionLabel(descriptionAlginment: NSTextAlignment) -> UILabel {

let descriptionLabel = UILabel()
descriptionLabel.textAlignment = .center
descriptionLabel.textAlignment = descriptionAlginment
descriptionLabel.textColor = appearance.descriptionTextColor
descriptionLabel.numberOfLines = 0
descriptionLabel.font = appearance.makeDescriptionFont()
Expand Down
14 changes: 10 additions & 4 deletions Sources/Models/BLTNPageItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import UIKit

/// The title of the page.
@objc public let title: String

/// The alignments of the title and description
public var titleAlignment: NSTextAlignment = .center
public var descriptionAlignment: NSTextAlignment = .center
public var imageContentMode: UIView.ContentMode = .scaleAspectFit

/**
* An image to display below the title.
Expand Down Expand Up @@ -179,7 +184,7 @@ import UIKit

// Title
let isNextToCloseButton = isDismissable && requiresCloseButton
let titleView = interfaceBuilder.makeTitleLabel(isNextToCloseButton: isNextToCloseButton)
let titleView = interfaceBuilder.makeTitleLabel(isNextToCloseButton: isNextToCloseButton, titleAlginment: titleAlignment)
titleView.label.text = title

self.titleLabel = titleView
Expand All @@ -189,7 +194,8 @@ import UIKit
// Image View
if let image = self.image {
let imageView = UIImageView(image: image)
imageView.contentMode = .scaleAspectFit
imageView.contentMode = imageContentMode
// imageView.contentMode = .scaleAspectFit
imageView.tintColor = appearance.imageViewTintColor

if let accessibilityLabel = imageAccessibilityLabel {
Expand All @@ -206,13 +212,13 @@ import UIKit

// Description Label
if let attributedDescription = attributedDescriptionText {
let label = interfaceBuilder.makeDescriptionLabel()
let label = interfaceBuilder.makeDescriptionLabel(descriptionAlginment: descriptionAlignment)
label.attributedText = attributedDescription
contentViews.append(label)
self.descriptionLabel = label
insertComplementaryViews(makeViewsUnderDescription)
} else if let description = descriptionText {
let label = interfaceBuilder.makeDescriptionLabel()
let label = interfaceBuilder.makeDescriptionLabel(descriptionAlginment: descriptionAlignment)
label.text = description
contentViews.append(label)
self.descriptionLabel = label
Expand Down