[英]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.