簡體   English   中英

表單元未出現在表視圖objective-C中

[英]table cell not appear in table view objective-C

我有一個連接到導航控制器的tableviewcontroller類。

但是我不知道為什么當我運行它時,我的單元格沒有出現,並且我只有一個帶有標簽欄的導航欄,這是我的代碼:

另一個問題是我想在導航欄中顯示對齊按鈕,但是我所有的按鈕都在右邊,我知道我使用rightBarButtonItems,但是我不知道該在哪里對齊。

 self.navigationItem.rightBarButtonItems = buttons;

請你幫我一下! 提前致謝!

![在此處輸入圖片描述] [2]

- (void)viewDidLoad
{
[super viewDidLoad];

 UIBarButtonItem *menuButton= [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleDone        target:self action:@selector(menu:)];
UIBarButtonItem *yearButton= [[UIBarButtonItem alloc] initWithTitle:@"Year" style:UIBarButtonItemStyleDone target:self action:@selector(year:)];
UIBarButtonItem *weekButton= [[UIBarButtonItem alloc] initWithTitle:@"Week" style:UIBarButtonItemStyleDone target:self action:@selector(week:)];
UIBarButtonItem *reportButton= [[UIBarButtonItem alloc] initWithTitle:@"Report" style:UIBarButtonItemStyleDone target:self action:@selector(report:)];

NSArray *buttons = [NSArray arrayWithObjects:menuButton,yearButton,weekButton,reportButton,nil];
self.navigationItem.rightBarButtonItems = buttons;


}

- (void)viewDidUnload
{

}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//#warning Potentially incomplete method implementation.
// Return the number of sections.
return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
// Return the number of rows in the section.
return 0;
 }

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {

 static NSString *CellIdentifier = @"Cell";
 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

// Configure the cell...

 return cell;
 }

您在情節提要中配置了靜態表格視圖。 由於未在其中填充某種動態數據,因此,如果刪除以下漏洞代碼部分,應該沒問題

#pragma mark - Table view data source

您是否已設置tableview的數據源並從.xib文件進行委托? 還要在委托cellForRowAtIndexPath中添加一些文本,然后再次檢查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM