fix: update cell separator line height in pick server scene

This commit is contained in:
CMK 2021-06-16 14:24:19 +08:00
parent e49763a966
commit 9f17d5dffd
2 changed files with 18 additions and 18 deletions

View File

@ -115,11 +115,11 @@ extension PickServerSection {
guard let proxiedThumbnail = server.proxiedThumbnail, guard let proxiedThumbnail = server.proxiedThumbnail,
let url = URL(string: proxiedThumbnail) else { let url = URL(string: proxiedThumbnail) else {
cell.thumbnailImageView.image = placeholderImage cell.thumbnailImageView.image = placeholderImage
cell.thumbnailActivityIdicator.stopAnimating() cell.thumbnailActivityIndicator.stopAnimating()
return return
} }
cell.thumbnailImageView.isHidden = false cell.thumbnailImageView.isHidden = false
cell.thumbnailActivityIdicator.startAnimating() cell.thumbnailActivityIndicator.startAnimating()
cell.thumbnailImageView.af.setImage( cell.thumbnailImageView.af.setImage(
withURL: url, withURL: url,
@ -129,7 +129,7 @@ extension PickServerSection {
completion: { [weak cell] response in completion: { [weak cell] response in
switch response.result { switch response.result {
case .success, .failure: case .success, .failure:
cell?.thumbnailActivityIdicator.stopAnimating() cell?.thumbnailActivityIndicator.stopAnimating()
} }
} }
) )

View File

@ -60,7 +60,7 @@ class PickServerCell: UITableViewCell {
return label return label
}() }()
let thumbnailActivityIdicator = UIActivityIndicatorView(style: .medium) let thumbnailActivityIndicator = UIActivityIndicatorView(style: .medium)
let thumbnailImageView: UIImageView = { let thumbnailImageView: UIImageView = {
let imageView = UIImageView() let imageView = UIImageView()
@ -99,7 +99,7 @@ class PickServerCell: UITableViewCell {
return button return button
}() }()
let seperator: UIView = { let separator: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
@ -177,7 +177,7 @@ class PickServerCell: UITableViewCell {
thumbnailImageView.isHidden = false thumbnailImageView.isHidden = false
thumbnailImageView.af.cancelImageRequest() thumbnailImageView.af.cancelImageRequest()
thumbnailActivityIdicator.stopAnimating() thumbnailActivityIndicator.stopAnimating()
disposeBag.removeAll() disposeBag.removeAll()
} }
@ -203,7 +203,7 @@ extension PickServerCell {
containerView.addSubview(domainLabel) containerView.addSubview(domainLabel)
containerView.addSubview(checkbox) containerView.addSubview(checkbox)
containerView.addSubview(descriptionLabel) containerView.addSubview(descriptionLabel)
containerView.addSubview(seperator) containerView.addSubview(separator)
containerView.addSubview(expandButton) containerView.addSubview(expandButton)
@ -231,13 +231,13 @@ extension PickServerCell {
containerView.topAnchor.constraint(equalTo: contentView.topAnchor), containerView.topAnchor.constraint(equalTo: contentView.topAnchor),
containerView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor), containerView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
contentView.readableContentGuide.trailingAnchor.constraint(equalTo: containerView.trailingAnchor), contentView.readableContentGuide.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 1), contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
// Set bottom separator // Set bottom separator
seperator.leadingAnchor.constraint(equalTo: containerView.leadingAnchor), separator.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
containerView.trailingAnchor.constraint(equalTo: seperator.trailingAnchor), containerView.trailingAnchor.constraint(equalTo: separator.trailingAnchor),
containerView.topAnchor.constraint(equalTo: seperator.topAnchor), containerView.topAnchor.constraint(equalTo: separator.topAnchor),
seperator.heightAnchor.constraint(equalToConstant: 1).priority(.defaultHigh), separator.heightAnchor.constraint(equalToConstant: 1).priority(.defaultHigh),
domainLabel.topAnchor.constraint(equalTo: containerView.layoutMarginsGuide.topAnchor), domainLabel.topAnchor.constraint(equalTo: containerView.layoutMarginsGuide.topAnchor),
domainLabel.leadingAnchor.constraint(equalTo: containerView.layoutMarginsGuide.leadingAnchor), domainLabel.leadingAnchor.constraint(equalTo: containerView.layoutMarginsGuide.leadingAnchor),
@ -272,14 +272,14 @@ extension PickServerCell {
containerView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: expandButton.bottomAnchor), containerView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: expandButton.bottomAnchor),
]) ])
thumbnailActivityIdicator.translatesAutoresizingMaskIntoConstraints = false thumbnailActivityIndicator.translatesAutoresizingMaskIntoConstraints = false
thumbnailImageView.addSubview(thumbnailActivityIdicator) thumbnailImageView.addSubview(thumbnailActivityIndicator)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
thumbnailActivityIdicator.centerXAnchor.constraint(equalTo: thumbnailImageView.centerXAnchor), thumbnailActivityIndicator.centerXAnchor.constraint(equalTo: thumbnailImageView.centerXAnchor),
thumbnailActivityIdicator.centerYAnchor.constraint(equalTo: thumbnailImageView.centerYAnchor), thumbnailActivityIndicator.centerYAnchor.constraint(equalTo: thumbnailImageView.centerYAnchor),
]) ])
thumbnailActivityIdicator.hidesWhenStopped = true thumbnailActivityIndicator.hidesWhenStopped = true
thumbnailActivityIdicator.stopAnimating() thumbnailActivityIndicator.stopAnimating()
NSLayoutConstraint.activate(collapseConstraints) NSLayoutConstraint.activate(collapseConstraints)