TimOliver / TOPasscodeViewController

A modal passcode input and validation view controller for iOS
MIT License
387 stars 96 forks source link

Missing Title View Support? #19

Open aasatt opened 6 years ago

aasatt commented 6 years ago

It looks like titleView is never added to the passcodeView I tried to search for [addSubView:self.titleView] in the project and didn't come across anything.

I forked and added:

if (self.titleView.superview == nil) {
        [self addSubview:self.titleView];
 }

To the LayoutSubviews methods of passcodeView for now. (inside the if (self.titleView) {...})

Hardware / Software

Which version of the library were you using? 0.0.2 Which version of iOS are you running? 11.2 What model of iOS device were you testing on? iPhone X If using CocoaPods, which version of CocoaPods are you on? Set git url directly to this repo

Goals

What is the outcome result you want to achieve with this library? n/a

Expected Results

Setting a UIVew for passCodeController.passcodeView.titleView will have it show up above the title label

What did you expect to happen? To see the title view above the title label

Actual Results

What happened instead? (Please attach a screenshot/screen recording if possible) The title label moves down to the proper offset for the titleView height but no title view is added to the passcodeView

Steps to Reproduce

Give the passcodeView of the controller a title view:

        let controller = TOPasscodeViewController(style: .translucentDark, passcodeType: .fourDigits)
        controller.passcodeView.titleView = {
            let width = controller.passcodeView.titleLabel.bounds.width
            let i = UIImageView(frame: CGRect(x: 0, y: 0, width: width, height: width*0.2672413793))
            i.image = #imageLiteral(resourceName: {imageName})
            i.contentMode = .scaleAspectFit
            return i
        }()

Build and run. Use the UI explorer to inspect the views. See that titleView was never added to passcodeView

TimOliver commented 6 years ago

Hi @aasatt!

Ah, you might be right. I've put in all of the layout provisioning code for the title view, but I might have forgotten to put in the actual set up code.

I'll look into it when I get the chance.

Thanks for the issue!

Duanyangyu commented 6 years ago

+1

jasmit34 commented 4 years ago

Hi @TimOliver Did you get a chance to check? I have facing same issue. Hi @aasatt Do you do that titleview ?