我在许多网站上看到在页面加载时显示空白方块图标,然后在页面正确加载后,显示实际图标。
所以我想知道如何让图标像那样工作?
我尝试以.woff格式创建一个简单的箭头图标,然后使用css加载:
.my-icon {
font-family: 'my-custom-icon';
content: 'A';
}
箭头显示正确。但是,在页面加载时,它仍显示为A
字符
由于
答案 0 :(得分:0)
您可以在实际图标后面使用背景或制作图层。尝试使用import UIKit
class MySecondCell:UITableViewCell,UITextFieldDelegate
{
@IBOutlet weak var budgetTitle: UITextField!
@IBOutlet weak var budgetAmount: UITextField!
}
class secondViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
var textfield: UITextField!
var SecondBudgetName = [String]()
@IBOutlet weak var balanceView: UIView!
@IBOutlet weak var mytableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
mytableView.delegate = self
mytableView.dataSource = self
view.addVerticalGradientLayer(topColor: primaryColor, bottomColor: secondaryColor)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func addIncomeTapped(_ sender: Any) {
print("Add income tapped")
//Add new row
insert()
}
@IBAction func addExpenseTapped(_ sender: Any) {
print("Add expense tapped")
//Add new row
insert()
}
func insert(){
SecondBudgetName.append("\(SecondBudgetName.count + 1)")
let insertionIndexPath = IndexPath(row: SecondBudgetName.count - 1 , section: 0)
mytableView.insertRows(at: [insertionIndexPath], with: .automatic)
}
//Configure TableView
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == UITableViewCellEditingStyle.delete {
SecondBudgetName.remove(at: indexPath.row)
tableView.beginUpdates()
tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
tableView.endUpdates()
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return SecondBudgetName.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = mytableView.dequeueReusableCell(withIdentifier: "budgetCell") as! MySecondCell
return cell
}
}
z-index: -1