//
// main.m
//
//
// Created by unknown on 12/6/1.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
// 好用的列按鈕項目建立巨集
#define BARBUTTON(TITLE, SELECTOR) [[UIBarButtonItem alloc] \
initWithTitle:TITLE style:UIBarButtonItemStylePlain target:self \
action:SELECTOR]
//Step 5.a 設計一個ViewController
@interface convertController:UIViewController
{
UITextField *field1;
UITextField *field2;
}
-(IBAction)doConvert:(id)sender;
@end
@implementation convertController
//Step 5.b 複寫loadView來佈置此ViewController的layerOut
-(void)loadView
{
// 建立視圖
self.view=[[[NSBundle mainBundle]loadNibNamed:@"View" owner:self options:NULL] lastObject];
//映射到HelloWorldController的item
field1=(UITextField *)[self.view viewWithTag:11];
field2=(UITextField *)[self.view viewWithTag:12];
[field1 setText:@"100"];
UIBarButtonItem *convertButtonItem =[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doConvert:)] autorelease];
self.navigationItem.rightBarButtonItem=convertButtonItem;
[self setTitle:@"Converter"];
}
-(IBAction)doConvert:(id)sender
{
float invalue = [[field1 text] floatValue];
float outvalue = (invalue - 32.0f) * 5.0f / 9.0f;
[field2 setText:[NSString stringWithFormat:@"%3.2f", outvalue]];
[field1 resignFirstResponder];
}
// 應用程式支援所有裝置擺設方向
- (BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
@end
//=====================
//Step 1.建立UIApplicationDelegaye class
@interface converDelegate :NSObject<UIApplicationDelegate>
{
//Step 2.加入window 指標
UIWindow *_window;
}
@end
@implementation converDelegate
//Step 3.複寫applicationDidFinishLaunching
-(void)applicationDidFinishLaunching:(UIApplication *)application
{
//Step 4.構建window,並且保留在_window
_window=[[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
//Step 5.建構一個UINavigationController,並且初始化一個converController 物件當做RootViewController
UINavigationController *nc=[[UINavigationController alloc]initWithRootViewController:[[convertController alloc]init]];
//Step 6.把nc挂入到window的Root
[_window setRootViewController:nc];
//Step 7.show window
[_window makeKeyAndVisible];
}
@end
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, @"converDelegate");
}
}
分享到:
相关推荐
这个小工具使用很方便!只需打开nib2objc,然后Dock会出现一个nib2objc图标! 接着你把想反解都xib托进去即可获得xib里面都代码!
这是一个ios开发相关的,将xib文件转为nib文件的轻便脚本文件,大家来试试~!主要用在组件化开发中使用xib的情况,需要将xib文件转为nib
使用NIB父类来创建UIVIEW
用来将Interface Builder文件转换成Objective-C代码
Nib 是完全无头的,它是一个可以集成到任何类型的自定义平台的低级库。发展该项目使用进行 TDD,使用进行演示和分发打包。 首先,首先在全局安装 TestEm 和 Gulp: $ sudo npm -g install testem gulp 然后,运行 ...
MainMenu.nib
nib2objc是一个小巧的转换工具,可以将XIB文件自动转换为Objective-C的源代码文件。 通常,考虑到程序的效率时,才将XIB直接转换为源代码文件。但是这样一来,通过Interface Builder设定的实例变量与行为方法的接续...
nib.sh shell文件
iPhone.User.Interface.Design.Projects。 ui设计,nib开发
主要介绍了Nib文件是什么?Nib文件打开方法,nib文件是Cocoa App的界面资源,这种文件直接用xcode是不能被打开的,要修改后才能打开,本文就讲解了修改方法,需要的朋友可以参考下
第十二章 Nib 文件和 NSWindowController.doc第十二章 Nib 文件和 NSWindowController.doc第十二章 Nib 文件和 NSWindowController.doc
IPHone 自己加载nib文件显示UITable的例子
首先在PBE0/6-311+G(d)标准下优化得到了 B20-和Ni B20-团簇的基态结构, B20-的基态结构同实验结果符合得很好,Ni B20-的基态为一个Ni原子被两个B10环包裹在中间的管状结构;然后基于该基态结构分析了团簇的自然布局...
http://blog.csdn.net/nagecomeontom/article/details/26848229
IOS应用源码之【应用】NIB to Objective-C converter.rar
【应用】NIB to Objective-C converter.zipIOS应用例子源码下载【应用】NIB to Objective-C converter.zipIOS应用例子源码下载 1.适合学生学习研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
简单的应用程序,可将笔尖转换为xib。 它使用ibtool并通过提供选择输入和输出文件夹的选项来帮助将笔尖批量转换为xibs。 以下是指导方法: : 玩得开心 :-)
资源来自pypi官网。 资源全名:example-pkg-nib-utils-0.0.1.tar.gz