我使用Unity 5.1为移动游戏构建了一个注册表单.为此,我使用Unity UI组件:ScrollRect + Autolayout(垂直布局)+文本(标签)+输入字段.这部分工作正常.
但是,打开键盘时,所选字段位于键盘下方.有没有办法以编程方式滚动表单以使选定的字段进入视图?
我尝试过使用ScrollRect.verticalNormalizedPosition它可以正常滚动一些,但是我无法将所选字段显示在我想要的位置.
谢谢你的帮助 !
问题出在数组上。声明数组的那行没有问题,是它后面的那一行。似乎我无法像在 C 中那样编码。为了清晰起见,我如何在需要这种格式时修复它。我不想写很长的一行,因为这个数组中有 15 个变量。
这是代码
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN 150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 600 // this is the 'maximum' pulse length count (out of 4096)
///// void setup /////
void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
delay(10);
}
///// Coordonnees /////
int angles[5][3]; //angles de chaque moteur pour chaque cube
angles[0][0]=60;
angles[0][1]=120;
angles[0][2]=100;
Run Code Online (Sandbox Code Playgroud)
基本上它angles[0][0]=;是导致问题的和与它相似的线。