Skip to content

Settings: tableview section separator #91

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

Closed
wants to merge 4 commits into from

Conversation

mkchoi212
Copy link
Collaborator

Checklist

  • I've run bundle exec fastlane test from the root directory to see all new and existing tests pass
  • I've followed the vlc-ios code style and run bundle exec fastlane lint to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Description

Added a separator in-between tableview sections.

@mkchoi212 mkchoi212 force-pushed the settings-header branch 2 times, most recently from 92876a9 to c9a6d67 Compare July 11, 2018 03:09
public let tableHeader: UIFont

public init(tableHeader: UIFont) {
self.tableHeader = tableHeader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why we would want this class to be public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I guess it's unnecessary

@objc static let identifier = String(describing: VLCSettingsTableHeaderView.self)
@objc var headerLabel: UILabel!
@objc var separator: UIView!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about initializing them directly here?
For example:


    @objc var separator: UIView = {
        let separator = UIView()
        separator.backgroundColor = PresentationTheme.current.colors.separatorColor
        separator.translatesAutoresizingMaskIntoConstraints = false
        return separator
    }()

This will make the init clearer by only having the addSubView() calls and the constraints stuff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I always forget you can do this :D

override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)

constraints.forEach { $0.priority = UILayoutPriority(rawValue: 999) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better if we use .required - 1 here.

import UIKit

class VLCSettingsTableHeaderView: UITableViewHeaderFooterView {
let headerHeight: CGFloat = 1.0
Copy link
Contributor

@Mikanbu Mikanbu Jul 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to expose this outside of this class? If not we should consider "privatizing" it 😄

@mkchoi212 mkchoi212 force-pushed the settings-header branch 2 times, most recently from 81024f3 to 38008ad Compare July 16, 2018 00:24

let tableHeader: UIFont

init(tableHeader: UIFont) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tableHeaderFont

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return nil;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be deleted it will fall back to viewForHeaderInSection

Copy link
Collaborator Author

@mkchoi212 mkchoi212 Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm without it, the header titles come out capitalized. I think this is because InAppSettings has a default titleForHeaderInSection


import UIKit

class VLCSettingsTableHeaderView: UITableViewHeaderFooterView {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adjust this to the new class VLCSectionTableHeaderView?

@carolanitz
Copy link
Member

merged with 7ea7027 and following

@carolanitz carolanitz closed this Jul 24, 2018
@mkchoi212 mkchoi212 deleted the settings-header branch July 25, 2018 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants