Titanium环境搭建for mac
关于Titanium
About Appcelerator Appcelerator’s Titanium is the leading mobile platform of choice for thousands of companies seizing the mobile opportunity. With more than 35,000 applications deployed on 40 million devices
Titanium号称是领先的移动开发平台,成为成千上万的企业移动开发选择。已经超过35,000个应用程序部署在40万台设备上
下载地址:
https://my.appcelerator.com/resources
下载后安装运行(需要用注册的用户名密码登录),它会自动下载Titanium SDK
下载完毕后
创建Titanium Mobile Project
点击Next>
Finish之后
Run As Iphone Simulator
项目文件结构:
app.js是程序运行的入口
code:
/* * A tabbed application, consisting of multiple stacks of windows associated with tabs in a tab group. * A starting point for tab-based application with multiple top-level windows. * Requires Titanium Mobile SDK 1.8.0+. * * In app.js, we generally take care of a few things: * - Bootstrap the application with any data we need * - Check for dependencies like device type, platform version or network connection * - Require and open our top-level UI component * */ //bootstrap and check dependencies if (Ti.version < 1.8 ) { alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later'); } // This is a single context application with mutliple windows in a stack (function() { //determine platform and form factor and render approproate components
//根据设备OS和屏幕特性,来决定相应的组件 var osname = Ti.Platform.osname, version = Ti.Platform.version, height = Ti.Platform.displayCaps.platformHeight, width = Ti.Platform.displayCaps.platformWidth; //considering tablet to have one dimension over 900px - this is imperfect, so you should feel free to decide //yourself what you consider a tablet form factor for android var isTablet = osname === 'ipad' || (osname === 'android' && (width > 899 || height > 899)); var Window; if (isTablet) {
//平板设备(ipad),调用此路径组件 Window = require('ui/tablet/ApplicationWindow'); } else { Window = require('ui/handheld/ApplicationWindow'); } var ApplicationTabGroup = require('ui/common/ApplicationTabGroup'); new Applicatio
by archie
posted on 2012-06-30 09:15 archie2010 阅读(1715) 评论(1) 编辑 收藏 举报
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
· PowerShell开发游戏 · 打蜜蜂