두 번째보기 컨트롤러에서 작업을 가져와 첫 번째보기의 테이블보기에 추가하는 작업 목록을 설정하려고합니다. 나는 인기있는 튜토리얼을 따라 왔으며, 코멘트에 대한 지원은 제한적이다. 다른 튜토리얼과 게시물을 잘 살펴 보았지만 동일한 양식을 사용하는 사람은 없었습니다. 신속하게 초보자 만이 링크를 찾을 수 없었습니다.UITableViewCell 다른보기 컨트롤러에서 입력에서 전송 런타임 중단 점 (lldb)
두 번째보기 컨트롤러에서 UIButton 오류가 발생하면 텍스트를 저장하는 테이블 인 첫 번째보기로 텍스트가 이동합니다.
오류는 in-app에서 발생하며이 줄에서 중단 점입니다.
let cell:UITableViewCell = UITableViewCell(style:UITableViewCellStyle.Subtitle, reuseIdentifier: "test")
이 오류 메시지는 lldb하고 BT에 도움이 아무것도 볼 수 없었다
(lldb) bt
* thread #1: tid = 0x23e9e, 0x00000001044ed5e3 ToDo Task`ToDo_Task.FirstViewController.tableView (tableView=0x00007f9721851600, indexPath=0xc000000000000016, self=0x00007f9720f6e7f0)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UITableViewCell + 35 at FirstViewController.swift:27, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1 4.1
* frame #0: 0x00000001044ed5e3 ToDo Task`ToDo_Task.FirstViewController.tableView (tableView=0x00007f9721851600, indexPath=0xc000000000000016, self=0x00007f9720f6e7f0)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UITableViewCell + 35 at FirstViewController.swift:27
frame #1: 0x00000001044ee2af ToDo Task`@objc ToDo_Task.FirstViewController.tableView (ToDo_Task.FirstViewController)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UITableViewCell + 79 at FirstViewController.swift:0
frame #2: 0x00000001050594b3 UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 508
frame #3: 0x0000000105038fb1 UIKit`-[UITableView _updateVisibleCellsNow:isRecursive:] + 2846
frame #4: 0x000000010504ee3c UIKit`-[UITableView layoutSubviews] + 213
frame #5: 0x0000000104fdb973 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
frame #6: 0x0000000108ed9de8 QuartzCore`-[CALayer layoutSublayers] + 150
frame #7: 0x0000000108ecea0e QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #8: 0x0000000108ece87e QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
frame #9: 0x0000000108e3c63e QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242
frame #10: 0x0000000108e3d74a QuartzCore`CA::Transaction::commit() + 390
frame #11: 0x0000000104f5f14d UIKit`_UIApplicationHandleEventQueue + 2035
frame #12: 0x000000010460c551 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #13: 0x000000010460241d CoreFoundation`__CFRunLoopDoSources0 + 269
frame #14: 0x0000000104601a54 CoreFoundation`__CFRunLoopRun + 868
frame #15: 0x0000000104601486 CoreFoundation`CFRunLoopRunSpecific + 470
frame #16: 0x00000001087cd9f0 GraphicsServices`GSEventRunModal + 161
frame #17: 0x0000000104f62420 UIKit`UIApplicationMain + 1282
frame #18: 0x00000001044ebf1e ToDo Task`top_level_code + 78 at AppDelegate.swift:12
frame #19: 0x00000001044ebf5a ToDo Task`main + 42 at AppDelegate.swift:0
frame #20: 0x00000001069f4145 libdyld.dylib`start + 1
(lldb)
오류는이 기능
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:UITableViewCell = UITableViewCell(style:UITableViewCellStyle.Subtitle, reuseIdentifier: "test")
cell.textLabel?.text = taskMgr.tasks[indexPath.row].name
cell.detailTextLabel?.text = taskMgr.tasks[indexPath.row].desc
return cell
}
에 그리고에 taskmgr을 사용 새 코코아 파일
var taskMgr :TaskManager = TaskManager()
struct task{
var name = "un-named"
var desc = "un-described"
}
class TaskManager: NSObject {
var tasks = [task]()
func addTask (name: String, desc: String){
tasks.append(task(name: name,desc: desc))
}
}
내가 말했듯이, 이러한 것들을 쉽게 고칠 수 있을지 확신하지는 못했지만, 나는 신속하게 익숙해졌으며, 너무 단순한 것을 묻고 싶지 않았지만 그것을 습득하기 위해 내 지식에서 아무것도 할 수 없었습니다.
건배를 사용하는 경우 또한
cellForRowAtIndexPath
viewDidLoad
에서 그것을 사용하기 전에있는 UITableViewCell을 등록 내부UITableViewCell
의 인스턴스를 생성하는, 그것을 조정할했다 안으로 그것을 연마하고 그러나 끝냈다. 고마워. –