Problem
- Our app use UIPasteControl for people taps to place pasteboard contents in UITextView.
- It worked fine at first, but recently received a lot of user feedback and the button suddenly disappeared
- This problem usually occurs when an App switches between the front and back
More Information
-
When the button disappears, we find that the child view of the UIPasteControl control which name _UISlotView has a size of zero.
-
we use UIKit and AutoLayout,limit button size (100, 36)
let config = UIPasteControl.Configuration()
config.displayMode = .labelOnly
config.cornerStyle = .fixed
config.baseForegroundColor = .white
config.baseBackgroundColor = .black
config.cornerRadius = 18
let btn = UIPasteControl(configuration: config)
pasteBtn = btn
addSubview(pasteBtn)
pasteBtn.snp.makeConstraints { make in
make.trailing.equalTo(-20)
make.bottom.equalTo(-10)
make.size.equalTo(CGSize(width: 100, height: 36))
}
UI view information
<UIPasteControl: 0x107dda810; frame = (0 0; 100 36); layer = <CALayer: 0x3010ff000>>
(lldb) po [0x107dda810 subviews]
<__NSSingleObjectArrayI 0x30152ff00>(
<_UISlotView: 0x107dea630; frame = (0 0; 100 36); userInteractionEnabled = NO; layer = <CALayer: 0x3010eb460>>
)
anyone meet before? is there a workaround?