Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

[Fix] Invalid UITableViewCell color at CreditViewController #57

Closed
ChoiysApple opened this issue Dec 5, 2023 · 1 comment · Fixed by #59
Closed

[Fix] Invalid UITableViewCell color at CreditViewController #57

ChoiysApple opened this issue Dec 5, 2023 · 1 comment · Fixed by #59
Assignees
Labels
🐛 bug Something isn't working
Milestone

Comments

@ChoiysApple
Copy link
Owner

Describe

Background color of cells at CreditView is wrong

To Reproduce

  • Go to Credit Tab
  • Always happens

Expected behavior

Background color should be dark color as usual

Screenshots

this was image

Device: iPhone 12 mini
OS: iOS 16.1

Additional context

@ChoiysApple ChoiysApple added the 🐛 bug Something isn't working label Dec 5, 2023
@ChoiysApple ChoiysApple added this to the 0.1.1 milestone Dec 5, 2023
@ChoiysApple ChoiysApple self-assigned this Dec 5, 2023
ChoiysApple added a commit that referenced this issue Dec 12, 2023
### Describe
`CreditTableViewCell` backgroundColor & textColor changing code is not
working

### Changes Made
- Move view setting code from awakeFromNib() to custom initializer
- Create setData and setUpLayout method for better code quality

### Screenshots
**AS-IS**
<img
src="https://github.com/ChoiysApple/Filmboard/assets/43776784/2d659b22-1876-4549-bf17-09691a9b84dd"
width="25%" alt="this was image">

**TO-BE**
<img
src="https://github.com/ChoiysApple/Filmboard/assets/43776784/120df159-c92e-4749-80e5-d81c21b9388d"
width="25%" alt="this was image">

### Issues Resolved
- #57
@ChoiysApple
Copy link
Owner Author

Cause

From CreditTableViewCell, cell customizing code was like this:

    override func awakeFromNib() {
        super.awakeFromNib()
        self.backgroundColor = UIColor(named: UIColor.lightBackground)
        self.textLabel?.textColor = .white
    }

Because CreditTableViewCell is not using .xib, awakeFromNib() is not called.

Solution

Cell customizing code is now moved to initializer, not awakeFromNib

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpLayout()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setUpLayout() {
        self.backgroundColor = UIColor(named: UIColor.lightBackground)
        self.textLabel?.textColor = .white
        self.accessoryType = .disclosureIndicator
    }

ChoiysApple added a commit that referenced this issue Jan 3, 2024
End of milestone 0.1.1

### Issue Resolved
- #57 
- #58
- #63 
- #65
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working
Projects
No open projects
Status: Deployed
Development

Successfully merging a pull request may close this issue.

1 participant