iPhone Three20软件引擎之构建开发环境与HelloWorld
1:原文摘自:http://blog.csdn.net/xys289187120/article/details/7017432
Xcode 4 Transition Guide
Apple is aiming for Xcode 4 to be the primary iOS development environment and, as a result, many will need to transition from Xcode 3.2 to Xcode 4. This guide has been put together in order to help you migrate your apps to Xcode 4 successfully.
What you need to do
For existing projects
If you want to start using Xcode 4 with an existing project made using Xcode 3.2.#, all you need to do to update your project is run ttmodule again like so:
- > python three20/src/scripts/ttmodule.py -p path/to/your/project/project.xcodeproj Three20 --xcode-version=4
- #import <UIKit/UIKit.h>
- int main(int argc, char *argv[])
- {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, @"Three20AppDelegate");
- [pool release];
- return retVal;
- }
学过IOS开发的朋友绝对不会陌生,在项目中须要使用Three20库的时候须要import一下~
#import <Three20/Three20.h>
- #import "Three20AppDelegate.h"
- #import "MyViewController.h"
- @implementation Three20AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- //创建导航条
- TTNavigator* navigator = [TTNavigator navigator];
- navigator.persistenceMode = TTNavigatorPersistenceModeAll;
- navigator.window = [[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease];
- //TTURLMap 非常重要的一个属性
- //界面的点击切换完全取决与它的设定
- TTURLMap* map = navigator.URLMap;
- //如果须要访问wab页面的话 就必需添加
- [map from:@"*" toViewController:[TTWebController class]];
- //拼一个url 意思是如果访问 "tt://MyView" 会进入 MyViewController class
- [map from:@"tt://MyView" toSharedViewController:[MyViewController class]];
- if (![navigator restoreViewControllers]) {
- //打开上面设置的url
- [navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://MyView"]];
- }
- return YES;
- }
- - (void)dealloc
- {
- [super dealloc];
- }
- @end
- #import "MyViewController.h"
- #import <Three20Style/UIColorAdditions.h>
- @implementation MyViewController
- - (void)loadView {
- [super loadView];
- //创建一个可滑动的view
- UIScrollView* scrollView = [[[UIScrollView alloc] initWithFrame:TTNavigationFrame()] autorelease];
- scrollView.autoresizesSubviews = YES;
- scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- //背景颜色
- scrollView.backgroundColor = [UIColor whiteColor];
- self.view = scrollView;
- //标题内容
- self.title = @"雨松MOMO程序开发" ;
- //设置雨松MOMO头像图片
- CGRect frame = CGRectMake(100, 10, 120, 120);
- TTImageView *imageView = [[TTImageView alloc] initWithFrame:frame];
- UIImage *image = [UIImage imageNamed:@"1.jpg"];
- imageView.defaultImage = image;
- [scrollView addSubview:imageView];
- //view风格 边框 颜色
- UIColor* black = RGBCOLOR(158, 163, 172);
- //view风格
- TTStyle* style = [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]];
- frame = CGRectMake(5, 150, 310, 150);
- //新建一个TTView 将设置的风格赋值给它
- TTView *view = [[[TTView alloc] initWithFrame:frame] autorelease];
- //背景颜色
- view.backgroundColor = [UIColor whiteColor];
- //赋值风格
- view.style = style;
- //显示字符串 支持html语言
- NSString * text = @"爱加班,爱代码,爱HelloWorld , 爱学习,爱钻研,爱学无止境 爱玩游戏更爱做游戏,我是雨松MOMO,哇咔咔~ 我在参加2011年博客大赛 <a href=\"http://blog.51cto.com/contest2011/3361352\">点击为MOMO投上宝贵的一票</a>";
- frame = CGRectMake(10, 10, 290, 150);
- //TTStyledTextLabel 很给力啊这个 哈哈!
- TTStyledTextLabel* label = [[[TTStyledTextLabel alloc] initWithFrame:frame] autorelease];
- label.font = [UIFont systemFontOfSize:17];
- label.textColor = [UIColor redColor];
- label.text = [TTStyledText textFromXHTML:text lineBreaks:YES URLs:YES];
- label.contentInset = UIEdgeInsetsMake(5, 5, 5, 5);
- [label sizeToFit];
- //将label添加入自定义view
- [view addSubview:label];
- //将自动一定view 显示在主view中!
- [scrollView addSubview:view];
- }
- @end
- - (void)loadView {
- UIScrollView* scrollView = [[[UIScrollView alloc] initWithFrame:TTNavigationFrame()] autorelease];
- scrollView.autoresizesSubviews = YES;
- scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- scrollView.backgroundColor = RGBCOLOR(216, 221, 231);
- self.view = scrollView;
- UIColor* black = RGBCOLOR(158, 163, 172);
- UIColor* blue = RGBCOLOR(191, 197, 208);
- UIColor* darkBlue = RGBCOLOR(109, 132, 162);
- NSArray* styles = [NSArray arrayWithObjects:
- // Rectangle
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]],
- // Rounded rectangle
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // Gradient border
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTLinearGradientBorderStyle styleWithColor1:RGBCOLOR(0, 0, 0)
- color2:RGBCOLOR(216, 221, 231) width:2 next:nil]]],
- // Rounded left arrow
- [TTShapeStyle styleWithShape:[TTRoundedLeftArrowShape shapeWithRadius:5] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // Partially rounded rectangle
- [TTShapeStyle styleWithShape:
- [TTRoundedRectangleShape shapeWithTopLeft:0 topRight:0 bottomRight:10 bottomLeft:10] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // SpeechBubble with pointer left of the centre on the top edge
- // Locations for top edge are 45 on the left, 90 in the centre, 134.999 on the right
- [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5
- pointLocation:60
- pointAngle:90
- pointSize:CGSizeMake(20,10)] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // SpeechBubble with pointer on the extreme left on the bottom edge
- // Locations for bottom edge are 225 on the left, 270 in the centre, 314.999 on the left
- [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5
- pointLocation:314
- pointAngle:270
- pointSize:CGSizeMake(20,10)] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // SpeechBubble with pointer on the bottom of the left edge
- // Locations for left edge are 315 on the bottom, 0 in the centre, 44.999 on top
- [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5
- pointLocation:315
- pointAngle:0
- pointSize:CGSizeMake(10,20)] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // SpeechBubble with pointer on the centre of the left edge
- // Locations for left edge are 315 on the bottom, 0 in the centre, 44.999 on top
- [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5 pointLocation:0
- pointAngle:0
- pointSize:CGSizeMake(20,10)] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // SpeechBubble with pointer on the bottom of the right hand edge
- // Locations for right edge are 135 on top, 180 in the middle, 314.999 on the bottom
- [TTShapeStyle styleWithShape:[TTSpeechBubbleShape shapeWithRadius:5 pointLocation:224
- pointAngle:180
- pointSize:CGSizeMake(15,15)] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]],
- // Drop shadow
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(2, 2) next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(0.25, 0.25, 0.25, 0.25) next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(-0.25, -0.25, -0.25, -0.25) next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]]]]],
- // Inner shadow
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTSolidFillStyle styleWithColor:[UIColor whiteColor] next:
- [TTInnerShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:6 offset:CGSizeMake(1, 1) next:
- [TTSolidBorderStyle styleWithColor:black width:1 next:nil]]]],
- // Chiseled button
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTShadowStyle styleWithColor:RGBACOLOR(255,255,255,0.9) blur:1 offset:CGSizeMake(0, 1) next:
- [TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
- color2:RGBCOLOR(216, 221, 231) next:
- [TTSolidBorderStyle styleWithColor:blue width:1 next:nil]]]],
- // Embossed button
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:10] next:
- [TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
- color2:RGBCOLOR(216, 221, 231) next:
- [TTFourBorderStyle styleWithTop:blue right:black bottom:black left:blue width:1 next:nil]]],
- // Toolbar button
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:4.5] next:
- [TTShadowStyle styleWithColor:RGBCOLOR(255,255,255) blur:1 offset:CGSizeMake(0, 1) next:
- [TTReflectiveFillStyle styleWithColor:darkBlue next:
- [TTBevelBorderStyle styleWithHighlight:[darkBlue shadow]
- shadow:[darkBlue multiplyHue:1 saturation:0.5 value:0.5]
- width:1 lightSource:270 next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -1, 0, -1) next:
- [TTBevelBorderStyle styleWithHighlight:nil shadow:RGBACOLOR(0,0,0,0.15)
- width:1 lightSource:270 next:nil]]]]]],
- // Back button
- [TTShapeStyle styleWithShape:[TTRoundedLeftArrowShape shapeWithRadius:4.5] next:
- [TTShadowStyle styleWithColor:RGBCOLOR(255,255,255) blur:1 offset:CGSizeMake(0, 1) next:
- [TTReflectiveFillStyle styleWithColor:darkBlue next:
- [TTBevelBorderStyle styleWithHighlight:[darkBlue shadow]
- shadow:[darkBlue multiplyHue:1 saturation:0.5 value:0.5]
- width:1 lightSource:270 next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -1, 0, -1) next:
- [TTBevelBorderStyle styleWithHighlight:nil shadow:RGBACOLOR(0,0,0,0.15)
- width:1 lightSource:270 next:nil]]]]]],
- // Badge
- [TTShapeStyle styleWithShape:[TTRoundedRectangleShape shapeWithRadius:TT_ROUNDED] next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(1.5, 1.5, 1.5, 1.5) next:
- [TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.8) blur:3 offset:CGSizeMake(0, 5) next:
- [TTReflectiveFillStyle styleWithColor:[UIColor redColor] next:
- [TTInsetStyle styleWithInset:UIEdgeInsetsMake(-1.5, -1.5, -1.5, -1.5) next:
- [TTSolidBorderStyle styleWithColor:[UIColor whiteColor] width:3 next:nil]]]]]],
- // Mask
- [TTMaskStyle styleWithMask:TTIMAGE(@"bundle://mask.png") next:
- [TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(0, 180, 231)
- color2:RGBCOLOR(0, 0, 255) next:nil]],
- // simple bottom only border
- [TTShapeStyle styleWithShape:[TTRectangleShape shape] next:
- [TTSolidFillStyle styleWithColor:RGBCOLOR(255, 255, 255) next:
- [TTFourBorderStyle styleWithTop:nil right:nil bottom:black left:nil width:5 next:nil]]],
- nil];
- CGFloat padding = 10.0f;
- CGFloat viewWidth = scrollView.width/2 - padding*2;
- CGFloat viewHeight = TT_ROW_HEIGHT;
- CGFloat x = padding;
- CGFloat y = padding;
- for (TTStyle* style in styles) {
- if (x + viewWidth >= scrollView.width) {
- x = padding;
- y += viewHeight + padding;
- }
- CGRect frame = CGRectMake(x, y, viewWidth, viewHeight);
- TTView* view = [[[TTView alloc] initWithFrame:frame] autorelease];
- view.backgroundColor = scrollView.backgroundColor;
- view.style = style;
- [scrollView addSubview:view];
- x += frame.size.width + padding;
- }
- scrollView.contentSize = CGSizeMake(scrollView.width, y + viewHeight + padding);
- }
iPhone Three20软件引擎之构建开发环境与HelloWorld相关推荐
- 构建开发环境 构建demo_构建自己的wotsapp第6部分
构建开发环境 构建demo I should start this article with a disclaimer: It is based on iOS 13, Swift 5, and Xco ...
- Lightly 自动构建开发环境
对一般的编辑器或集成开发环境而言,由于系统不同以及依赖出现差异,许多人往往面临开发好的项目在部署或协作时,面临功能失常的情况. 通常,构建开发环境耗时长达数小时.以团队协作为例,项目组加入新成员时,往 ...
- 构建开发环境 构建demo_科技构建了我们的现实
构建开发环境 构建demo 重点 (Top highlight) What Stories Are True in Your Universe? Examining the words of the ...
- 构建开发环境 构建demo_构建自己的wotsapp第1部分
构建开发环境 构建demo I should start this article with a disclaimer: It is based on iOS 13, Swift 5, and Xco ...
- Android 攻城狮的进击 1 开发环境搭建HelloWorld.apk
总览: Java简介 Java相关常识 Android简介 Android相关常识 开发环境搭建 HelloWorld.apk 参考文 ...
- Ubuntu基本软件安装和web开发环境配置
经过两天的的不懈努力,终于把环境配置好了.其中从淡定到蛋疼,从希望到失望再到绝望的过程我就不多说了.写本文的目的是不希望别人在配置环境时再像我一样遭受迷失在搜索引擎里的痛苦.闲话少说,直接上教程.(本 ...
- 生死簿后台管理系统(一)——使用Docker构建开发环境
最近有个段子非常火,说有个程序员梦见自己被阎王召见,让他帮忙开发一个后台管理系统.在一笑而过之后,我觉得如果要是能把这个系统做出来,应该颇具娱乐性,也顺便了解一下高并发以及大数据的相关技术--每天要上 ...
- 利用Docker构建开发环境
最近接触PAAS相关的知识,在研发过程中开始使用Docker搭建了自己完整的开发环境,感觉生活在PAAS时代的程序员真是幸福,本文会简要介绍下Docker是什么,如何利用Docker来搭建自己的开发环 ...
- Ubuntu22.04安装、配置、美化、软件安装、配置开发环境
一.Ubuntu.Windows11(10)双系统安装 因为ubuntu的安装网上的教程特别多了,所以这里不做赘述,推荐使用小破站这个up主的教程:Windows 和 Ubuntu 双系统从安装到卸载 ...
最新文章
- 大众点评数据平台架构变迁
- python使用fpdf创建pdf并写入hello world
- python calu_Python基本数据类型
- 全球与中国智慧物流市场”十四五“发展状况及投资前景规划报告2021-2027年版
- php文件怎么阅读器,Vue文件阅读器组件FileReader API
- 黑旋风简约引导页源码-个人官网必备
- ATA接口寄存器描写叙述
- pg_lightool-postgres数据分布查看工具
- HDU 3339 In Action(最短路+背包)题解
- 学习c++ 必知三大特性
- Hive微博数据统计分析
- 多线段几何图形—— 简单几何图形(多边形三角形化)
- OpenCV更改图片颜色
- Linux下的Samba学习(二)------用实验快速学习Samba服务器设置
- 软件测试如何提高测试的覆盖率,测试覆盖率是什么?
- mysql积累--索引
- 哈工大赛尔 | 事理图谱:事件演化的规律和模式
- C语言实现:任意进制转换
- delta函数的简化
- Word排版——毕业论文专业排版4——题注