小编Ora*_*eel的帖子

从视图中获取容器的宽度和高度

如果这是重复,请原谅我.我认为这肯定是个明显的问题.

我在故事板中有一个容器,它是ModelViewController类(整个视图控制器).从ModelViewController我需要获取容器的宽度和高度.我目前正在尝试:

self.view.bounds.size
Run Code Online (Sandbox Code Playgroud)

产生0.563380和0.000000.我也试过了

self.view.frame.size
Run Code Online (Sandbox Code Playgroud)

这产生了整个屏幕的尺寸.我在这里错过了什么?

xcode ios container-view

4
推荐指数
1
解决办法
3207
查看次数

是否可以窥视下一个兰特值

假设生成器已播种,可以在不更改的情况下查看下一个随机值?

即给出:

#include <stdlib.h>

int r;
r = rand(); // say this is 99
r = rand(); // say this is 80
Run Code Online (Sandbox Code Playgroud)

这可能吗

#include <stdlib.h>

int r;
r = peekAtRand(); // this will give 99
r = rand(); // but this still gives 99

r = peekAtRand(); // this will give 80
r = rand(); // but this still gives 80
Run Code Online (Sandbox Code Playgroud)

此外,这可以扩展到下一个n号码偷看吗?

c random

3
推荐指数
1
解决办法
258
查看次数

标签 统计

c ×1

container-view ×1

ios ×1

random ×1

xcode ×1