-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from rayhannabi/release/0.6.9
Release/0.6.9
- Loading branch information
Showing
6 changed files
with
81 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// AlertMessageTextView.swift | ||
// RNAlertController | ||
// | ||
// Created by Rayhan Nabi on 5/12/19. | ||
// Copyright © 2019 Rayhan Nabi. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class AlertMessageTextView: UITextView { | ||
|
||
convenience init() { | ||
self.init(frame: .zero) | ||
translatesAutoresizingMaskIntoConstraints = false | ||
backgroundColor = .clear | ||
textAlignment = .center | ||
setEditableProperties() | ||
setLinkAttributes() | ||
} | ||
|
||
func setAttributedTextWithCenterAlignment(_ attributedText: NSAttributedString) { | ||
let mutableAttributedText = NSMutableAttributedString(attributedString: attributedText) | ||
let paragraphStyle = NSMutableParagraphStyle() | ||
paragraphStyle.alignment = .center | ||
mutableAttributedText.addAttribute(.paragraphStyle, | ||
value: paragraphStyle, | ||
range: NSRange(location: 0, length: attributedText.string.count)) | ||
self.attributedText = mutableAttributedText | ||
} | ||
|
||
private func setLinkAttributes() { | ||
let linkAttributes: [NSAttributedString.Key : Any] = [ | ||
.foregroundColor: UIColor.alertButtonTextRegular, | ||
.underlineColor: UIColor.alertButtonTextRegular, | ||
.underlineStyle: NSUnderlineStyle.single.rawValue | ||
] | ||
linkTextAttributes = linkAttributes | ||
} | ||
|
||
private func setEditableProperties() { | ||
isScrollEnabled = false | ||
isEditable = false | ||
showsHorizontalScrollIndicator = false | ||
showsVerticalScrollIndicator = false | ||
bounces = false | ||
bouncesZoom = false | ||
dataDetectorTypes = .all | ||
delaysContentTouches = false | ||
} | ||
|
||
} |
Binary file not shown.