Comments (3)
My code in tableview is following:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath)
print(indexPath.row)
let action1 = PopMenuDefaultAction(title: "Add / Remove from favorites", didSelect: {action in
let row_id = self.paragraphRowData[indexPath.row].id
print(row_id)
if self.get_favorites(id: row_id) == false {
print("Add to favorites")
self.paragraphRowData[indexPath.row].fav = true
self.favorites.append(row_id)
}
else
{
print("remove")
self.paragraphRowData[indexPath.row].fav = false
if let index = self.favorites.firstIndex(of: row_id) {
self.favorites.remove(at: index)
}
}
print(self.favorites)
self.userDefaults.set(self.favorites, forKey: "Favorites")
self.tableView.beginUpdates()
self.tableView.reloadData()
self.tableView.endUpdates()
})
let action2 = PopMenuDefaultAction(title: "Show references", didSelect: {action in
print("Paragraphs")
})
let manager = PopMenuManager.default
manager.addAction(action1)
manager.addAction(action2)
manager.present(on: self)
}
But for now I still getting the same row_id, when application is run.
My code is available on GitHub https://github.com/phracek/Katechismus_katolicke_cirkve_iOS/blob/master/KatechismusKatolickeCirkve/KatechismusKatolickeCirkve/Controllers/ParagraphTableViewController.swift#L134
from popmenu.
@phracek thanks for the details, I'll look into it
from popmenu.
Same problem :/
I still getting the same row_id in my app too..
Do you know why ?
Solution :
Store your value (row_id) in a class variable and use it everywhere..
it worked for me :)
from popmenu.
Related Issues (20)
- Need support for Attributed string
- 两个问题
- Need a option to disable a user interaction for a PopMenuDefaultAction
- Dismiss PopMenu Programmatically HOT 2
- PopMenuPresentationStyle Doesn't Do Anything
- need to add text alignment "left","center","right"
- 样式设置失效及坐标微调问题
- cornerRadius of PopMenuDefaultAction doesnt do anything
- No light/dark mode Support HOT 1
- Solid Background Colors Have Alpha Value of 0.9
- 锚定一个视图后设备旋转后需要跟随
- 可以修改背景阴影吗?菜单项颜色怎么不是我设置的颜色?
- 可以支持icon 放右边吗
- Xcode 13 compatibility issue - Haptics.swift HOT 1
- Xcode 13.0 Enum cases with associated values cannot be marked potentially unavailable with '@available' HOT 6
- Add Feature For Border Color
- Why isn't the background pure white? pure white like android? HOT 2
- How to Offset Bottom Left? HOT 1
- 2.2.0版本什么时候发布
- 目前好像还没有多选功能哎?后续会添加么?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from popmenu.