Я установил delegate
& datasource
из Tableview в быстром и номер секции возвратного правильного значения, но numberOfRowsInSection
всегда возвращает 4. Так я два вопросnumberOfRowsInSection всегда возвращает значение починки в быстрой
- Я не» я знаю, почему он возвращается 4 всегда.
Когда число разделе 5, то почему
numberOfRowsInSection
вызывается множественным время, которое больше чем 5.func numberOfSectionsInTableView(tableView: UITableView) -> Int { println("No of Sections: \(self.contactArr.count)") if self.contactArr.count > 0{ return self.contactArr.count } else{ return 0 } } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { println("Current Section \(section)") var contactDic : NSDictionary = self.contactArr.objectAtIndex(section) as! NSDictionary var lcontactArr : NSMutableArray = contactDic["contact"] as! NSMutableArray return lcontactArr.count; }
Выходной
No of Sections: 5
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Current Section 4
Мой Контакт массив является :
Contacts = (
{
contact = (
{
date = "2015-09-07 05:00:30";
message = "Dear Dr. sund, Everything is going well, I can't give you an expected finish time yet.";
name = sund;
prefix = "<null>";
"user_messsage_id" = 3;
}
);
},
{
contact = (
{
date = "2015-09-07 05:38:23";
message = "Dear Dr. Krishan Kumar Sharma, We are in the Recovery Room, everything went well.";
name = "Krishan Kumar Sharma";
prefix = "Dr.";
"user_messsage_id" = 4;
},
{
date = "2015-09-07 07:51:57";
message = "Dear Mr. Krishan Kuram Sharma, In the Recovery Room, everything went well, someone will speak with you soon.";
name = "Krishan Kumar Sharma";
prefix = "Dr.";
"user_messsage_id" = 4;
}
);
},
{
contact = (
{
date = "2015-09-22 02:37:21";
message = "Dear Mr. xyz, Everything is going well, I can't give you an expected finish time yet.";
name = xyz;
prefix = "Mr.";
"user_messsage_id" = 19;
}
);
},
{
contact = (
{
date = "2015-09-28 09:28:26";
message = "Dear Mr. tester, Everything is going well, I can't give you an expected finish time yet.";
name = tester;
prefix = "Mr.";
"user_messsage_id" = 20;
},
{
date = "2015-09-28 09:31:39";
message = "Dear Mr. tester, Everything is going well, we expect to finish within the next hour.";
name = tester;
prefix = "Mr.";
"user_messsage_id" = 20;
},
{
date = "2015-09-28 09:32:01";
message = "Dear Mr. tester, We are in the Recovery Room, everything went well.";
name = tester;
prefix = "Mr.";
"user_messsage_id" = 20;
}
);
},
{
contact = (
{
date = "2015-09-29 03:08:33";
message = "Dear Mr. Jackson, Everything is going well, I can't give you an expected finish time yet.";
name = Jackson;
prefix = "<null>";
"user_messsage_id" = 24;
}
);
Любая помощь была бы оценена.
Вы проверили ваш lcontactArray? Возможно, он всегда возвращает такое же значение. – ridvankucuk
Нет, я только что напечатал текущее значение раздела, чтобы оно было как 0, 1, 2 –
Вы префикс 'override' в своих функциях datasource/delegate таблицы? – Abhinav