My UITableView with custom xib cells disappear as soon as I start scrolling












2















import UIKit

class ToDoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var DateLabel: UILabel!
@IBOutlet weak var MonthLabel: UILabel!
@IBOutlet weak var DayLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var newButton: UIImageView!

static var ToDoEvents:[event] =

override func viewDidLoad() {
super.viewDidLoad()
ToDoViewController.readFromFile()
// let nib = UINib(nibName: "CustomCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")
//let nib = UINib.init(nibName: "customCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")

tableView.register(UINib(nibName: String(describing: CustomCell.self), bundle: nil), forCellReuseIdentifier: "customCell")

self.tableView.delegate = self
self.tableView.dataSource = self

// Do any additional setup after loading the view.
}

public static func readFromFile(){
ToDoViewController.ToDoEvents.append(event(eventName: "Spanish Workbook", eventLength: 3601, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "History Test", eventLength: 37, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "Lit Essay", eventLength: 40, complete: true))
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomCell
let currentEvent = ToDoViewController.ToDoEvents[indexPath.row]
let eventName = currentEvent.name!
let eventLength = currentEvent.time!
let completion = currentEvent.isComplete!
print(eventName)
print(eventLength)
print(completion)

cell.customInit(name: "(eventName)", time: "(eventLength)", completed: completion)
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}


This is my entire view controller class, but i am unable to find out why all of the data disappears as soon as I start scrolling down. The data is unable to be seen although you can see it initally. I cannot figure out why the data disappears and this the entire file. The custom init method has been shared below, although i believe that this is not the actual problem changing it.



func customInit(name: String, time: String, completed: Bool){
self.eventName.text = name
self.lengthLabel.text = time

if(completed) {
completedImage.image = UIImage(named: "C")
} else {
completedImage.image = UIImage(named: "R")
}
//self.contentView.backgroundColor = UIColor(red: 129/255.0, green: 25/255.0, blue: 207/255.0, alpha: 1)
}


import Foundation



class event{
var name: String?
var time: Int?
var isComplete: Bool?



init(eventName: String, eventLength: Int) {
self.name = eventName
self.time = eventLength
self.isComplete = false
}

init(eventName: String, eventLength: Int, complete: Bool) {
self.name = eventName
self.time = eventLength
self.isComplete = complete
}


}










share|improve this question

























  • can you share your customInit method?

    – Malik
    Nov 22 '18 at 4:25











  • @Malik yes i have edited the intial post and shared the code for customInit.

    – Vidit Agrawal
    Nov 22 '18 at 18:57











  • Please share your event class code

    – Jatin Kathrotiya
    Nov 23 '18 at 5:08











  • @JatinKathrotiya I have updated the code with the event class code.

    – Vidit Agrawal
    Nov 24 '18 at 6:11











  • i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

    – Jatin Kathrotiya
    Nov 26 '18 at 4:09
















2















import UIKit

class ToDoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var DateLabel: UILabel!
@IBOutlet weak var MonthLabel: UILabel!
@IBOutlet weak var DayLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var newButton: UIImageView!

static var ToDoEvents:[event] =

override func viewDidLoad() {
super.viewDidLoad()
ToDoViewController.readFromFile()
// let nib = UINib(nibName: "CustomCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")
//let nib = UINib.init(nibName: "customCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")

tableView.register(UINib(nibName: String(describing: CustomCell.self), bundle: nil), forCellReuseIdentifier: "customCell")

self.tableView.delegate = self
self.tableView.dataSource = self

// Do any additional setup after loading the view.
}

public static func readFromFile(){
ToDoViewController.ToDoEvents.append(event(eventName: "Spanish Workbook", eventLength: 3601, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "History Test", eventLength: 37, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "Lit Essay", eventLength: 40, complete: true))
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomCell
let currentEvent = ToDoViewController.ToDoEvents[indexPath.row]
let eventName = currentEvent.name!
let eventLength = currentEvent.time!
let completion = currentEvent.isComplete!
print(eventName)
print(eventLength)
print(completion)

cell.customInit(name: "(eventName)", time: "(eventLength)", completed: completion)
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}


This is my entire view controller class, but i am unable to find out why all of the data disappears as soon as I start scrolling down. The data is unable to be seen although you can see it initally. I cannot figure out why the data disappears and this the entire file. The custom init method has been shared below, although i believe that this is not the actual problem changing it.



func customInit(name: String, time: String, completed: Bool){
self.eventName.text = name
self.lengthLabel.text = time

if(completed) {
completedImage.image = UIImage(named: "C")
} else {
completedImage.image = UIImage(named: "R")
}
//self.contentView.backgroundColor = UIColor(red: 129/255.0, green: 25/255.0, blue: 207/255.0, alpha: 1)
}


import Foundation



class event{
var name: String?
var time: Int?
var isComplete: Bool?



init(eventName: String, eventLength: Int) {
self.name = eventName
self.time = eventLength
self.isComplete = false
}

init(eventName: String, eventLength: Int, complete: Bool) {
self.name = eventName
self.time = eventLength
self.isComplete = complete
}


}










share|improve this question

























  • can you share your customInit method?

    – Malik
    Nov 22 '18 at 4:25











  • @Malik yes i have edited the intial post and shared the code for customInit.

    – Vidit Agrawal
    Nov 22 '18 at 18:57











  • Please share your event class code

    – Jatin Kathrotiya
    Nov 23 '18 at 5:08











  • @JatinKathrotiya I have updated the code with the event class code.

    – Vidit Agrawal
    Nov 24 '18 at 6:11











  • i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

    – Jatin Kathrotiya
    Nov 26 '18 at 4:09














2












2








2








import UIKit

class ToDoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var DateLabel: UILabel!
@IBOutlet weak var MonthLabel: UILabel!
@IBOutlet weak var DayLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var newButton: UIImageView!

static var ToDoEvents:[event] =

override func viewDidLoad() {
super.viewDidLoad()
ToDoViewController.readFromFile()
// let nib = UINib(nibName: "CustomCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")
//let nib = UINib.init(nibName: "customCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")

tableView.register(UINib(nibName: String(describing: CustomCell.self), bundle: nil), forCellReuseIdentifier: "customCell")

self.tableView.delegate = self
self.tableView.dataSource = self

// Do any additional setup after loading the view.
}

public static func readFromFile(){
ToDoViewController.ToDoEvents.append(event(eventName: "Spanish Workbook", eventLength: 3601, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "History Test", eventLength: 37, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "Lit Essay", eventLength: 40, complete: true))
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomCell
let currentEvent = ToDoViewController.ToDoEvents[indexPath.row]
let eventName = currentEvent.name!
let eventLength = currentEvent.time!
let completion = currentEvent.isComplete!
print(eventName)
print(eventLength)
print(completion)

cell.customInit(name: "(eventName)", time: "(eventLength)", completed: completion)
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}


This is my entire view controller class, but i am unable to find out why all of the data disappears as soon as I start scrolling down. The data is unable to be seen although you can see it initally. I cannot figure out why the data disappears and this the entire file. The custom init method has been shared below, although i believe that this is not the actual problem changing it.



func customInit(name: String, time: String, completed: Bool){
self.eventName.text = name
self.lengthLabel.text = time

if(completed) {
completedImage.image = UIImage(named: "C")
} else {
completedImage.image = UIImage(named: "R")
}
//self.contentView.backgroundColor = UIColor(red: 129/255.0, green: 25/255.0, blue: 207/255.0, alpha: 1)
}


import Foundation



class event{
var name: String?
var time: Int?
var isComplete: Bool?



init(eventName: String, eventLength: Int) {
self.name = eventName
self.time = eventLength
self.isComplete = false
}

init(eventName: String, eventLength: Int, complete: Bool) {
self.name = eventName
self.time = eventLength
self.isComplete = complete
}


}










share|improve this question
















import UIKit

class ToDoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

@IBOutlet weak var DateLabel: UILabel!
@IBOutlet weak var MonthLabel: UILabel!
@IBOutlet weak var DayLabel: UILabel!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var newButton: UIImageView!

static var ToDoEvents:[event] =

override func viewDidLoad() {
super.viewDidLoad()
ToDoViewController.readFromFile()
// let nib = UINib(nibName: "CustomCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")
//let nib = UINib.init(nibName: "customCell", bundle: nil)
// tableView.register(nib, forCellReuseIdentifier: "customCell")

tableView.register(UINib(nibName: String(describing: CustomCell.self), bundle: nil), forCellReuseIdentifier: "customCell")

self.tableView.delegate = self
self.tableView.dataSource = self

// Do any additional setup after loading the view.
}

public static func readFromFile(){
ToDoViewController.ToDoEvents.append(event(eventName: "Spanish Workbook", eventLength: 3601, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "History Test", eventLength: 37, complete: false))
ToDoViewController.ToDoEvents.append(event(eventName: "Lit Essay", eventLength: 40, complete: true))
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomCell
let currentEvent = ToDoViewController.ToDoEvents[indexPath.row]
let eventName = currentEvent.name!
let eventLength = currentEvent.time!
let completion = currentEvent.isComplete!
print(eventName)
print(eventLength)
print(completion)

cell.customInit(name: "(eventName)", time: "(eventLength)", completed: completion)
return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}


This is my entire view controller class, but i am unable to find out why all of the data disappears as soon as I start scrolling down. The data is unable to be seen although you can see it initally. I cannot figure out why the data disappears and this the entire file. The custom init method has been shared below, although i believe that this is not the actual problem changing it.



func customInit(name: String, time: String, completed: Bool){
self.eventName.text = name
self.lengthLabel.text = time

if(completed) {
completedImage.image = UIImage(named: "C")
} else {
completedImage.image = UIImage(named: "R")
}
//self.contentView.backgroundColor = UIColor(red: 129/255.0, green: 25/255.0, blue: 207/255.0, alpha: 1)
}


import Foundation



class event{
var name: String?
var time: Int?
var isComplete: Bool?



init(eventName: String, eventLength: Int) {
self.name = eventName
self.time = eventLength
self.isComplete = false
}

init(eventName: String, eventLength: Int, complete: Bool) {
self.name = eventName
self.time = eventLength
self.isComplete = complete
}


}







ios swift






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 6:11







Vidit Agrawal

















asked Nov 22 '18 at 4:00









Vidit AgrawalVidit Agrawal

124




124













  • can you share your customInit method?

    – Malik
    Nov 22 '18 at 4:25











  • @Malik yes i have edited the intial post and shared the code for customInit.

    – Vidit Agrawal
    Nov 22 '18 at 18:57











  • Please share your event class code

    – Jatin Kathrotiya
    Nov 23 '18 at 5:08











  • @JatinKathrotiya I have updated the code with the event class code.

    – Vidit Agrawal
    Nov 24 '18 at 6:11











  • i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

    – Jatin Kathrotiya
    Nov 26 '18 at 4:09



















  • can you share your customInit method?

    – Malik
    Nov 22 '18 at 4:25











  • @Malik yes i have edited the intial post and shared the code for customInit.

    – Vidit Agrawal
    Nov 22 '18 at 18:57











  • Please share your event class code

    – Jatin Kathrotiya
    Nov 23 '18 at 5:08











  • @JatinKathrotiya I have updated the code with the event class code.

    – Vidit Agrawal
    Nov 24 '18 at 6:11











  • i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

    – Jatin Kathrotiya
    Nov 26 '18 at 4:09

















can you share your customInit method?

– Malik
Nov 22 '18 at 4:25





can you share your customInit method?

– Malik
Nov 22 '18 at 4:25













@Malik yes i have edited the intial post and shared the code for customInit.

– Vidit Agrawal
Nov 22 '18 at 18:57





@Malik yes i have edited the intial post and shared the code for customInit.

– Vidit Agrawal
Nov 22 '18 at 18:57













Please share your event class code

– Jatin Kathrotiya
Nov 23 '18 at 5:08





Please share your event class code

– Jatin Kathrotiya
Nov 23 '18 at 5:08













@JatinKathrotiya I have updated the code with the event class code.

– Vidit Agrawal
Nov 24 '18 at 6:11





@JatinKathrotiya I have updated the code with the event class code.

– Vidit Agrawal
Nov 24 '18 at 6:11













i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

– Jatin Kathrotiya
Nov 26 '18 at 4:09





i checked above code in my machine it's working fine for me. Might be issue is some else not in table view code

– Jatin Kathrotiya
Nov 26 '18 at 4:09












1 Answer
1






active

oldest

votes


















0














you should change static number in numberOfRowsInSection



like:



func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}





share|improve this answer
























  • this doesn't seem to fix the problem that I am facing, can you suggest something else?

    – Vidit Agrawal
    Nov 22 '18 at 18:59











  • I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

    – matt
    Nov 22 '18 at 19:19











  • The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

    – Vidit Agrawal
    Nov 22 '18 at 20:00








  • 1





    Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

    – Dale
    Nov 22 '18 at 22:33











  • Sorry, I have updated the code asked in the question.

    – Vidit Agrawal
    Nov 23 '18 at 5:02











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423690%2fmy-uitableview-with-custom-xib-cells-disappear-as-soon-as-i-start-scrolling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














you should change static number in numberOfRowsInSection



like:



func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}





share|improve this answer
























  • this doesn't seem to fix the problem that I am facing, can you suggest something else?

    – Vidit Agrawal
    Nov 22 '18 at 18:59











  • I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

    – matt
    Nov 22 '18 at 19:19











  • The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

    – Vidit Agrawal
    Nov 22 '18 at 20:00








  • 1





    Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

    – Dale
    Nov 22 '18 at 22:33











  • Sorry, I have updated the code asked in the question.

    – Vidit Agrawal
    Nov 23 '18 at 5:02
















0














you should change static number in numberOfRowsInSection



like:



func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}





share|improve this answer
























  • this doesn't seem to fix the problem that I am facing, can you suggest something else?

    – Vidit Agrawal
    Nov 22 '18 at 18:59











  • I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

    – matt
    Nov 22 '18 at 19:19











  • The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

    – Vidit Agrawal
    Nov 22 '18 at 20:00








  • 1





    Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

    – Dale
    Nov 22 '18 at 22:33











  • Sorry, I have updated the code asked in the question.

    – Vidit Agrawal
    Nov 23 '18 at 5:02














0












0








0







you should change static number in numberOfRowsInSection



like:



func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}





share|improve this answer













you should change static number in numberOfRowsInSection



like:



func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ToDoViewController.ToDoEvents.count
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 4:26









Jatin KathrotiyaJatin Kathrotiya

419210




419210













  • this doesn't seem to fix the problem that I am facing, can you suggest something else?

    – Vidit Agrawal
    Nov 22 '18 at 18:59











  • I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

    – matt
    Nov 22 '18 at 19:19











  • The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

    – Vidit Agrawal
    Nov 22 '18 at 20:00








  • 1





    Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

    – Dale
    Nov 22 '18 at 22:33











  • Sorry, I have updated the code asked in the question.

    – Vidit Agrawal
    Nov 23 '18 at 5:02



















  • this doesn't seem to fix the problem that I am facing, can you suggest something else?

    – Vidit Agrawal
    Nov 22 '18 at 18:59











  • I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

    – matt
    Nov 22 '18 at 19:19











  • The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

    – Vidit Agrawal
    Nov 22 '18 at 20:00








  • 1





    Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

    – Dale
    Nov 22 '18 at 22:33











  • Sorry, I have updated the code asked in the question.

    – Vidit Agrawal
    Nov 23 '18 at 5:02

















this doesn't seem to fix the problem that I am facing, can you suggest something else?

– Vidit Agrawal
Nov 22 '18 at 18:59





this doesn't seem to fix the problem that I am facing, can you suggest something else?

– Vidit Agrawal
Nov 22 '18 at 18:59













I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

– matt
Nov 22 '18 at 19:19





I think this answer makes sense. Your code asks for 6 rows but your data model has only 3 events. So I expect you to be unable to scroll because you have so little data.

– matt
Nov 22 '18 at 19:19













The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

– Vidit Agrawal
Nov 22 '18 at 20:00







The data still disappears when I try to scroll, even when I change it to the count of the amount of events.

– Vidit Agrawal
Nov 22 '18 at 20:00






1




1





Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

– Dale
Nov 22 '18 at 22:33





Pls update your code in the question. As currently shown with 6 rows in section, but only 3 in the data, the app would crash when trying to access the data for the first of the last 3 rews

– Dale
Nov 22 '18 at 22:33













Sorry, I have updated the code asked in the question.

– Vidit Agrawal
Nov 23 '18 at 5:02





Sorry, I have updated the code asked in the question.

– Vidit Agrawal
Nov 23 '18 at 5:02


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423690%2fmy-uitableview-with-custom-xib-cells-disappear-as-soon-as-i-start-scrolling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Basket-ball féminin

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...

I want to find a topological embedding $f : X rightarrow Y$ and $g: Y rightarrow X$, yet $X$ is not...