注册 登录
发贴工具
查看: 3|回复: 0
打印 上一主题 下一主题

[24小时收录超级好的网站] AIWROK苹果脚本实例1界面UI输入框类[Input]

[复制链接]

2486

主题

2534

帖子

1万

积分

积分
15112
跳转到指定楼层
楼主
AIWROK苹果脚本实例1界面UI输入框类[Input]






  1. // =============================================================================
  2. // 🎨 UI-输入框类[Input]全新系统化示例
  3. // 📱 适用于苹果iOS系统 - AIWROK IDE
  4. //🍎交流QQ群711841924群一,苹果内测群,528816639
  5. // =============================================================================
  6. //
  7. // 本示例全面展示Input控件的所有功能,采用TabView多页面架构,
  8. // 系统化地演示每个方法的使用场景和最佳实践。
  9. //
  10. // Input控件方法清单:
  11. // 1. setText(text) - 设置输入框文本内容
  12. // 2. getText() - 获取输入框文本内容
  13. // 3. setID(id) - 设置控件唯一标识符
  14. // 4. setDefultText(text) - 设置默认文本(配合config使用)
  15. // 5. setTextColor(r, g, b) - 设置文本颜色
  16. // 6. setFontSize(size) - 设置字体大小
  17. // 7. setBackgroundColor(r, g, b) - 设置背景颜色
  18. // 8. setWidth(width) - 设置控件宽度
  19. // 9. setHeight(height) - 设置控件高度
  20. // 10. setPlaceholder(text) - 设置占位提示文本
  21. // 11. setTextAlignment(align) - 设置文本对齐方式
  22. // 12. setInputStyle(isLineStyle) - 设置输入框样式
  23. // =============================================================================

  24. printl("=== Input输入框控件全新系统化示例启动 ===");

  25. // 创建TabView主容器
  26. var tab = new TabView();

  27. // 设置Tab页面标题
  28. var tabTitles = [
  29.     "基础",
  30.     "样式",
  31.     "高级",
  32.     "综合",
  33.     "关于"
  34. ];
  35. tab.setTitles(tabTitles);

  36. // 显示TabView并初始化所有页面
  37. tab.show(function() {
  38.     // 构建各个页面
  39.     buildBasicPage();
  40.     buildStylePage();
  41.     buildAdvancedPage();
  42.     buildApplicationPage();
  43.     buildAboutPage();
  44. });

  45. // =============================================================================
  46. // 第一页:基础方法演示
  47. // =============================================================================
  48. function buildBasicPage() {
  49.     var page = new Vertical();
  50.     page.setSpacing(0);
  51.     page.setBackgroundColor(245, 245, 250);

  52.     // 方法1:setText - 设置文本
  53.     var section1 = createMethodSection(
  54.         "方法1:setText",
  55.         "设置输入框的文本内容",
  56.         "input.setText(\"Hello World\");"
  57.     );
  58.    
  59.     var input1 = new Input();
  60.     input1.setText("预设的文本内容");
  61.     input1.setWidth(280);
  62.     input1.setHeight(42);
  63.     input1.setBackgroundColor(255, 255, 255);
  64.     section1.addView(input1);
  65.    
  66.     var btn1 = createActionButton("修改文本", function() {
  67.         input1.setText("文本已被修改!");
  68.         printl("setText方法演示:文本已修改");
  69.     });
  70.     section1.addView(btn1);
  71.     page.addView(section1);
  72.    
  73.     // 方法2:getText - 获取文本
  74.     var section2 = createMethodSection(
  75.         "方法2:getText",
  76.         "获取输入框当前文本内容",
  77.         "var text = input.getText();"
  78.     );
  79.    
  80.     var input2 = new Input();
  81.     input2.setPlaceholder("在此输入内容后点击获取");
  82.     input2.setWidth(280);
  83.     input2.setHeight(42);
  84.     input2.setBackgroundColor(255, 255, 255);
  85.     section2.addView(input2);
  86.    
  87.     var resultLabel2 = createResultLabel("等待获取...");
  88.    
  89.     var btn2 = createActionButton("获取文本", function() {
  90.         var text = input2.getText();
  91.         resultLabel2.setText("获取结果: \"" + text + "\"");
  92.         printl("getText方法演示:获取到文本 \"" + text + "\"");
  93.     });
  94.     section2.addView(btn2);
  95.     section2.addView(resultLabel2);
  96.     page.addView(section2);
  97.    
  98.     // 方法3:setID - 设置控件ID
  99.     var section3 = createMethodSection(
  100.         "方法3:setID",
  101.         "设置控件唯一标识符,用于配置存储",
  102.         "input.setID(\"username\");"
  103.     );
  104.    
  105.     var input3 = new Input();
  106.     input3.setID("demo_input_id");
  107.     input3.setPlaceholder("已设置ID: demo_input_id");
  108.     input3.setWidth(280);
  109.     input3.setHeight(42);
  110.     input3.setBackgroundColor(255, 255, 255);
  111.     section3.addView(input3);
  112.    
  113.     var btn3 = createActionButton("读取配置", function() {
  114.         var configValue = config.getConfig("demo_input_id");
  115.         printl("setID方法演示:从config读取到值 \"" + configValue + "\"");
  116.     });
  117.     section3.addView(btn3);
  118.     page.addView(section3);
  119.    
  120.     // 方法4:setDefultText - 设置默认文本
  121.     var section4 = createMethodSection(
  122.         "方法4:setDefultText",
  123.         "设置输入框的默认文本值",
  124.         "input.setDefultText(\"默认值\");"
  125.     );
  126.    
  127.     var input4 = new Input();
  128.     input4.setID("default_text_demo");
  129.     input4.setDefultText("这是默认文本");
  130.     input4.setWidth(280);
  131.     input4.setHeight(42);
  132.     input4.setBackgroundColor(255, 255, 255);
  133.     section4.addView(input4);
  134.    
  135.     var infoLabel4 = createInfoLabel("配合setID使用,可通过config保存/读取默认值");
  136.     section4.addView(infoLabel4);
  137.     page.addView(section4);
  138.    
  139.     // 添加到TabView
  140.     tab.addView(0, page);
  141.     printl("基础方法页面构建完成");
  142. }

  143. // =============================================================================
  144. // 第二页:样式设置演示
  145. // =============================================================================
  146. function buildStylePage() {
  147.     var page = new Vertical();
  148.     page.setSpacing(0);
  149.     page.setBackgroundColor(250, 245, 245);

  150.     // 方法5:setTextColor - 文本颜色
  151.     var section5 = createMethodSection(
  152.         "方法5:setTextColor",
  153.         "设置输入框文本颜色 (R, G, B)",
  154.         "input.setTextColor(255, 0, 0); // 红色"
  155.     );
  156.    
  157.     var colorContainer = new Horizontal();
  158.     colorContainer.setSpacing(10);
  159.    
  160.     var redInput = new Input();
  161.     redInput.setText("红色文本");
  162.     redInput.setTextColor(255, 0, 0);
  163.     redInput.setWidth(85);
  164.     redInput.setHeight(40);
  165.     redInput.setBackgroundColor(255, 235, 235);
  166.     colorContainer.addView(redInput);
  167.    
  168.     var greenInput = new Input();
  169.     greenInput.setText("绿色文本");
  170.     greenInput.setTextColor(0, 150, 0);
  171.     greenInput.setWidth(85);
  172.     greenInput.setHeight(40);
  173.     greenInput.setBackgroundColor(235, 255, 235);
  174.     colorContainer.addView(greenInput);
  175.    
  176.     var blueInput = new Input();
  177.     blueInput.setText("蓝色文本");
  178.     blueInput.setTextColor(0, 100, 255);
  179.     blueInput.setWidth(85);
  180.     blueInput.setHeight(40);
  181.     blueInput.setBackgroundColor(235, 235, 255);
  182.     colorContainer.addView(blueInput);
  183.    
  184.     section5.addView(colorContainer);
  185.     page.addView(section5);
  186.    
  187.     // 方法6:setFontSize - 字体大小
  188.     var section6 = createMethodSection(
  189.         "方法6:setFontSize",
  190.         "设置输入框字体大小",
  191.         "input.setFontSize(18);"
  192.     );
  193.    
  194.     var fontContainer = new Vertical();
  195.     fontContainer.setSpacing(8);
  196.    
  197.     var smallInput = new Input();
  198.     smallInput.setText("小字体 (12px)");
  199.     smallInput.setFontSize(12);
  200.     smallInput.setWidth(280);
  201.     smallInput.setHeight(35);
  202.     smallInput.setBackgroundColor(255, 255, 255);
  203.     fontContainer.addView(smallInput);
  204.    
  205.     var mediumInput = new Input();
  206.     mediumInput.setText("中字体 (16px)");
  207.     mediumInput.setFontSize(16);
  208.     mediumInput.setWidth(280);
  209.     mediumInput.setHeight(40);
  210.     mediumInput.setBackgroundColor(255, 255, 255);
  211.     fontContainer.addView(mediumInput);
  212.    
  213.     var largeInput = new Input();
  214.     largeInput.setText("大字体 (20px)");
  215.     largeInput.setFontSize(20);
  216.     largeInput.setWidth(280);
  217.     largeInput.setHeight(45);
  218.     largeInput.setBackgroundColor(255, 255, 255);
  219.     fontContainer.addView(largeInput);
  220.    
  221.     section6.addView(fontContainer);
  222.     page.addView(section6);
  223.    
  224.     // 方法7:setBackgroundColor - 背景颜色
  225.     var section7 = createMethodSection(
  226.         "方法7:setBackgroundColor",
  227.         "设置输入框背景颜色",
  228.         "input.setBackgroundColor(240, 240, 240);"
  229.     );
  230.    
  231.     var bgContainer = new Horizontal();
  232.     bgContainer.setSpacing(10);
  233.    
  234.     var yellowBg = new Input();
  235.     yellowBg.setText("黄色背景");
  236.     yellowBg.setWidth(85);
  237.     yellowBg.setHeight(40);
  238.     yellowBg.setBackgroundColor(255, 255, 200);
  239.     bgContainer.addView(yellowBg);
  240.    
  241.     var cyanBg = new Input();
  242.     cyanBg.setText("青色背景");
  243.     cyanBg.setWidth(85);
  244.     cyanBg.setHeight(40);
  245.     cyanBg.setBackgroundColor(200, 255, 255);
  246.     bgContainer.addView(cyanBg);
  247.    
  248.     var pinkBg = new Input();
  249.     pinkBg.setText("粉色背景");
  250.     pinkBg.setWidth(85);
  251.     pinkBg.setHeight(40);
  252.     pinkBg.setBackgroundColor(255, 220, 230);
  253.     bgContainer.addView(pinkBg);
  254.    
  255.     section7.addView(bgContainer);
  256.     page.addView(section7);
  257.    
  258.     // 方法8&9:setWidth & setHeight - 尺寸设置
  259.     var section8 = createMethodSection(
  260.         "方法8&9:setWidth & setHeight",
  261.         "设置输入框的宽度和高度",
  262.         "input.setWidth(300);\ninput.setHeight(50);"
  263.     );
  264.    
  265.     var sizeContainer = new Vertical();
  266.     sizeContainer.setSpacing(8);
  267.    
  268.     var smallSize = new Input();
  269.     smallSize.setText("小尺寸 (200x35)");
  270.     smallSize.setWidth(200);
  271.     smallSize.setHeight(35);
  272.     smallSize.setBackgroundColor(255, 255, 255);
  273.     sizeContainer.addView(smallSize);
  274.    
  275.     var mediumSize = new Input();
  276.     mediumSize.setText("中尺寸 (250x42)");
  277.     mediumSize.setWidth(250);
  278.     mediumSize.setHeight(42);
  279.     mediumSize.setBackgroundColor(255, 255, 255);
  280.     sizeContainer.addView(mediumSize);
  281.    
  282.     var largeSize = new Input();
  283.     largeSize.setText("大尺寸 (300x50)");
  284.     largeSize.setWidth(300);
  285.     largeSize.setHeight(50);
  286.     largeSize.setBackgroundColor(255, 255, 255);
  287.     sizeContainer.addView(largeSize);
  288.    
  289.     section8.addView(sizeContainer);
  290.     page.addView(section8);
  291.    
  292.     // 添加到TabView
  293.     tab.addView(1, page);
  294.     printl("样式设置页面构建完成");
  295. }

  296. // =============================================================================
  297. // 第三页:高级功能演示
  298. // =============================================================================
  299. function buildAdvancedPage() {
  300.     var page = new Vertical();
  301.     page.setSpacing(0);
  302.     page.setBackgroundColor(245, 250, 245);

  303.     // 方法10:setPlaceholder - 占位符
  304.     var section10 = createMethodSection(
  305.         "方法10:setPlaceholder",
  306.         "设置占位提示文本(输入框为空时显示)",
  307.         "input.setPlaceholder(\"请输入用户名...\");"
  308.     );
  309.    
  310.     var placeholderInput = new Input();
  311.     placeholderInput.setPlaceholder("这是一个占位提示文本...");
  312.     placeholderInput.setWidth(280);
  313.     placeholderInput.setHeight(42);
  314.     placeholderInput.setBackgroundColor(255, 255, 255);
  315.     section10.addView(placeholderInput);
  316.     page.addView(section10);
  317.    
  318.     // 方法11:setTextAlignment - 文本对齐
  319.     var section11 = createMethodSection(
  320.         "方法11:setTextAlignment",
  321.         "设置文本对齐方式 (left/center/right)",
  322.         "input.setTextAlignment(\"center\");"
  323.     );
  324.    
  325.     var alignContainer = new Vertical();
  326.     alignContainer.setSpacing(8);
  327.    
  328.     var leftAlign = new Input();
  329.     leftAlign.setText("左对齐 (left)");
  330.     leftAlign.setTextAlignment("left");
  331.     leftAlign.setWidth(280);
  332.     leftAlign.setHeight(40);
  333.     leftAlign.setBackgroundColor(255, 240, 240);
  334.     alignContainer.addView(leftAlign);
  335.    
  336.     var centerAlign = new Input();
  337.     centerAlign.setText("居中对齐 (center)");
  338.     centerAlign.setTextAlignment("center");
  339.     centerAlign.setWidth(280);
  340.     centerAlign.setHeight(40);
  341.     centerAlign.setBackgroundColor(240, 255, 240);
  342.     alignContainer.addView(centerAlign);
  343.    
  344.     var rightAlign = new Input();
  345.     rightAlign.setText("右对齐 (right)");
  346.     rightAlign.setTextAlignment("right");
  347.     rightAlign.setWidth(280);
  348.     rightAlign.setHeight(40);
  349.     rightAlign.setBackgroundColor(240, 240, 255);
  350.     alignContainer.addView(rightAlign);
  351.    
  352.     section11.addView(alignContainer);
  353.     page.addView(section11);
  354.    
  355.     // 方法12:setInputStyle - 输入框样式
  356.     var section12 = createMethodSection(
  357.         "方法12:setInputStyle",
  358.         "设置输入框样式 (true=底部线条样式)",
  359.         "input.setInputStyle(true); // 底部线条样式"
  360.     );
  361.    
  362.     var styleContainer = new Vertical();
  363.     styleContainer.setSpacing(15);
  364.    
  365.     var normalStyle = new Input();
  366.     normalStyle.setText("普通样式 (默认)");
  367.     normalStyle.setWidth(280);
  368.     normalStyle.setHeight(42);
  369.     normalStyle.setBackgroundColor(255, 255, 255);
  370.     styleContainer.addView(normalStyle);
  371.    
  372.     var lineStyle = new Input();
  373.     lineStyle.setText("底部线条样式");
  374.     lineStyle.setInputStyle(true);
  375.     lineStyle.setWidth(280);
  376.     lineStyle.setHeight(42);
  377.     styleContainer.addView(lineStyle);
  378.    
  379.     section12.addView(styleContainer);
  380.     page.addView(section12);
  381.    
  382.     // 动态样式切换演示
  383.     var sectionDynamic = createMethodSection(
  384.         "动态样式切换",
  385.         "实时修改输入框的各种属性",
  386.         "通过按钮交互动态改变样式"
  387.     );
  388.    
  389.     var dynamicInput = new Input();
  390.     dynamicInput.setText("动态样式输入框");
  391.     dynamicInput.setWidth(280);
  392.     dynamicInput.setHeight(45);
  393.     dynamicInput.setBackgroundColor(255, 255, 255);
  394.     sectionDynamic.addView(dynamicInput);
  395.    
  396.     var btnContainer = new Horizontal();
  397.     btnContainer.setSpacing(8);
  398.    
  399.     var colorBtn = createSmallButton("变色", function() {
  400.         var colors = [
  401.             [255, 200, 200], [200, 255, 200], [200, 200, 255],
  402.             [255, 255, 200], [255, 200, 255], [200, 255, 255]
  403.         ];
  404.         var randomColor = colors[Math.floor(Math.random() * colors.length)];
  405.         dynamicInput.setBackgroundColor(randomColor[0], randomColor[1], randomColor[2]);
  406.         printl("动态样式:背景色已变更");
  407.     });
  408.     btnContainer.addView(colorBtn);
  409.    
  410.     var alignBtn = createSmallButton("切换对齐", function() {
  411.         var aligns = ["left", "center", "right"];
  412.         var currentText = dynamicInput.getText();
  413.         var currentAlign = "left";
  414.         if (currentText.indexOf("居中") !== -1) currentAlign = "center";
  415.         if (currentText.indexOf("右对齐") !== -1) currentAlign = "right";
  416.         
  417.         var nextIndex = (aligns.indexOf(currentAlign) + 1) % 3;
  418.         var nextAlign = aligns[nextIndex];
  419.         
  420.         var alignLabels = { "left": "左对齐", "center": "居中对齐", "right": "右对齐" };
  421.         dynamicInput.setText(alignLabels[nextAlign]);
  422.         dynamicInput.setTextAlignment(nextAlign);
  423.         printl("动态样式:对齐方式已切换为 " + nextAlign);
  424.     });
  425.     btnContainer.addView(alignBtn);
  426.    
  427.     var sizeBtn = createSmallButton("调整大小", function() {
  428.         var sizes = [[200, 35], [250, 42], [300, 50]];
  429.         var currentWidth = dynamicInput.getWidth ? 250 : 250; // 默认中尺寸
  430.         var nextSize = sizes[Math.floor(Math.random() * sizes.length)];
  431.         dynamicInput.setWidth(nextSize[0]);
  432.         dynamicInput.setHeight(nextSize[1]);
  433.         printl("动态样式:尺寸已调整为 " + nextSize[0] + "x" + nextSize[1]);
  434.     });
  435.     btnContainer.addView(sizeBtn);
  436.    
  437.     sectionDynamic.addView(btnContainer);
  438.     page.addView(sectionDynamic);
  439.    
  440.     // 添加到TabView
  441.     tab.addView(2, page);
  442.     printl("高级功能页面构建完成");
  443. }

  444. // =============================================================================
  445. // 第四页:综合应用演示
  446. // =============================================================================
  447. function buildApplicationPage() {
  448.     var page = new Vertical();
  449.     page.setSpacing(0);
  450.     page.setBackgroundColor(250, 250, 245);

  451.     // 应用场景1:登录表单
  452.     var loginSection = createAppSection("场景1:用户登录表单");
  453.    
  454.     // 用户名输入
  455.     var usernameLabel = new Label();
  456.     usernameLabel.setText("用户名:");
  457.     usernameLabel.setFontSize(14);
  458.     usernameLabel.setTextColor(60, 60, 60);
  459.     loginSection.addView(usernameLabel);
  460.    
  461.     var usernameInput = new Input();
  462.     usernameInput.setID("login_username");
  463.     usernameInput.setPlaceholder("请输入用户名");
  464.     usernameInput.setWidth(280);
  465.     usernameInput.setHeight(42);
  466.     usernameInput.setBackgroundColor(255, 255, 255);
  467.     usernameInput.setTextColor(50, 50, 50);
  468.     loginSection.addView(usernameInput);
  469.    
  470.     // 密码输入
  471.     var passwordLabel = new Label();
  472.     passwordLabel.setText("密码:");
  473.     passwordLabel.setFontSize(14);
  474.     passwordLabel.setTextColor(60, 60, 60);
  475.     loginSection.addView(passwordLabel);
  476.    
  477.     var passwordInput = new Input();
  478.     passwordInput.setID("login_password");
  479.     passwordInput.setPlaceholder("请输入密码");
  480.     passwordInput.setWidth(280);
  481.     passwordInput.setHeight(42);
  482.     passwordInput.setBackgroundColor(255, 255, 255);
  483.     passwordInput.setInputStyle(true); // 使用底部线条样式
  484.     loginSection.addView(passwordInput);
  485.    
  486.     // 登录结果标签
  487.     var loginResult = createResultLabel("等待操作...");
  488.     loginSection.addView(loginResult);
  489.    
  490.     // 按钮区域
  491.     var loginBtnContainer = new Horizontal();
  492.     loginBtnContainer.setSpacing(15);
  493.    
  494.     var loginBtn = createActionButton("登录", function() {
  495.         var username = usernameInput.getText();
  496.         var password = passwordInput.getText();
  497.         
  498.         if (username === "" || password === "") {
  499.             loginResult.setText("❌ 请填写完整信息!");
  500.             loginResult.setTextColor(255, 0, 0);
  501.         } else {
  502.             loginResult.setText("✅ 登录成功!欢迎 " + username);
  503.             loginResult.setTextColor(0, 150, 0);
  504.             printl("登录演示:用户名=" + username + ", 密码长度=" + password.length);
  505.         }
  506.     });
  507.     loginBtnContainer.addView(loginBtn);
  508.    
  509.     var resetBtn = createSecondaryButton("重置", function() {
  510.         usernameInput.setText("");
  511.         passwordInput.setText("");
  512.         loginResult.setText("已重置,请重新输入");
  513.         loginResult.setTextColor(100, 100, 100);
  514.         printl("登录演示:表单已重置");
  515.     });
  516.     loginBtnContainer.addView(resetBtn);
  517.    
  518.     loginSection.addView(loginBtnContainer);
  519.     page.addView(loginSection);
  520.    
  521.     // 应用场景2:个人信息编辑
  522.     var profileSection = createAppSection("场景2:个人信息编辑");
  523.    
  524.     // 昵称
  525.     var nicknameRow = createInputRow("昵称", "nickname_field", "请输入昵称");
  526.     profileSection.addView(nicknameRow);
  527.    
  528.     // 邮箱
  529.     var emailRow = createInputRow("邮箱", "email_field", "请输入邮箱地址");
  530.     profileSection.addView(emailRow);
  531.    
  532.     // 电话
  533.     var phoneRow = createInputRow("电话", "phone_field", "请输入电话号码");
  534.     profileSection.addView(phoneRow);
  535.    
  536.     // 保存按钮
  537.     var saveBtn = createActionButton("保存信息", function() {
  538.         var nickname = config.getConfig("nickname_field");
  539.         var email = config.getConfig("email_field");
  540.         var phone = config.getConfig("phone_field");
  541.         
  542.         printl("保存信息:昵称=" + nickname + ", 邮箱=" + email + ", 电话=" + phone);
  543.         
  544.         var saveResult = createResultLabel("✅ 信息已保存到配置!");
  545.         saveResult.setTextColor(0, 150, 0);
  546.         profileSection.addView(saveResult);
  547.         
  548.         // 3秒后移除结果提示
  549.         sleep(3000);
  550.         // 注意:实际应用中可能需要使用定时器
  551.     });
  552.     profileSection.addView(saveBtn);
  553.    
  554.     page.addView(profileSection);
  555.    
  556.     // 应用场景3:搜索功能
  557.     var searchSection = createAppSection("场景3:搜索功能");
  558.    
  559.     var searchContainer = new Horizontal();
  560.     searchContainer.setSpacing(10);
  561.    
  562.     var searchInput = new Input();
  563.     searchInput.setPlaceholder("请输入搜索关键词...");
  564.     searchInput.setWidth(200);
  565.     searchInput.setHeight(42);
  566.     searchInput.setBackgroundColor(255, 255, 255);
  567.     searchInput.setTextAlignment("left");
  568.     searchContainer.addView(searchInput);
  569.    
  570.     var searchBtn = new Button();
  571.     searchBtn.setText("🔍 搜索");
  572.     searchBtn.setColor(0, 122, 255);
  573.     searchBtn.setTextColor(255, 255, 255);
  574.     searchBtn.setWidth(80);
  575.     searchBtn.setHeight(42);
  576.    
  577.     var searchResult = createResultLabel("输入关键词后点击搜索");
  578.    
  579.     searchBtn.onClick(function() {
  580.         var keyword = searchInput.getText();
  581.         if (keyword === "") {
  582.             searchResult.setText("⚠️ 请输入搜索关键词");
  583.             searchResult.setTextColor(255, 150, 0);
  584.         } else {
  585.             searchResult.setText("🔍 正在搜索: \"" + keyword + "\"...");
  586.             searchResult.setTextColor(0, 100, 200);
  587.             printl("搜索演示:关键词=\"" + keyword + "\"");
  588.         }
  589.     });
  590.     searchContainer.addView(searchBtn);
  591.    
  592.     searchSection.addView(searchContainer);
  593.     searchSection.addView(searchResult);
  594.     page.addView(searchSection);
  595.    
  596.     // 添加到TabView
  597.     tab.addView(3, page);
  598.     printl("综合应用页面构建完成");
  599. }

  600. // =============================================================================
  601. // 第五页:关于页面
  602. // =============================================================================
  603. function buildAboutPage() {
  604.     var page = new Vertical();
  605.     page.setSpacing(0);
  606.     page.setBackgroundColor(240, 248, 255);
  607.     page.setAlignment("center");

  608.     // 应用图标区域(使用Label模拟)
  609.     var iconLabel = new Label();
  610.     iconLabel.setText("⌨️");
  611.     iconLabel.setFontSize(40);
  612.     page.addView(iconLabel);
  613.    
  614.     // 标题
  615.     var appTitle = new Label();
  616.     appTitle.setText("Input控件系统化示例");
  617.     appTitle.setFontSize(22);
  618.     appTitle.setTextColor(0, 100, 150);
  619.     appTitle.setTextAlignment("center");
  620.     page.addView(appTitle);
  621.    
  622.     // 版本信息
  623.     var versionLabel = new Label();
  624.     versionLabel.setText("版本: 2.0.0");
  625.     versionLabel.setFontSize(14);
  626.     versionLabel.setTextColor(100, 100, 100);
  627.     versionLabel.setTextAlignment("center");
  628.     page.addView(versionLabel);
  629.    
  630.     // 分隔线
  631.     var line = new Label();
  632.     line.setText("━━━━━━━━━━━━━━━━");
  633.     line.setTextAlignment("center");
  634.     line.setTextColor(200, 200, 200);
  635.     page.addView(line);
  636.    
  637.     // 方法列表
  638.     var methodListLabel = new Label();
  639.     methodListLabel.setText("📋 Input控件方法清单");
  640.     methodListLabel.setFontSize(16);
  641.     methodListLabel.setTextColor(50, 50, 50);
  642.     methodListLabel.setTextAlignment("center");
  643.     page.addView(methodListLabel);
  644.    
  645.     var methodsInfo = new Label();
  646.     methodsInfo.setText(
  647.         "1. setText(text) - 设置文本\n" +
  648.         "2. getText() - 获取文本\n" +
  649.         "3. setID(id) - 设置控件ID\n" +
  650.         "4. setDefultText(text) - 设置默认文本\n" +
  651.         "5. setTextColor(r,g,b) - 设置文本颜色\n" +
  652.         "6. setFontSize(size) - 设置字体大小\n" +
  653.         "7. setBackgroundColor(r,g,b) - 设置背景色\n" +
  654.         "8. setWidth(width) - 设置宽度\n" +
  655.         "9. setHeight(height) - 设置高度\n" +
  656.         "10. setPlaceholder(text) - 设置占位符\n" +
  657.         "11. setTextAlignment(align) - 设置对齐\n" +
  658.         "12. setInputStyle(bool) - 设置样式"
  659.     );
  660.     methodsInfo.setFontSize(11);
  661.     methodsInfo.setTextColor(80, 80, 80);
  662.     methodsInfo.setTextAlignment("left");
  663.     methodsInfo.setBackgroundColor(255, 255, 255);
  664.     methodsInfo.setWidth(300);
  665.     methodsInfo.setHeight(180);
  666.     page.addView(methodsInfo);
  667.    
  668.     // 分隔线
  669.     var line2 = new Label();
  670.     line2.setText("━━━━━━━━━━━━━━━━");
  671.     line2.setTextAlignment("center");
  672.     line2.setTextColor(200, 200, 200);
  673.     page.addView(line2);
  674.    

  675.    
  676.     // 退出按钮
  677.     var exitBtn = new Button();
  678.     exitBtn.setText("退出示例");
  679.     exitBtn.setColor(255, 59, 48);
  680.     exitBtn.setTextColor(255, 255, 255);
  681.     exitBtn.setWidth(150);
  682.     exitBtn.setHeight(45);
  683.     exitBtn.onClick(function() {
  684.         printl("用户退出示例");
  685.         tab.dismiss();
  686.     });
  687.     page.addView(exitBtn);
  688.    
  689.     // 添加到TabView
  690.     tab.addView(4, page);
  691.     printl("关于页面构建完成");
  692. }

  693. // =============================================================================
  694. // 辅助函数 - UI组件创建
  695. // =============================================================================

  696. // 创建章节标题
  697. function createSectionTitle(text) {
  698.     var title = new Label();
  699.     title.setText(text);
  700.     title.setFontSize(18);
  701.     title.setTextColor(0, 100, 150);
  702.     title.setTextAlignment("center");
  703.     title.setWidth(350);
  704.     title.setHeight(30);
  705.     return title;
  706. }

  707. // 创建方法演示区块
  708. function createMethodSection(methodName, description, codeExample) {
  709.     var section = new Vertical();
  710.     section.setSpacing(0);
  711.     section.setBackgroundColor(255, 255, 255);
  712.    
  713.     // 方法名称
  714.     var nameLabel = new Label();
  715.     nameLabel.setText(methodName);
  716.     nameLabel.setFontSize(15);
  717.     nameLabel.setTextColor(0, 122, 255);
  718.     nameLabel.setTextAlignment("left");
  719.     section.addView(nameLabel);
  720.    
  721.     // 方法描述
  722.     var descLabel = new Label();
  723.     descLabel.setText(description);
  724.     descLabel.setFontSize(12);
  725.     descLabel.setTextColor(80, 80, 80);
  726.     section.addView(descLabel);
  727.    
  728.     // 代码示例
  729.     var codeLabel = new Label();
  730.     codeLabel.setText(codeExample);
  731.     codeLabel.setFontSize(11);
  732.     codeLabel.setTextColor(50, 50, 150);
  733.     codeLabel.setBackgroundColor(245, 245, 255);
  734.     codeLabel.setWidth(280);
  735.     codeLabel.setHeight(35);
  736.     section.addView(codeLabel);
  737.    
  738.     return section;
  739. }

  740. // 创建应用场景区块
  741. function createAppSection(title) {
  742.     var section = new Vertical();
  743.     section.setSpacing(2);
  744.     section.setBackgroundColor(255, 255, 255);
  745.    
  746.     var titleLabel = new Label();
  747.     titleLabel.setText(title);
  748.     titleLabel.setFontSize(16);
  749.     titleLabel.setTextColor(80, 80, 80);
  750.     section.addView(titleLabel);
  751.    
  752.     return section;
  753. }

  754. // 创建输入行(标签+输入框)
  755. function createInputRow(labelText, inputId, placeholder) {
  756.     var row = new Vertical();
  757.     row.setSpacing(5);
  758.    
  759.     var label = new Label();
  760.     label.setText(labelText + ":");
  761.     label.setFontSize(13);
  762.     label.setTextColor(60, 60, 60);
  763.     row.addView(label);
  764.    
  765.     var input = new Input();
  766.     input.setID(inputId);
  767.     input.setPlaceholder(placeholder);
  768.     input.setWidth(280);
  769.     input.setHeight(40);
  770.     input.setBackgroundColor(250, 250, 250);
  771.     row.addView(input);
  772.    
  773.     return row;
  774. }

  775. // 创建操作按钮
  776. function createActionButton(text, onClickHandler) {
  777.     var btn = new Button();
  778.     btn.setText(text);
  779.     btn.setColor(0, 122, 255);
  780.     btn.setTextColor(255, 255, 255);
  781.     btn.setWidth(120);
  782.     btn.setHeight(40);
  783.     btn.onClick(onClickHandler);
  784.     return btn;
  785. }

  786. // 创建次要按钮
  787. function createSecondaryButton(text, onClickHandler) {
  788.     var btn = new Button();
  789.     btn.setText(text);
  790.     btn.setColor(150, 150, 150);
  791.     btn.setTextColor(255, 255, 255);
  792.     btn.setWidth(100);
  793.     btn.setHeight(40);
  794.     btn.onClick(onClickHandler);
  795.     return btn;
  796. }

  797. // 创建小按钮
  798. function createSmallButton(text, onClickHandler) {
  799.     var btn = new Button();
  800.     btn.setText(text);
  801.     btn.setColor(100, 150, 200);
  802.     btn.setTextColor(255, 255, 255);
  803.     btn.setWidth(85);
  804.     btn.setHeight(35);
  805.     btn.onClick(onClickHandler);
  806.     return btn;
  807. }

  808. // 创建结果标签
  809. function createResultLabel(text) {
  810.     var label = new Label();
  811.     label.setText(text);
  812.     label.setFontSize(12);
  813.     label.setTextColor(100, 100, 100);
  814.     label.setBackgroundColor(245, 245, 245);
  815.     label.setWidth(280);
  816.     label.setHeight(30);
  817.     return label;
  818. }

  819. // 创建信息标签
  820. function createInfoLabel(text) {
  821.     var label = new Label();
  822.     label.setText(text);
  823.     label.setFontSize(11);
  824.     label.setTextColor(120, 120, 120);
  825.     label.setTextAlignment("center");
  826.     return label;
  827. }

  828. // =============================================================================
  829. // 程序入口
  830. // =============================================================================
  831. printl("=== Input控件全新系统化示例已启动 ===");
  832. printl("本示例包含5个Tab页面,全面展示Input控件的12个方法");
复制代码



untoAIWROK苹果脚本实例1界面UI输入框类[Input]nextnocontent
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关导读了
    采集亚马逊正版群发工具有没有?
    Apr.20旅行X心语今天来说说YYPOST新功能的一个灵活用法,采集亚马逊商品信息,并且获得排名的软件,亚马逊现在越来越多客户做,淘宝的水是越来越清了,以前做电商的客户,现在都转战到外国,最赚钱的要数一些客户往亚马逊里堆了吧,拿我这个YYPOST的客户,最多的是采集,分析排名,刷价格,刷数量,改价,刷访问量等等技术

    企业发展B2B网站有什么东东软件可以发呢
    标题企业发展网B2B软件,现在虽然B2B网站收录不错,可愁的是心急的人们,他们太想一口吃撑胖子了,发帖宣传虽然不能像佛系那样淡定,但也不能像跑火车那般急躁对待,自己内容不收录,完全是自己操作内容问题,可以参考一下别人的内容是怎么弄的,然后自己要试着转变,而且收录这个内容,常常会变化的,不是一种规则就吃到老

    搜房天下房聊软件哪一个好呢
    本帖最后由 发帖软件 于 2019-5-22 16:15 编辑 2搜房天下群发房聊信息软件,开始本来打算做58同城的,但发一个就要一次点触验证码,这就让人没有感觉到存在的价值了吧,都是卖二手房和新房的搜房天下倒是可以发即时聊天信息,也没有发现他这个网站有啥子限制,登陆一个搜房天下账号,然后采集回来分类列表的网址,然后就一

    大家坛有没有好用的群发工具下载呢
    当你的笑容给我礼貌的招呼,大家坛全自动发帖软件,宣传推广是一场持久战,总是有一些人把软件用了一天,或是几个小时,就觉得自己付出太多了,那加进来的粉丝,或是流量,应该是和宣传多少成正比的,其实没有这么便宜的事,就像很多阅读量超过一百万的视频,或是电影,真正会在屏幕打赏的人不会超过三千,真正大额打赏给主

    群发正版软件中国塑料网
    中国塑料网群发软件YYPOST脚本下载地址,这个网站会有一个很奇怪的问题就是你在首页登陆无半个验证码,但在登陆网址登陆就会有一个验证码,所以我们灵活一些,在首页登陆就不用输入验证码了哈。网站秒收录比较高,但发的都是五金和建筑行业,先前有很多人都是发土建工程的大公司操作的,现在这个网站专为那个行业诞生的吧。

    OpenStreetMap网站正版2019年发帖工具下载
    本帖最后由 发帖软件 于 2019-5-21 11:13 编辑 OpenStreetMap网站全自动群发,OpenStreetMapOpenStreetMap(简称OSM,中文是公开地图)是一个网上地图协作计划,目标是创造一个内容自由且能让所有人编辑的世界地图。有的人编辑地图然后等收录,有的人发日志等收录,我们这里也是利用地图日志做为宣传的目标,简单的脚本理

    搜房天下全自动收短信全自动识别验证码注册账号软件
    房天下自动注册机,这个脚本是前几天发房聊的脚本廷伸品种,这个脚本能做到自动注册账号,自动保存账号,自动发房聊的效果,不过今天我们主要说一说怎么注册账号写脚本吧,这个搜房天天下的账号,可以发提问,可以发房聊,发论坛,发博客,还有发个人中心页都是有秒收的效果的,这样就省去了去买号,去乱花钱的效果了吧,而

    企业邮箱安卓端有什么APP软件可以发的呢
    请输入标题企业邮箱安卓发发送邮箱脚本,这个脚本是利用企业邮箱进行群发的,全程是一种模拟手工操作的过程,所以封号是很少的,而且企业邮箱群发到普通QQ邮箱不容易进垃圾箱中的,所以这个脚本也是这样的原理,不过最好是利用一些多开器,登陆多点的QQ邮箱账号会比较流畅一些,然后用软件一个一个的切换APP进行群发邮件会

    头条留评论软件有没有好用的呢?
    今天整一个今日头条留言软件,对于留言YYPOST是优势是比较大的存在,因为他往往专注一些下拉定位的优点,像今日头条这样,还是需要一些特殊下拉定位的,因为他新闻有长有短,有图有视频的,所以综合起来定位是比较难的,如果用POST也不是很轻松可以破解他的加密参数。这个脚本也是有一个不好的地方就是换号会比较麻烦,您电

    单网页生成神器
    最近新技术,网页生成机占领了整个网络的半壁江山,效果很疯狂,虽然不知道能持续多久,作为开发软件的领头者,一直在找收录的方法,一直在努力创新着,一直被人模仿,却从没有被超越过,这个网页生成机,已经出来有一段时间了,一直没有拿出来分享,醉过醉过,它是利用的一些小小收录漏洞整的,您最好用一些老站域名,进行

关闭
快速回复 返回列表 返回顶部
本站自动发贴软件,是现在最流行的做脚本软件,这种发贴工具,不但发贴收录快,而且抢占好的先机,完全自由编辑,实现针对性群发模拟操作,软件可以顶贴,也可以发贴,可以兼容支持Discuz、PHPWind、Dvbbs三大主流论坛,有手机验证码收件,邮件收发的功能,支持验证码识别,注册问题识别,多线程任务,自动上传头像,自动激活注册邮件,兼容防注册插件,本站软件原创正版,更新效率最快的原创软件。 『网络推广软件』『自动发帖软件』『 自动发帖