Tableview - 仅限WHITE屏幕 - Outlet仍然连接但未显示任何行

时间:2011-11-14 12:12:49

标签: objective-c uitableview uiview cell rows

我的UIViewController遇到了麻烦。在故事板中的此视图中,模拟器显示日期选择器,保存按钮和编辑按钮。但我的桌面视图似乎是隐藏的。只有一个白色的屏幕。比我用背景设置表格而不是我在模拟器中显示的“空行”,但是没有滚动等...所以,我看到表但现在我认为行...问题是什么?

这是我在.h文件中的插座: * tableview已连接。

    @interface NotifierViewController : UIViewController <UITableViewDataSource,UITableViewDelegate> {
    IBOutlet UITableView *tableview;
    IBOutlet UIDatePicker *datePicker;
    IBOutlet UITextField *eventText;
    NSMutableArray *notificationsArray;
    UILocalNotification *notifcation;
    UISegmentedControl *scheduleControl;

}

my.m文件中的Cell:

    // Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...


    self.notificationsArray = [NSMutableArray arrayWithArray:[[UIApplication sharedApplication] scheduledLocalNotifications]];
    notifcation = [self.notificationsArray objectAtIndex:indexPath.row];
    //UILocalNotification *notif = [notificationsArray objectAtIndex:indexPath.row];
    //NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
    //UILocalNotification *notif = [notificationArray objectAtIndex:indexPath.row];

    //Was in der Zelle als Titel steht
    //[[cell textLabel] setText:[notifcation alertBody]];
    [[cell textLabel] setText:@"alarm"];
    //[cell.detailTextLabel setText:[notif.fireDate description]];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd.MM.yyyy HH:mm"];
    [[cell detailTextLabel] setText:[dateFormatter stringFromDate:notifcation.fireDate]];
    [dateFormatter release];
    return cell;
}

在检查员中,我也将标识符命名为“Cell” Style是Basic,我决定使用1 Cell的Content部分中的Dynamic Prototypes。

1 个答案:

答案 0 :(得分:0)

我的默认是......

我必须将委托和dataSource连接到MyViewController。

检查员视图:

网点:

  • 代表 - &gt; MyViewController
  • dataSource - &gt; MyViewController

引用奥特莱斯:

  • mytableView - &gt; MyViewController