一个视图中的多个表视图 [英] several tableviews in one view

查看:38
本文介绍了一个视图中的多个表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个包含多个 tableView 的视图 - 基本上是一个每周日历视图,每天都是一个 tableView,显示当天的事件.

I am trying to make a view that contains several tableViews in it - basically a week calendar view that each day is a tableView that shows the events of that day.

在故事板中,我在视图中添加了一个 tableView 并尝试在 viewDidLoad 中以两种不同的方式连接它:

In the storyboard I'v added to the view a tableView and tried to connect it in two different ways in the viewDidLoad:

DaysTableViewController * tvc = [[DaysTableViewController alloc]  initWithStyle:UITableViewStylePlain];
self.dayView.delegate = tvc;
self.dayView.dataSource = tvc;

或:

DaysTableViewController * tvc = [[DaysTableViewController alloc] initWithStyle:UITableViewStylePlain];
self.dayView = tvc.tableView;

当 dayView 是故事板中 tableView 的 IBOutlet 属性时.但它以两种方式崩溃,我不知道它在代码中崩溃的地方.

when dayView is my IBOutlet property for the tableView in the storyboard. but it crash in both ways, and I dont know where it crash in the code.

我知道 DaysTableViewController 本身运行良好,因为当我将它推送到 NavigationController 时它可以运行.

I know the DaysTableViewController itself works fine, because when I push it in a NavigationController it works.

我做错了什么吗?

推荐答案

我发现了问题.这是一个简单的内存管理问题,我生气了作为 ViewDidLoad 中的数据库的对象并且没有强大的属性,并且刚刚被释放......谢谢大家的回答.

I'v found the problem. it was a simple memory management problem, I mad the Object that was the dataBase in the ViewDidLoad and didn't have a strong property for it, and just got released... thanks everyone for the answers.

这篇关于一个视图中的多个表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆