Swift:如何设置背景图像适合我的屏幕?

时间:2015-09-03 22:03:29

标签: swift colors background

我将图像设置为背景颜色,以便在图像上绘制一些线条。但是现在我无法使图像适合屏幕......我是swift的新手。

我尝试将此视图的ContentMode设置为AspectFit,ScaletoFit等,但它并没有影响背景颜色图像的显示。

有人可以帮忙吗?

这是我在 int recvsize = 0; unsigned char tmpsize; int index = 0; unsigned char *buffer; while (1) { recvsize = recv(server, &tmpsize, sizeof(unsigned char), 0); // every packet starts with one byte where is its length if (recvsize > 0 ) { buffer = malloc(tmpsize * sizeof(unsigned char)); //memory allocation according to the size of packet buffer[0] = tmpsize--; //get back the size value to the buffer recvsize = 0; do { //loop over and over until you do not have all bytes of the packet recvsize = recv(server, &buffer[++index], tmpsize, 0); if (recvsize == 0) break; tmpsize -=recvsize; index += recvsize; } while (tmpsize != 0); } sleep(50); } 中使用的代码:

UIViewController

绘图代码:

   self.view.backgroundColor = UIColor(patternImage: (UIImage (named: "Map"))!)

}

0 个答案:

没有答案