#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
char hello[5];
hello [0] = 'H';
hello [1] = 'e';
hello [2] = 'l';
hello [3] = 'l';
hello [4] = 'o';
char world[5];
world [0] = 'W';
world [1] = 'o';
world [2] = 'r';
world [3] = 'l';
world [4] = 'd';
printf ("%s %s!\n", hello, world);
return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
当我运行上面的代码时,我得到:
Hello WorldHello!
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么我的输出要么重复单词,要么打印出奇怪的数字和字母?是因为我没有包含'\ 0'吗?
我试图在包含UISearchController的视图中更改导航栏的颜色.我以前在appDelegate中为整个应用程序设置了导航栏的颜色,但我希望这个视图导航栏有不同的颜色.问题是,我不知道放置代码的功能,以便它将覆盖appDelegate代码.例如,viewDidLoad和viewWilAppear在视图首次加载时不会更改颜色,只有在我输入和取消searchController之后.我应该放置以下哪个功能?
UINavigationBar.appearance().backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
Run Code Online (Sandbox Code Playgroud) 我有一个充满图像的tableView.当用户点击图像(在单元格内)时,使用popover segue调用具有较大可缩放版本图像的viewController.当我解除弹出窗口并返回到我的tableView时,它会自动显示表格的顶部单元格.有没有办法阻止这种情况发生,并在调用popover之前返回上一个位置/单元格?
编辑:打电话给我使用的popover
performSegueWithIdentifier("segueToPopOver", sender: tap.view)
Run Code Online (Sandbox Code Playgroud)
解雇它我使用以下内容:
let tmpController :UIViewController! = self.presentingViewController;
self.dismissViewControllerAnimated(true, completion: {()->Void in
tmpController.dismissViewControllerAnimated(true, completion: nil);
});
Run Code Online (Sandbox Code Playgroud)