我需要自定义UITableViewController每个部分的标题部分,返回不同的标题文本(从数据源获取数据).这可以使用以下方法完成:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSArray *temp = [listOfMBeans allKeys];
DLog(@"MBean details: %@", temp);
NSString *title = [temp objectAtIndex:section];
DLog(@"Header Title: %@", title);
return title;
};
Run Code Online (Sandbox Code Playgroud)
这很好用,我可以看到预期的输出.但是我需要更改文本的字体大小,在查看类似的问题后,我实现了以下内容:
- (UIView *) tableview:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
DLog(@"Custom Header Section Title being set");
UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)] autorelease];
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)] autorelease];
label.text = [tableView.dataSource tableView:tableView titleForHeaderInSection:section];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:14];
[headerView addSubview:label];
return …Run Code Online (Sandbox Code Playgroud) 我正在使用以下命令通过 SSH 启动脚本:
ssh myuser@myhost "bash -x -c 'source config.sh; nohup Start_JBoss.sh > /dev/null &; sleep 5'"
Run Code Online (Sandbox Code Playgroud)
但是我遇到了一个错误:
Connecting to: myhost with myuser
Password:
bash: -c: line 0: syntax error near unexpected token `;'
bash: -c: line 0: `source config.sh; nohup Start_JBoss.sh > /dev/null &; sleep 5'
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?我知道 SSH 不是原因,因为相同的命令在本地 shell 中失败。
我读过一些类似的帖子,其中有人提到 Bash 版本是其他一些意外令牌问题的罪魁祸首,因此在此处添加仅供参考,以防万一:
bash -version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Run Code Online (Sandbox Code Playgroud)