UIBUTTON and picker view

前端 未结 3 1206
一整个雨季
一整个雨季 2021-01-20 17:28

I want to display a picker when the user clicks on a button I subclassed the UIButton and changed its inputview so that it is writable.

I followed this link http://

3条回答
  •  遥遥无期
    2021-01-20 18:03

    The inputView property is only the part of UITextField and UITextView not UIButton.

       @property (readwrite, retain) UIView *inputView;
    

    Although you could achieve the same using UIButton.

    Create an UIButton object then set an action method and add your picker view in parent view of your button in the action method of UIButton.

    Should be something like that.

    -(void) buttonClicked:(id) sender
    {
        [self.view addSubview:myPickerView];
    }
    

提交回复
热议问题