简体   繁体   English

表单元未出现在表视图objective-C中

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

I have one tableviewcontroller class that connected to navigation controller. 我有一个连接到导航控制器的tableviewcontroller类。

but I don't know why when I run it my cell didn't appear, and I have just a navigation bar with a tab bar here is my code : 但是我不知道为什么当我运行它时,我的单元格没有出现,并且我只有一个带有标签栏的导航栏,这是我的代码:

another problem is I want to have justify buttons in navigation bar in top but all my buttons are in the right I know that I used rightBarButtonItems but I don't know what should I right there for justify it . 另一个问题是我想在导航栏中显示对齐按钮,但是我所有的按钮都在右边,我知道我使用rightBarButtonItems,但是我不知道该在哪里对齐。

 self.navigationItem.rightBarButtonItems = buttons;

would you please helping me! 请你帮我一下! Thanks in advance! 提前致谢!

![enter image description here][2] ![在此处输入图片描述] [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;
 }

You have a static table view configured in the storyboard. 您在情节提要中配置了静态表格视图。 Since you are not populating it with some kind of dynamic data you should be fine if you delete the hole code part below : 由于未在其中填充某种动态数据,因此,如果删除以下漏洞代码部分,应该没问题

#pragma mark - Table view data source

Has you set tableview's datasource and delegate from the .xib file? 您是否已设置tableview的数据源并从.xib文件进行委托? Also add some text in the delegate cellForRowAtIndexPath and check again. 还要在委托cellForRowAtIndexPath中添加一些文本,然后再次检查。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在objective-c的表视图的每个单元格中获得相同的值 - getting the same value in each cell of table view in objective-c 突出显示表格视图单元格不会使用Objective-C突出显示表格视图单元格的子视图 - Highlighting table view cell will not highlight subviews of table view cell using objective-C Objective-C自定义表格单元格按钮 - Objective-c custom table cell buttons 当用户触摸第一个(动态)表视图(在 Objective-C 中)中的单元格时,如何生成第二个表视图? - How to generate a second table view when the user touches a cell in the first (dynamic) table view (in Objective-C)? 在objective-c中单击单元格时如何在其他视图中添加表视图单元格的内容 - how to add the content of the cell of table view in other view when clicked on cell in objective-c Objective-C表推视图 - objective-c Table Push view 如何在Objective-C中使用Segue表视图控制器单元格单击和单元格长按 - how to use segue table view controller cell click and cell long click in Objective-C 我如何将第二行放在Objective-C的表格视图单元格中? - how can i put the second line in the table view cell in objective-c? Objective-C简单约束将UILabel对齐到表视图单元格的右上角 - Objective-C simple constraint to align UILabel to top right of a table view cell 突出显示长按的表格视图单元格,并使用Objective-C在iOS中取消突出显示 - Highlight long pressed table view cell and unhighlight in iOS using objective-C
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM