我正在编写一个C代码,它从文件中读取并生成一个中间.c文件.为此,我使用fprintf()打印到该中间文件.
我怎么打印"?
我想通过单击按钮来显示或隐藏部分.我不想在控制器中创建变量.有没有办法通过使用本地模板变量(使用#variableName)来做到这一点?
我在想下面的事情.但为此,我得到了template parse error.
<button color="primary" #showSection1="true" (click)="!showSection1;">Toggle</button>
<p *ngIf="showSection1">
This should be shown or hidden on click of the button.
</p>
Run Code Online (Sandbox Code Playgroud) 我创建了一个Xamarin Forms应用程序。并在带有名为“ MyLabel”的标签的新页面内。在我的页面后面的代码中
private void SetUpUI()
{
#if __IOS__
this.MyLabel.BackgroundColor = Color.Navy;
#endif
}
Run Code Online (Sandbox Code Playgroud)
在我的iOS项目选项中,我可以__IOS__在“编译器”选项卡中看到符号。(请看截图)
当我在iOS中运行时,它不会使标签变成蓝色:

但是,如果我删除#if __IOS__块,它将使标签变为蓝色:

因此,似乎条件编译不起作用。我在Mac上。因此无法在Visual Studio上进行测试。卡住了很长时间,但无法弄清我错过了什么。