xcode6.1.1

Why does my tableView function run three times?

柔情痞子 提交于 2021-01-27 07:41:09
问题 I have a UITableView and I have one of the required methods for its execution: func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { println("section is \(section)") println(self.items.count) // self.items.count = 3 return self.items.count } In my log I see the method being run 3 times: section is 0 3 section is 0 3 section is 0 3 EDIT: This is the snippet of my section: func numberOfSectionsInTableView(tableView:UITableView!)->Int { return 1 } Picture of my

Why does my tableView function run three times?

十年热恋 提交于 2021-01-27 07:38:54
问题 I have a UITableView and I have one of the required methods for its execution: func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { println("section is \(section)") println(self.items.count) // self.items.count = 3 return self.items.count } In my log I see the method being run 3 times: section is 0 3 section is 0 3 section is 0 3 EDIT: This is the snippet of my section: func numberOfSectionsInTableView(tableView:UITableView!)->Int { return 1 } Picture of my

Trying to create a portfolio of stocks with a total value in Objective-C, but unsure of the approach

点点圈 提交于 2019-12-12 05:16:04
问题 I'm currently teaching myself Objective-C with the Big Nerd Ranch guide (2nd edition) and I have not had a problem up until chapter 21. I checked the book's forum, but it was of no help because most people there are newbies with spaghetti code, and I do not want to adopt bad habits...I am a beginner too, as this is my first major language, but spaghetti code is obvious when you see it. I have to take my code from a previous chapter and make a tool that creates an instance of a BNRPortfolio