  |  |   |    | AIWROK软件IOS苹果线条类[Line]方法小结 
                         
- // 第一个方法:📌setWidth - 设置线条宽度
 
 - /*
 
 - 类别 详情说明
 
 - 方法功能 设置线条的宽度
 
 - 方法签名 Void setWidth (Single width)
 
 - 返回值 返回值: Void
 
 - 参数 - Single width:用于指定线条宽度的单精度浮点数参数
 
 - */
 
 - // 示例:设置线条宽度
 
 - var line = new Line ();
 
 - line.setWidth (5.0f); // 设置线条宽度为 5
 
 - // 第二个方法:📌setHeight - 设置线条高度
 
 - /*
 
 - 类别 详情说明
 
 - 方法功能 设置线条的高度
 
 - 方法签名 Void setHeight (Single height)
 
 - 返回值 返回值: Void
 
 - 参数 - Single height:用于指定线条高度的单精度浮点数参数
 
 - */
 
 - // 示例:设置线条高度
 
 - var line = new Line ();
 
 - line.setHeight (2.0f); // 设置线条高度为 2
 
 - // 第三个方法:📌setColor - 设置线条颜色
 
 - /*
 
 - 类别 详情说明
 
 - 方法功能 设置线条的颜色
 
 - 方法签名 Void setColor (Single red, Single green, Single blue)
 
 - 返回值 返回值: Void
 
 - 参数 - Single red:红色通道的单精度浮点数参数
 
 - Single green:绿色通道的单精度浮点数参数
 
 - Single blue:蓝色通道的单精度浮点数参数
 
 - */
 
 - // 示例:设置线条颜色
 
 - var line = new Line ();
 
 - line.setColor (255, 0, 0); // 设置线条颜色为红色
 
  复制代码 . 线条宽度设置方法项目  | 内容  |  功能描述  | 设置线条的宽度  |  方法声明  | Void setWidth(Single width)  |  返回值  | 返回值: Void  |  参数  | Single width :用于指定线条宽度的单精度浮点数参数  |  案例  | csharp<br>var line = new Line();<br>line.setWidth(5.0f); // 设置线条宽度为5<br>  |   2. 线条高度设置方法项目  | 内容  |  功能描述  | 设置线条的高度  |  方法声明  | Void setHeight(Single height)  |  返回值  | 返回值: Void  |  参数  | Single height :用于指定线条高度的单精度浮点数参数  |  案例  | csharp<br>var line = new Line();<br>line.setHeight(2.0f); // 设置线条高度为2<br>  |   3. 线条颜色设置方法项目  | 内容  |  功能描述  | 设置线条的颜色  |  方法声明  | Void setColor(Single red, Single green, Single blue)  |  返回值  | 返回值: Void  |  参数  | - Single red :红色通道的单精度浮点数参数 
- Single green :绿色通道的单精度浮点数参数 
- Single blue :蓝色通道的单精度浮点数参数  |  案例  | csharp<br>var line = new Line();<br>line.setColor(255, 0, 0); // 设置线条颜色为红色<br>  |  
 实用演示例子: - // 🔨🍎UI-Line线条类[Line]方法完整示例
 
 - // UI-Line线条类方法小结,交流QQ群711841924
 
  
- printl("=== Line控件方法完整示例 ===");
 
  
- // 创建视图容器
 
 - var vc = new IOSView();
 
 - vc.show(() => {
 
 -     printl("Line示例界面已加载");
 
 -     
 
 -     // 获取当前视图
 
 -     var view = vc.getView();
 
 -     
 
 -     // 创建主容器
 
 -     var mainContainer = new Vertical();
 
 -     mainContainer.setSpacing(20);
 
 -     mainContainer.setBackgroundColor(245, 245, 245);
 
 -     
 
 -     // 标题区域
 
 -     var titleContainer = new Vertical();
 
 -     titleContainer.setAlignment("center");
 
 -     titleContainer.setSpacing(5);
 
 -     titleContainer.setBackgroundColor(0, 122, 255);
 
 -     
 
 -     var titleLabel = new Label();
 
 -     titleLabel.setText("🔨 Line线条控件演示");
 
 -     titleLabel.setFontSize(20.0);
 
 -     titleLabel.setTextColor(255, 255, 255);
 
 -     titleLabel.setTextAlignment("center");
 
 -     
 
 -     var subtitleLabel = new Label();
 
 -     subtitleLabel.setText("Line控件方法使用示例");
 
 -     subtitleLabel.setFontSize(14.0);
 
 -     subtitleLabel.setTextColor(255, 255, 255);
 
 -     subtitleLabel.setTextAlignment("center");
 
 -     
 
 -     titleContainer.addView(titleLabel);
 
 -     titleContainer.addView(subtitleLabel);
 
 -     mainContainer.addView(titleContainer);
 
 -     
 
 -     // Line方法演示区域
 
 -     var demoContainer = new Vertical();
 
 -     demoContainer.setBackgroundColor(255, 255, 255);
 
 -     demoContainer.setSpacing(15);
 
 -     
 
 -     var demoTitle = new Label();
 
 -     demoTitle.setText("Line控件功能演示");
 
 -     demoTitle.setFontSize(18.0);
 
 -     demoTitle.setTextColor(0, 0, 0);
 
 -     demoTitle.setTextAlignment("center");
 
 -     demoContainer.addView(demoTitle);
 
 -     
 
 -     // 第一个方法:setWidth设置线条宽度演示
 
 -     var widthDemo = new Vertical();
 
 -     widthDemo.setSpacing(10);
 
 -     
 
 -     var widthLabel = new Label();
 
 -     widthLabel.setText("📌 setWidth设置线条宽度");
 
 -     widthLabel.setFontSize(16.0);
 
 -     widthLabel.setTextColor(0, 122, 255);
 
 -     widthDemo.addView(widthLabel);
 
 -     
 
 -     var widthDesc = new Label();
 
 -     widthDesc.setText("创建不同宽度的线条:");
 
 -     widthDesc.setFontSize(14.0);
 
 -     widthDesc.setTextColor(100, 100, 100);
 
 -     widthDemo.addView(widthDesc);
 
 -     
 
 -     // 创建不同宽度的线条示例
 
 -     var line1 = new Line();
 
 -     line1.setWidth(5.0); // 设置线条宽度为 5
 
 -     line1.setHeight(1.0);
 
 -     line1.setColor(255, 0, 0); // 红色线条
 
 -     widthDemo.addView(line1);
 
 -     
 
 -     var lineDesc1 = new Label();
 
 -     lineDesc1.setText("宽度: 5.0");
 
 -     lineDesc1.setFontSize(12.0);
 
 -     lineDesc1.setTextColor(150, 150, 150);
 
 -     widthDemo.addView(lineDesc1);
 
 -     
 
 -     var line2 = new Line();
 
 -     line2.setWidth(10.0); // 设置线条宽度为 10
 
 -     line2.setHeight(1.0);
 
 -     line2.setColor(0, 255, 0); // 绿色线条
 
 -     widthDemo.addView(line2);
 
 -     
 
 -     var lineDesc2 = new Label();
 
 -     lineDesc2.setText("宽度: 10.0");
 
 -     lineDesc2.setFontSize(12.0);
 
 -     lineDesc2.setTextColor(150, 150, 150);
 
 -     widthDemo.addView(lineDesc2);
 
 -     
 
 -     var line3 = new Line();
 
 -     line3.setWidth(15.0); // 设置线条宽度为 15
 
 -     line3.setHeight(1.0);
 
 -     line3.setColor(0, 0, 255); // 蓝色线条
 
 -     widthDemo.addView(line3);
 
 -     
 
 -     var lineDesc3 = new Label();
 
 -     lineDesc3.setText("宽度: 15.0");
 
 -     lineDesc3.setFontSize(12.0);
 
 -     lineDesc3.setTextColor(150, 150, 150);
 
 -     widthDemo.addView(lineDesc3);
 
 -     
 
 -     demoContainer.addView(widthDemo);
 
 -     
 
 -     // 添加分割空间
 
 -     var separator1 = new Space();
 
 -     separator1.setHeight(10.0);
 
 -     demoContainer.addView(separator1);
 
 -     
 
 -     // 第二个方法:setHeight设置线条高度演示
 
 -     var heightDemo = new Vertical();
 
 -     heightDemo.setSpacing(10);
 
 -     
 
 -     var heightLabel = new Label();
 
 -     heightLabel.setText("📌 setHeight设置线条高度");
 
 -     heightLabel.setFontSize(16.0);
 
 -     heightLabel.setTextColor(0, 122, 255);
 
 -     heightDemo.addView(heightLabel);
 
 -     
 
 -     var heightDesc = new Label();
 
 -     heightDesc.setText("创建不同高度的线条:");
 
 -     heightDesc.setFontSize(14.0);
 
 -     heightDesc.setTextColor(100, 100, 100);
 
 -     heightDemo.addView(heightDesc);
 
 -     
 
 -     // 创建不同高度的线条示例
 
 -     var hLine1 = new Line();
 
 -     hLine1.setWidth(200.0);
 
 -     hLine1.setHeight(2.0); // 设置线条高度为 2
 
 -     hLine1.setColor(255, 165, 0); // 橙色线条
 
 -     heightDemo.addView(hLine1);
 
 -     
 
 -     var hLineDesc1 = new Label();
 
 -     hLineDesc1.setText("高度: 2.0");
 
 -     hLineDesc1.setFontSize(12.0);
 
 -     hLineDesc1.setTextColor(150, 150, 150);
 
 -     heightDemo.addView(hLineDesc1);
 
 -     
 
 -     var hLine2 = new Line();
 
 -     hLine2.setWidth(200.0);
 
 -     hLine2.setHeight(5.0); // 设置线条高度为 5
 
 -     hLine2.setColor(128, 0, 128); // 紫色线条
 
 -     heightDemo.addView(hLine2);
 
 -     
 
 -     var hLineDesc2 = new Label();
 
 -     hLineDesc2.setText("高度: 5.0");
 
 -     hLineDesc2.setFontSize(12.0);
 
 -     hLineDesc2.setTextColor(150, 150, 150);
 
 -     heightDemo.addView(hLineDesc2);
 
 -     
 
 -     var hLine3 = new Line();
 
 -     hLine3.setWidth(200.0);
 
 -     hLine3.setHeight(8.0); // 设置线条高度为 8
 
 -     hLine3.setColor(0, 128, 128); // 青色线条
 
 -     heightDemo.addView(hLine3);
 
 -     
 
 -     var hLineDesc3 = new Label();
 
 -     hLineDesc3.setText("高度: 8.0");
 
 -     hLineDesc3.setFontSize(12.0);
 
 -     hLineDesc3.setTextColor(150, 150, 150);
 
 -     heightDemo.addView(hLineDesc3);
 
 -     
 
 -     demoContainer.addView(heightDemo);
 
 -     
 
 -     // 添加分割空间
 
 -     var separator2 = new Space();
 
 -     separator2.setHeight(10.0);
 
 -     demoContainer.addView(separator2);
 
 -     
 
 -     // 第三个方法:setColor设置线条颜色演示
 
 -     var colorDemo = new Vertical();
 
 -     colorDemo.setSpacing(10);
 
 -     
 
 -     var colorLabel = new Label();
 
 -     colorLabel.setText("📌 setColor设置线条颜色");
 
 -     colorLabel.setFontSize(16.0);
 
 -     colorLabel.setTextColor(0, 122, 255);
 
 -     colorDemo.addView(colorLabel);
 
 -     
 
 -     var colorDesc = new Label();
 
 -     colorDesc.setText("创建不同颜色的线条:");
 
 -     colorDesc.setFontSize(14.0);
 
 -     colorDesc.setTextColor(100, 100, 100);
 
 -     colorDemo.addView(colorDesc);
 
 -     
 
 -     // 创建不同颜色的线条示例
 
 -     var colorLine1 = new Line();
 
 -     colorLine1.setWidth(250.0);
 
 -     colorLine1.setHeight(3.0);
 
 -     colorLine1.setColor(255, 0, 0); // 设置线条颜色为红色 (255, 0, 0)
 
 -     colorDemo.addView(colorLine1);
 
 -     
 
 -     var colorLineDesc1 = new Label();
 
 -     colorLineDesc1.setText("颜色: 红色 (255, 0, 0)");
 
 -     colorLineDesc1.setFontSize(12.0);
 
 -     colorLineDesc1.setTextColor(150, 150, 150);
 
 -     colorDemo.addView(colorLineDesc1);
 
 -     
 
 -     var colorLine2 = new Line();
 
 -     colorLine2.setWidth(250.0);
 
 -     colorLine2.setHeight(3.0);
 
 -     colorLine2.setColor(0, 255, 0); // 设置线条颜色为绿色 (0, 255, 0)
 
 -     colorDemo.addView(colorLine2);
 
 -     
 
 -     var colorLineDesc2 = new Label();
 
 -     colorLineDesc2.setText("颜色: 绿色 (0, 255, 0)");
 
 -     colorLineDesc2.setFontSize(12.0);
 
 -     colorLineDesc2.setTextColor(150, 150, 150);
 
 -     colorDemo.addView(colorLineDesc2);
 
 -     
 
 -     var colorLine3 = new Line();
 
 -     colorLine3.setWidth(250.0);
 
 -     colorLine3.setHeight(3.0);
 
 -     colorLine3.setColor(0, 0, 255); // 设置线条颜色为蓝色 (0, 0, 255)
 
 -     colorDemo.addView(colorLine3);
 
 -     
 
 -     var colorLineDesc3 = new Label();
 
 -     colorLineDesc3.setText("颜色: 蓝色 (0, 0, 255)");
 
 -     colorLineDesc3.setFontSize(12.0);
 
 -     colorLineDesc3.setTextColor(150, 150, 150);
 
 -     colorDemo.addView(colorLineDesc3);
 
 -     
 
 -     var colorLine4 = new Line();
 
 -     colorLine4.setWidth(250.0);
 
 -     colorLine4.setHeight(3.0);
 
 -     colorLine4.setColor(255, 255, 0); // 设置线条颜色为黄色 (255, 255, 0)
 
 -     colorDemo.addView(colorLine4);
 
 -     
 
 -     var colorLineDesc4 = new Label();
 
 -     colorLineDesc4.setText("颜色: 黄色 (255, 255, 0)");
 
 -     colorLineDesc4.setFontSize(12.0);
 
 -     colorLineDesc4.setTextColor(150, 150, 150);
 
 -     colorDemo.addView(colorLineDesc4);
 
 -     
 
 -     demoContainer.addView(colorDemo);
 
 -     
 
 -     mainContainer.addView(demoContainer);
 
 -     
 
 -     // 实际应用示例
 
 -     var applicationContainer = new Vertical();
 
 -     applicationContainer.setBackgroundColor(255, 255, 255);
 
 -     applicationContainer.setSpacing(15);
 
 -     
 
 -     var appTitle = new Label();
 
 -     appTitle.setText("Line实际应用示例");
 
 -     appTitle.setFontSize(18.0);
 
 -     appTitle.setTextColor(0, 0, 0);
 
 -     appTitle.setTextAlignment("center");
 
 -     applicationContainer.addView(appTitle);
 
 -     
 
 -     var appDesc = new Label();
 
 -     appDesc.setText("使用Line控件创建分隔线:");
 
 -     appDesc.setFontSize(14.0);
 
 -     appDesc.setTextColor(100, 100, 100);
 
 -     applicationContainer.addView(appDesc);
 
 -     
 
 -     // 表单布局示例
 
 -     var formContainer = new Vertical();
 
 -     formContainer.setSpacing(10);
 
 -     
 
 -     // 用户名行
 
 -     var usernameRow = new Horizontal();
 
 -     usernameRow.setSpacing(10);
 
 -     
 
 -     var usernameLabel = new Label();
 
 -     usernameLabel.setText("用户名:");
 
 -     usernameLabel.setWidth(60);
 
 -     usernameLabel.setTextColor(0, 0, 0);
 
 -     
 
 -     var usernameInput = new Input();
 
 -     usernameInput.setPlaceholder("请输入用户名");
 
 -     usernameInput.setWidth(200);
 
 -     usernameInput.setHeight(40);
 
 -     usernameInput.setBackgroundColor(240, 240, 240);
 
 -     
 
 -     usernameRow.addView(usernameLabel);
 
 -     usernameRow.addView(usernameInput);
 
 -     formContainer.addView(usernameRow);
 
 -     
 
 -     // 添加分隔线
 
 -     var separatorLine1 = new Line();
 
 -     separatorLine1.setWidth(300.0);
 
 -     separatorLine1.setHeight(1.0);
 
 -     separatorLine1.setColor(200, 200, 200);
 
 -     formContainer.addView(separatorLine1);
 
 -     
 
 -     // 密码行
 
 -     var passwordRow = new Horizontal();
 
 -     passwordRow.setSpacing(10);
 
 -     
 
 -     var passwordLabel = new Label();
 
 -     passwordLabel.setText("密码:");
 
 -     passwordLabel.setWidth(60);
 
 -     passwordLabel.setTextColor(0, 0, 0);
 
 -     
 
 -     var passwordInput = new Input();
 
 -     passwordInput.setPlaceholder("请输入密码");
 
 -     passwordInput.setWidth(200);
 
 -     passwordInput.setHeight(40);
 
 -     passwordInput.setBackgroundColor(240, 240, 240);
 
 -     
 
 -     passwordRow.addView(passwordLabel);
 
 -     passwordRow.addView(passwordInput);
 
 -     formContainer.addView(passwordRow);
 
 -     
 
 -     // 添加分隔线
 
 -     var separatorLine2 = new Line();
 
 -     separatorLine2.setWidth(300.0);
 
 -     separatorLine2.setHeight(1.0);
 
 -     separatorLine2.setColor(200, 200, 200);
 
 -     formContainer.addView(separatorLine2);
 
 -     
 
 -     // 邮箱行
 
 -     var emailRow = new Horizontal();
 
 -     emailRow.setSpacing(10);
 
 -     
 
 -     var emailLabel = new Label();
 
 -     emailLabel.setText("邮箱:");
 
 -     emailLabel.setWidth(60);
 
 -     emailLabel.setTextColor(0, 0, 0);
 
 -     
 
 -     var emailInput = new Input();
 
 -     emailInput.setPlaceholder("请输入邮箱");
 
 -     emailInput.setWidth(200);
 
 -     emailInput.setHeight(40);
 
 -     emailInput.setBackgroundColor(240, 240, 240);
 
 -     
 
 -     emailRow.addView(emailLabel);
 
 -     emailRow.addView(emailInput);
 
 -     formContainer.addView(emailRow);
 
 -     
 
 -     applicationContainer.addView(formContainer);
 
 -     
 
 -     // 按钮区域
 
 -     var buttonContainer = new Horizontal();
 
 -     buttonContainer.setSpacing(10);
 
 -     buttonContainer.setAlignment("center");
 
 -     
 
 -     var submitBtn = new Button();
 
 -     submitBtn.setText("提交");
 
 -     submitBtn.setColor(0, 122, 255);
 
 -     submitBtn.setTextColor(255, 255, 255);
 
 -     submitBtn.setWidth(100);
 
 -     submitBtn.setHeight(40);
 
 -     
 
 -     submitBtn.onClick(() => {
 
 -         var username = usernameInput.getText();
 
 -         var password = passwordInput.getText();
 
 -         var email = emailInput.getText();
 
 -         printl("用户名: " + username);
 
 -         printl("密码: " + password);
 
 -         printl("邮箱: " + email);
 
 -         
 
 -         var resultLabel = new Label();
 
 -         resultLabel.setText("提交成功!");
 
 -         resultLabel.setFontSize(14.0);
 
 -         resultLabel.setTextColor(52, 199, 89);
 
 -         applicationContainer.addView(resultLabel);
 
 -     });
 
 -     
 
 -     var resetBtn = new Button();
 
 -     resetBtn.setText("重置");
 
 -     resetBtn.setColor(255, 149, 0);
 
 -     resetBtn.setTextColor(255, 255, 255);
 
 -     resetBtn.setWidth(100);
 
 -     resetBtn.setHeight(40);
 
 -     
 
 -     resetBtn.onClick(() => {
 
 -         usernameInput.setText("");
 
 -         passwordInput.setText("");
 
 -         emailInput.setText("");
 
 -         printl("表单已重置");
 
 -     });
 
 -     
 
 -     buttonContainer.addView(submitBtn);
 
 -     buttonContainer.addView(resetBtn);
 
 -     applicationContainer.addView(buttonContainer);
 
 -     
 
 -     mainContainer.addView(applicationContainer);
 
 -     
 
 -     // 控件信息区域
 
 -     var infoContainer = new Vertical();
 
 -     infoContainer.setBackgroundColor(236, 245, 255);
 
 -     infoContainer.setSpacing(8);
 
 -     
 
 -     var infoTitle = new Label();
 
 -     infoTitle.setText("ℹ️ Line控件说明");
 
 -     infoTitle.setFontSize(16.0);
 
 -     infoTitle.setTextColor(0, 122, 255);
 
 -     infoContainer.addView(infoTitle);
 
 -     
 
 -     var info1 = new Label();
 
 -     info1.setText("• Line控件用于创建线条元素");
 
 -     info1.setFontSize(12.0);
 
 -     info1.setTextColor(52, 58, 64);
 
 -     infoContainer.addView(info1);
 
 -     
 
 -     var info2 = new Label();
 
 -     info2.setText("• 可通过setWidth/setHeight设置线条尺寸");
 
 -     info2.setFontSize(12.0);
 
 -     info2.setTextColor(52, 58, 64);
 
 -     infoContainer.addView(info2);
 
 -     
 
 -     var info3 = new Label();
 
 -     info3.setText("• 可通过setColor设置线条颜色");
 
 -     info3.setFontSize(12.0);
 
 -     info3.setTextColor(52, 58, 64);
 
 -     infoContainer.addView(info3);
 
 -     
 
 -     var info4 = new Label();
 
 -     info4.setText("• 常用于界面分隔和装饰");
 
 -     info4.setFontSize(12.0);
 
 -     info4.setTextColor(52, 58, 64);
 
 -     infoContainer.addView(info4);
 
 -     
 
 -     mainContainer.addView(infoContainer);
 
 -     
 
 -     // 底部按钮
 
 -     var bottomContainer = new Horizontal();
 
 -     bottomContainer.setSpacing(10);
 
 -     bottomContainer.setAlignment("center");
 
 -     
 
 -     var exitBtn = new Button();
 
 -     exitBtn.setText("退出示例");
 
 -     exitBtn.setColor(255, 59, 48);
 
 -     exitBtn.setTextColor(255, 255, 255);
 
 -     exitBtn.setHeight(40);
 
 -     
 
 -     exitBtn.onClick(() => {
 
 -         printl("退出按钮被点击");
 
 -         vc.dismiss();
 
 -     });
 
 -     
 
 -     bottomContainer.addView(exitBtn);
 
 -     mainContainer.addView(bottomContainer);
 
 -     
 
 -     // 添加到主视图
 
 -     view.addView(mainContainer);
 
 -     
 
 -     printl("Line示例界面构建完成");
 
 - });
 
  
- printl("Line控件完整示例已启动");
 
  复制代码 
 
  |  |    |  |   |  
  |