How can I hide those 2 lines on the selected row?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
This code works fine for iOS 10 with swift 3
Just add this code in your view controller class.
You can also make an extension to UIPickerView:
And then just call
myPickerView.hideSelectionIndicator()
for each PickerView you want to alter.Swift 3 Version (Working):
Based on the other answers, I decided to enumerate the subviews and saw that the lines have a height of
0.5
so my solution now looks like this in Swift:And in Objective-C
Obviously not particularly future proof, but probably more so than hiding a subview at a given index.
Edit: Updated to handle the case provided by @Loris
Swift 4.2
Paste both lines of code into either your titleForRow or viewForRow delegate method of the pickerView.
And you should be good to go.