我正在练习这个名为NativeScript的新编程框架,它允许使用JS创建本机应用程序.但是,当我开始处理Hello World教程时,我收到此错误:
https://gist.github.com/longpham91/d603c8fe7f6c6b06e86f
当我尝试在终端上运行命令"tns run ios"时发生错误,这基本上允许NativeScript在我的手机上运行HelloWorld应用程序.
我还查看了错误日志,似乎错误可能与我的Xcode设备设置有关,如下所述:
检查依赖项代码签名错误:未找到代码签名标识:找不到与团队ID"(null)"匹配的有效签名标识(即证书和私钥对).CodeSign错误:SDK"iOS 8.4"中的产品类型"应用"需要代码签名
不过,我不确定这意味着什么.
我目前正在尝试弄清楚如何更改默认蓝色文本输入的下边框的颜色.我尝试使用border-color,color和background-color属性,但似乎没有对输入产生影响.这是我用于输入的XML代码   <TextField text="{{ username }}" cssClass="username" android:row="1"/>.
假设我创建了一个小组件,它接受一个输入并设置一个标签来显示它.
应用/组件/ testComponent/testComponent.xml:
<Label id="someLabel" loaded="onLoad"/>
应用/组件/ testComponent/testComponent.js:
exports.onLoad = args => {
    const obj = args.object;
    const label = obj.getViewById('someLabel');
    label.text = obj.someString || 'no string given';
};
现在我可以在任何页面中使用此组件
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
      xmlns:testComponent="components/testComponent">
    <StackLayout>
        <testComponent:testComponent someString="hello {N}"/>
    </StackLayout>
</Page>
这似乎是正式的方式,它的工作原理.但有没有办法只使用javascript在页面中注入此组件?
它有任何免费使用与Nativescript兼容的插件或JavaScript库,所以我可以垂直或水平制作至少条形图.似乎缺乏有关此标准的信息.我不打算使用telerik pro的东西.
我通过NativeScript对建立工作OS X埃尔卡皮坦,我被困在那里我应该安装点xcodeproj和cocoapods.我尝试使用的几乎所有内容都gem显示相同的错误:
$ sudo gem install xcodeproj
ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument
以下命令显示相同的错误,我是否运行它sudo:
$ gem update --system
$ gem update
$ gem install whatever
$ gem install cocoapods
我有以下版本:
$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ gem --version
2.6.7
我已经尝试了一些我在网上找到的帮助,包括重新安装gem和ruby重启,但没有任何帮助.
我猜我有Ruby的配置问题.
有关如何排除故障的任何建议?
在nativescript中,StackLayout存在GridLayout中的一些问题.我无法在StackLayout中心垂直对齐Label.
这是我想要实现的图片:
在这里你可以看到,我想要垂直感叹号图标中心.
但不幸的是我一直这样:
这是我使用的代码:
tns.html
<GridLayout class="formMessage warning" columns="auto,*" rows="auto">
  <StackLayout col="0" class="formMessageIcon">
    <Label class="icon fa" [text]="'fa-exclamation-circle' | fonticon"></Label>
  </StackLayout>
  <Label col="1" class="formMessageText" text="lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet" textWrap="true"></Label>
</GridLayout>
CSS
.formMessage {
  width: 100%;
  border-width: 2;
  border-color: #ff344e;
}
.formMessageIcon {
  background-color: #ff344e;
  width: 30;
}
.icon {
  vertical-align: center;
  text-align: center;
  margin-right: 2;
  font-size: 18;
  color: #2b3535;
}
.formMessageText {
  padding: 5 8;
  color: #ff344e;
}
如何修复图标居中?我做错了什么?非常感谢你!
我是nativescript的新手.我不知道如何给stacklayout提供border和border-radius.
下面我发布了我到目前为止所尝试的内容:
component.html:
 <StackLayout class ="stackBorder" orientation="horizontal">
    <Label text="Label 1" width="50" height="50" > </Label>
    <Label text="Label 2" width="50" height="50" > </Label>
    <Label text="Label 3" width="50" height="50" backgroundColor="white"> </Label>
    <Label text="Label 4" width="50" height="50" backgroundColor="white"> </Label>
  </StackLayout>
component.css:
StackLayout {
  margin: 10;
  background-color: green;
}
.stackBorder {
 border: 2px solid red;
   border-radius: 8px;
}
component.ts:
@Component({
    selector: "sdk-child-component",
    moduleId: module.id,
    templateUrl: "./component.html",
    styleUrls: ["./component.css"]
})
最后我无法在stacklayout中看到边框.
我正在构建一个NS angular2应用程序,我遇到了TabView组件的默认行为的问题.我不希望它在创建组件时预加载所有数据.如何防止此行为发生.我只想在用户点击它时加载某个标签的数据.
这是我的tabview:
<TabView  #tabview (selectedIndexChange)="onIndexChanged($event)" class="tab-view" sdkToggleNavButton> 
    <StackLayout *tabItem="{title: 'Summary', iconSource: 'res://ic_summary'}" >
        <summary></summary>
    </StackLayout>
    <StackLayout *tabItem="{title: 'Dash', iconSource: 'res://ic_dashboard'}">
        <dashboard></dashboard>
    </StackLayout>
    <StackLayout *tabItem="{title: 'My players', iconSource: 'res://ic_players'}" >  
        <myplayers></myplayers>
    </StackLayout>
    <StackLayout *tabItem="{title: 'Details', iconSource: 'res://ic_details'}" > 
        <playerdetails></playerdetails>
    </StackLayout>
</TabView>
我可以在tabview的相同.ts中调用onIndexChanged事件,但是我必须通知摘要,仪表板,内部组件.
需要通知的组件示例:
@Component({
selector: “summary”,
templateUrl: ‘summary.component.html’
})
export class SummaryView extends View {
constructor(args:Page){
   super();
}
}
我收到了运行时错误cannot read property listArr of undefined.我需要在多个组件中重用相同的数组.这就是我使用Global数组的原因
我添加了相关代码.请检查一下.
Global.ts:
export class Global {
    public static listArr: ObservableArray<ListItem> = new ObservableArray<ListItem>();
}
ts文件:
 Global.listArr.push(data.items.map(item => new ListItem(item.id, item.name, item.marks)));
html文件:
<ListView [items]="Global.listArr"  > </ListView>
我安装了Android Studio,并通过Android Studio进一步安装了SDK和工具.他们来了:
我的$ANDROID_HOME路径如下:/ Users/USER/Library/Android/sdk在终端和Android Studio中.
但是,当运行tns医生时,我得到以下内容:
(...)验证CocoaPods.这可能需要一些时间,请耐心◟验证CocoaPods.这可能需要一些时间,请耐心◜验证CocoaPods.这可能需要一些时间,请耐心◠验证CocoaPods.这可能需要一些时间,请耐心◝验证CocoaPods.这可能需要一些时间,请耐心◞验证CocoaPods.这可能需要一些时间,请耐心◡验证CocoaPods.这可能需要一些时间,请耐心等待..
您需要在系统上安装Android SDK Build-tools.您可以在以下范围内安装任何版本:'> = 23 <= 25'.从命令行运行$ $ ANDROID_HOME/tools/bin/sdkmanager以安装所需的Android Build Tools.
运行"$ ANDROID_HOME/tools/bin/sdkmanager"简单地回应"帮助"提示.
到底发生了什么,我该如何解决这个问题,以便运行"npm run android"和android相关操作?
谢谢您的帮助
nativescript ×10
android ×3
typescript ×3
css ×2
ios ×2
mobile ×2
angular ×1
charts ×1
graph ×1
javascript ×1
plugins ×1
ruby ×1
rubygems ×1
xcode ×1