func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 0 {
return nil
} else if settings[section - 1].isEmpty == false {
let headerView = Bundle.main.loadNibNamed("HeaderTableViewCell", owner: self, options: nil)?.first as! HeaderTableViewCell
let settingCategories = ["Account", "Notifications", "Personalized Feed", "Color Theme"]
headerView.settingCategoryTitle.text = settingCategories[section - 1]
let totalCellHeight = CGFloat(settings[section - 1].count * 63)
let height = headerView.frame.height + totalCellHeight
print("Needed Height: \(height)")
headerView.clipsToBounds = false
headerView.headerBackground.frame.size.height = height
print("HeaderView Height: \(headerView.headerBackground.frame.size.height)")
headerView.headerBackground.layer.shadowRadius = 10
headerView.headerBackground.layer.shadowOffset = CGSize(width: 0, height: 1)
headerView.headerBackground.layer.shadowColor = UIColor.black.cgColor
headerView.headerBackground.layer.shadowOpacity = 0.1
headerView.headerBackground.backgroundColor = UIColor(named: "Background")
headerView.headerBackground.layer.cornerRadius = 10
headerView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDropDown)))
return headerView
} else {
return nil
}
}
@objc func handleDropDown() {
print("Handle Drop Down")
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == 0 {
return 0.0001
} else {
return 54
}
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 0 {
return 10
} else {
return 20
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return settings.count + 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return 1
} else {
return settings[section - 1].count
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingTitleCell", for: indexPath) as! SettingsTitleTableViewCell
cell.titleLabel.text = "Settings"
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingCell", for: indexPath) as! SettingTableViewCell
cell.setSetting(setting: settings[indexPath.section - 1][indexPath.row])
print("Index Path: \(indexPath.row) SettingCount: \(settings[indexPath.section - 1].count)")
return cell
}
}
我做对了吗?我需要在那里导入那些链接,但是我不知道该怎么做 错误: Angular Live Development Server正在localhost:4200上侦听,请在http://localhost:4200/ **上打开浏览器 92%的其他资产处理脚本-webpack-pluginד wdm”:错误:ENOENT:无此类文件或目录,打开'C:\ ms-front-web @ import http:\ cdnjs.cloudflare.com \ ajax \ libs \ jquery.form \ 3.32 \ jquery.form.js'
答案 0 :(得分:0)
似乎不允许在脚本中添加CDN网址,而应该将CDN中的js / css文件包含在index.html中。
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.32/jquery.form.js" />
一些链接供您参考以及如何使用。 Angular include CDN in component usage https://github.com/angular/angular-cli/issues/2280 https://github.com/angular/angular-cli/issues/6887
我建议使用npm将软件包安装为模块,并将其包含在脚本中。
示例:
npm install bootstrap --save-dev
npm install jquery --save-dev
然后
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],