Swift中Eureka框架MultivaluedSection不显示添加/删除图标问题咨询
Hey there! Let's troubleshoot why the add/delete/reorder icons aren't showing up in your Eureka MultivaluedSection. Here are the most common fixes to try:
1. Enable Always Editing Mode for the Section
By default, Eureka hides the delete/reorder icons unless the table view is in editing mode. To make these icons visible at all times, add the alwaysEditing property to your MultivaluedSection configuration:
+++ MultivaluedSection(multivaluedOptions: [.Reorder, .Insert, .Delete], header: "Directions", footer: "") { $0.alwaysEditing = true // Add this line $0.addButtonProvider = { section in return ButtonRow(){ $0.title = "Add New item" } } $0.multivaluedRowToInsertAt = { index in return TextRow { row in row.placeholder = "step" } } $0 <<< TextRow { row in row.placeholder = "step" } }
This forces the section to stay in editing mode, so the reorder and delete icons will be visible on each row, while the "Add New item" button remains accessible.
2. Verify Eureka Resources Are Properly Imported
The delete/reorder icons are part of Eureka's bundled assets. If these assets aren't added to your project, the icons will fail to render:
- If you're using CocoaPods: Ensure your
Podfileincludesuse_frameworks!and you've runpod installsuccessfully. Eureka's assets should be automatically included in the framework. - If you're using Swift Package Manager: Double-check that you've added Eureka as a dependency and that the package's resources are being included (SPM usually handles this automatically, but it's worth verifying).
- If you're importing manually: Make sure you've copied the
Eureka/Assets.xcassetsfolder into your project and it's included in your target's "Copy Bundle Resources" build phase.
3. Update Eureka to the Latest Version
Older versions of Eureka might have compatibility issues with newer iOS versions (e.g., iOS 14+), which could cause icon rendering problems. Update to the latest release to ensure you have all bug fixes and compatibility improvements.
4. Check Row Configuration (Less Likely, But Worth Confirming)
While TextRow should work out of the box with MultivaluedSection, ensure you haven't accidentally disabled editing for individual rows. Avoid setting row.canEdit = false on any rows in the section, as this would hide the delete/reorder icons for that specific row.
内容的提问来源于stack exchange,提问作者Pillo

