如何在AsyncDisplayKit ASButtonNode上设置标题?

时间:2017-01-16 18:00:09

标签: ios swift asyncdisplaykit

我可以用以下方法设置正常状态的标题:

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.titleNode.attributedText = buttonTitle

但是,这并未设置按钮禁用状态的标题。为此,我尝试添加以下内容:

buttonNode.setAttributedTitle(buttonTitle, for: .disabled)

然而,这会移除正常状态的图块。没有ASControlState.normal

如何在所有状态下将按钮的标题设置为相同?

2 个答案:

答案 0 :(得分:0)

通过为ASControlState设置一个空数组,可以为所有状态设置按钮标题:

let buttonTitle = NSAttributedString(string: "Book", attributes: attributes)
buttonNode.setAttributedTitle(buttonTitle, for: [])

答案 1 :(得分:0)

  if(item.BatchId == null)
  {
    dbEntity.Entry(item).State = System.Data.Entity.EntityState.Deleted;
    dbEntity.SaveChanges();
    dbEntity.Entry(item).State = System.Data.Entity.EntityState.Added;
  }
  else
  {
    dbEntity.Entry(item).State = System.Data.Entity.EntityState.Modified;
  }

  item.StockAvailable = lines.StockAvailable - lines.PickedStock;
  dbEntity.Entry(picklistline).State = System.Data.Entity.EntityState.Modified;      
  dbEntity.SaveChanges();

  return View();