我正在做一个 UWP 项目,我正在使用 CommandBar。在我的命令栏中,我有多个AppBarToggleButton,当我单击其中一个时,我不想AppBarToggleButton取消选择另一个。有没有办法做到这一点?
这是一个简单的代码:
<CommandBar>
<AppBarToggleButton Icon="Shuffle" Label="Shuffle" Click="AppBarButton_Click" />
<AppBarToggleButton Icon="RepeatAll" Label="Repeat" Click="AppBarButton_Click"/>
<CommandBar.Content>
<TextBlock Text="Now playing..." Margin="12,14"/>
</CommandBar.Content>
Run Code Online (Sandbox Code Playgroud)
我'试图了解一个名为"购物车"给予了终极版为例: https://github.com/reactjs/redux/tree/master/examples/shopping-cart
在这个例子中,你可以添加元素到你的项目列表,我试图实现删除项目列表的功能:
但是在reducers文件夹中有一个addedIds()函数,我添加了一个案例来删除列表的元素,但我不知道如何实现它,这里是函数:我的代码的reste工作正常我只是不知道如何从addedIds数组中删除产品ID.
const initialState = {
addedIds: [],
quantityById: {}
};
function addedIds(state = initialState.addedIds, action) {
switch (action.type) {
case ADD_TO_CART:
console.log("added ADD");
if (state.indexOf(action.productId) !== -1) {
return state
}
return [ ...state, action.productId ];
case REMOVE_TO_CART:
console.log("removed ADD");
// here is my problem
default:
return state
}
}
Run Code Online (Sandbox Code Playgroud)
我假设我需要做类似这样的事情: 这是使用redux删除项目的正确方法吗?
但我不知道怎么做
你能帮我吗 ?
我使用swift 2和UITableViews,当我按下一个单元格时会出现一个复选标记,但我不想在我的tableview中只检查一个单元格,所以其他复选标记将从我的tableview中消失.我尝试了不同的技术而没有成功.我有一个只有标签的CustomCell.
这是我的代码:
import UIKit
class MyViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
@IBOutlet weak var tableView: UITableView!
var answersList: [String] = ["One","Two","Three","Four","Five"]
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return answersList.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("MyCustomCell", forIndexPath: indexPath) as! MyCustomCell
cell.displayAnswers(answersList[indexPath.row]) // My cell is just a label
return cell …Run Code Online (Sandbox Code Playgroud) 如何在android中设计屏幕,其中用户可以通过移动滑动条来控制字体大小,如下所示:https: //i.stack.imgur.com/LmHcg.png