- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我不知道为什么我总是遇到这个错误!
再次!
http://i.imgur.com/Fe7GodI.png
顺便说一句,我使用xcode 7.3
如果这样的代码,不会出错
case 2:
self.recipesImageView.image = UIImage(named: noodles.image)
title = self.noodles.name
case 2:
self.recipesImageView.image = UIImage(named: snacks.image)
title = self.snacks.name
class DetailViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var recipesImageView: UIImageView!
@IBOutlet var tableView:UITableView!
var recipes:Recipe!
var noodles:Recipe!
var snacks:Recipe!
var category: Int = Int()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
switch self.category {
case 0:
self.recipesImageView.image = UIImage(named: recipes.image)
title = self.recipes.name
case 1:
self.recipesImageView.image = UIImage(named: noodles.image)
title = self.noodles.name
case 2:
self.recipesImageView.image = UIImage(named: snacks.image) //<------this line will be error
title = self.snacks.name
case 3:
self.recipesImageView.image = UIImage(named: noodles.image)
title = self.noodles.name
case 4:
self.recipesImageView.image = UIImage(named: noodles.image)
title = self.noodles.name
default:
self.recipesImageView.image = UIImage(named: recipes.image)
title = self.recipes.name
}
self.tableView.backgroundColor = UIColor(red: 240.0/255.0, green: 240.0/255.0, blue: 240.0/255.0, alpha: 0.5)
//刪除多餘的隔線
self.tableView.tableFooterView = UIView(frame: CGRectZero)
self.tableView.separatorColor = UIColor(red: 240.0/255.0, green: 240.0/255.0, blue: 240.0/255.0, alpha: 1)
//title = self.recipes.name
tableView.estimatedRowHeight = 36.0;
tableView.rowHeight = UITableViewAutomaticDimension;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! DetailTableViewCell
//cell.backgroundColor = UIColor.clearColor()
if self.category == 0 {
switch indexPath.row {
case 0:
cell.fieldLabel.text = "名稱"
cell.valueLabel.text = recipes.name
cell.amountLabel.text = ""
case 1:
cell.fieldLabel.text = "類型"
cell.valueLabel.text = recipes.type
cell.amountLabel.text = ""
case 2:
cell.fieldLabel.text = "收藏"
cell.valueLabel.text = (recipes.isFavor) ? "Yes" : "No"
cell.amountLabel.text = ""
case 3:
cell.fieldLabel.text = "食材"
cell.valueLabel.text = recipes.material
cell.amountLabel.text = recipes.amount
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
cell.amountLabel.text = ""
}
}
if self.category == 1 {
switch indexPath.row {
case 0:
cell.fieldLabel.text = "名稱"
cell.valueLabel.text = noodles.name
cell.amountLabel.text = ""
case 1:
cell.fieldLabel.text = "類型"
cell.valueLabel.text = noodles.type
cell.amountLabel.text = ""
case 2:
cell.fieldLabel.text = "收藏"
cell.valueLabel.text = (noodles.isFavor) ? "Yes" : "No"
cell.amountLabel.text = ""
case 3:
cell.fieldLabel.text = "食材"
cell.valueLabel.text = noodles.material
cell.amountLabel.text = noodles.amount
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
cell.amountLabel.text = ""
}
}
if self.category == 2 {
switch indexPath.row {
case 0:
cell.fieldLabel.text = "名稱"
cell.valueLabel.text = snacks.name
cell.amountLabel.text = ""
case 1:
cell.fieldLabel.text = "類型"
cell.valueLabel.text = snacks.type
cell.amountLabel.text = ""
case 2:
cell.fieldLabel.text = "收藏"
cell.valueLabel.text = (snacks.isFavor) ? "Yes" : "No"
cell.amountLabel.text = ""
case 3:
cell.fieldLabel.text = "食材"
cell.valueLabel.text = snacks.material
cell.amountLabel.text = snacks.amount
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
cell.amountLabel.text = ""
}
}
if self.category == 3 {
switch indexPath.row {
case 0:
cell.fieldLabel.text = "名稱"
cell.valueLabel.text = noodles.name
cell.amountLabel.text = ""
case 1:
cell.fieldLabel.text = "類型"
cell.valueLabel.text = noodles.type
cell.amountLabel.text = ""
case 2:
cell.fieldLabel.text = "收藏"
cell.valueLabel.text = (noodles.isFavor) ? "Yes" : "No"
cell.amountLabel.text = ""
case 3:
cell.fieldLabel.text = "食材"
cell.valueLabel.text = noodles.material
cell.amountLabel.text = noodles.amount
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
cell.amountLabel.text = ""
}
}
if self.category == 4 {
switch indexPath.row {
case 0:
cell.fieldLabel.text = "名稱"
cell.valueLabel.text = noodles.name
cell.amountLabel.text = ""
case 1:
cell.fieldLabel.text = "類型"
cell.valueLabel.text = noodles.type
cell.amountLabel.text = ""
case 2:
cell.fieldLabel.text = "收藏"
cell.valueLabel.text = (noodles.isFavor) ? "Yes" : "No"
cell.amountLabel.text = ""
case 3:
cell.fieldLabel.text = "食材"
cell.valueLabel.text = noodles.material
cell.amountLabel.text = noodles.amount
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
cell.amountLabel.text = ""
}
}
return cell
}
//避免被前面一頁的隱藏導覽列所影響
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.hidesBarsOnSwipe = false
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
最佳答案
前任控制人
if segue.identifier == "showRecipesDetail" {
// var obj = segue.destinationViewController as! DetailTableViewCell
if let indexPath = self.tableView.indexPathForSelectedRow {
let destinationController = segue.destinationViewController as! DetailViewController
if segment.selectedSegmentIndex == 0 {
destinationController.recipes = recipes[indexPath.row]
destinationController.category = self.category
print(category)
}
if segment.selectedSegmentIndex == 1 {
destinationController.noodles = noodles[indexPath.row]
destinationController.category = self.category
print(category)
}
if segment.selectedSegmentIndex == 2 {
destinationController.noodles = snacks[indexPath.row]
destinationController.category = self.category
print(category)
}
if segment.selectedSegmentIndex == 3 {
destinationController.noodles = noodles[indexPath.row]
destinationController.category = self.category
}
if segment.selectedSegmentIndex == 4 {
destinationController.noodles = noodles[indexPath.row]
destinationController.category = self.category
}
}
}
}
if segment.selectedSegmentIndex == 2 {
destinationController.noodles = snacks[indexPath.row] <----this line is wrong
destinationController.category = self.category
print(category)
}
destinationController.snacks = snacks[indexPath.row]
关于ios - swift:线程1:exc_bad_instruction(code = exc_1386_invop,subcode = 0x0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39846451/
I'm trying to create a VST plug-in using JUCE framework by video tutorial but I've been having th
我下载了 gsoap 2.8 并进入示例文件夹并运行了一个 make。一切似乎都建立得很好。然后我导航到“ssl”文件夹并在一个 xterm 中运行 sllserver,并在第二个 xterm 窗口中
我在 iOS7 设备上运行我的应用程序时遇到 EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe) 错误。问题是,它在 iOS7 模拟器上运行
我正在运行以下代码并在 swift 中收到错误。 func collectionView(_ collectionView: UICollectionView, cellForItemAt index
我正在尝试访问 GitHub 统计信息,来自 API 的信息返回为 [ {"name" : "Peter"}, { "name" : "Daniel"}, ] 每次我尝试解析它时,都会收到 EXC_B
这个问题在这里已经有了答案: What does "Fatal error: Unexpectedly found nil while unwrapping an Optional value" m
我在创建应用程序的发布版本时遇到以下错误: EXC_BREAKPOINT(代码=EXC_ARM_BREAKPOINT,子代码=0xe7ffdefe) 在“调试”构建时一切正常,完全没有错误。 我已经设
我正在制作图像库,让我能够从我制作的 Collection View 中选择多个图像当我玩得开心时,我的代码避免是好的,但是当我按下选择按钮时,这个错误发生了“EXC_BAD_INSTRUCTION(
我在使用 SwiftMoment 的这部分代码中遇到了这个问题 https://github.com/akosma/SwiftMoment public func moment(_ timetoken
我不知道为什么我总是遇到这个错误! 再次! http://i.imgur.com/Fe7GodI.png 顺便说一句,我使用xcode 7.3 如果这样的代码,不会出错 case 2:
我创建了一个名为addFont的UILable,并手动向它添加addGestureRecognizer,但是出现了一个不熟悉的错误: EXC_BAD_INSTRUCTION(代码=EXC_I386_I
当我运行我的应用程序时,返回部分中的项目数量出现此异常 这是我的代码: import UIKit 导入Alamofire导入 SwiftyJSON 类详细页面:UIViewController、UIC
我对这段代码有疑问。为什么它在“let session”行给我一个错误“Thread 1 EXC_bad_instruction (code=exc_1386_invop subcode=0x0)”?
出于某种原因,当到达 performSegueWithIdentifier 行时我收到此错误。 我有这个代码: if let storedAPIKeychain: AnyObject = dictio
我正在开发这个记录器项目,这段代码是用 swift 2.0 编写的,它给出了这个问题!我有类似的标题帖子,但与我遇到的问题无关 导入UIKit导入AVFoundation 类 PlaySoundVie
每次编译器在从 Json 对象获取一些数据后尝试创建 Web View 时,我的程序都会崩溃。它因以下错误而崩溃: EXC_BREAKPOINT (CODE=EXC_I386_BPT, SUBCODE
我制作了一个包含 4 个单元格的 Collection View ,当您按下单元格 1 中的按钮(我还没有制作其他单元格)时,它将带您到一个名为“FirstCollectionViewControll
当我尝试将分数从 GameViewController 委托(delegate)给 ViewController 时,我遇到了这个问题: 如果我删除 bestName,它会正常工作。 最佳答案 第一次
我在我的 iOS 项目中使用 Realm 数据库。我的构建总是成功的,但是当应用程序在模拟器中运行时,它会在 Realm 对象的初始化时生成上述异常。 import UIKit import Real
我正在编写一个 swift 网络管理器库,专门用于满足我自己的 API 需求。这个类被声明为 final 并且有一个静态的 let 变量来定义这个类的单例设计模式。此类中的所有其他函数都是类函数。 不
我是一名优秀的程序员,十分优秀!