chenzeyu / CZPicker

a picker view shown as a popup for iOS in Objective-C
MIT License
526 stars 90 forks source link

Animation Style & Dynamic Height #62

Open cesarmtz93 opened 5 years ago

cesarmtz93 commented 5 years ago

Is it posible to change the transition animation style (e.g. bounceUp, bounceDown, zoomIn, fadeIn)??

cesarmtz93 commented 5 years ago

I'm having issues with the height of the picker while using it with different data

any suggestions on how to solve it?

error

this is my initiation method an it gets called on every click

    func showPicker(multiple: Bool? = false) {
        let picker = CZPickerView(headerTitle: LocalizableConstants.LocalizableFieldSelect.string, cancelButtonTitle: LocalizableConstants.LocalizableTitleCancel.string, confirmButtonTitle: LocalizableConstants.LocalizableTitleConfirm.string)

        picker?.delegate = self
        picker?.dataSource = self
        picker?.headerTitleColor = AppColor.DarkText.color
        picker?.headerBackgroundColor = AppColor.Cyan.color
        picker?.confirmButtonNormalColor = AppColor.DarkText.color
        picker?.confirmButtonBackgroundColor = UIColor(red: 236, green: 240, blue: 241)
        picker?.cancelButtonNormalColor = AppColor.DarkText.color
        picker?.checkmarkColor = AppColor.Cyan.color

        if multiple! {
            picker?.allowMultipleSelection = true
            picker?.needFooterView = true
        }

        picker?.show()
    }

    func numberOfRows(in pickerView: CZPickerView!) -> Int {
        switch currentInputIndex {
        case 0: return productCatalogs.sizes.count
        case 1: return productCatalogs.conditions.count
        case 2: return productCatalogs.styles.count
        case 3: return productCatalogs.materials.count
        case 4: return productCatalogs.colors.count
        case 5: return productCatalogs.sleeveLengths.count
        case 6: return productCatalogs.sleeveStyles.count
        case 7: return productCatalogs.decorations.count
        case 8: return productCatalogs.lengths.count
        default: return 0
        }
    }
cesarmtz93 commented 5 years ago

@chenzeyu

chenzeyu commented 5 years ago

@cesarmtz93 first question, we currently the animation style is fixed.

For the height issue, I don't see any problem, I guess is that maybe your currentInputIndex isn't returning the right value?

cesarmtz93 commented 5 years ago

@chenzeyu the currentInputIndex is indeed returning the right value because it's loading the correct data into the picker, but the height isn't adjusting based on the amount of data, it might be a problem with cache or something like that?