I am creating a Swift iOS app in which I have to show a Radio Buttons which accepts Horizontal and Vertical ways. I have found one library at GitHub which looks the solution of my problem but it's show only Horizontal way direction(side by side direction), I need vertical ways(i.e Display one radio button after below another radio button) . Any guidance will be appreciated. Thank you in advance.
相关问题
- 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
You can add multiple buttons with-in UIStackView, Then set the axis property of UIStackView to horizontal or vertical as per your requirement. To make the Radio button set the image of button & give title, then set the left title inset to make some space between button image & title.
For this Simple thing can't need to use any Third-party Library you can Do it by Using
UIButton
Like this.In Storyboard Drag and Drop Two
UIButton
Connect itsIBOutlet
and then Connect with Same Action Outlet to Both Button.Add images, and one more thing Button Title set with Adding Before Space Like this.
Change the Alignment from Storyboard Like this.
That's it here is Your Output:
The link you share already can make vertical buttons , in usage it describes using it inside a horizontal
UIStackView
Here is less code solution I believe!
Go to button property and set state Config property selected image for UIButton so, it will replace image when isSelected property is true.
Also Bind touchUpInside event to every buttons with "btnRadioPrressed" method.
Hope this will help you with less code.