当前位置:  编程技术>移动开发
本页文章导读:
    ▪前不久看了几天的object-c/cocoa的文档,感觉object-c不给力        最近看了几天的object-c/cocoa的文档,感觉object-c不给力啊 由于工作需要,研究下ipad应用开发的东西。   弄了个macbook,因为一直windows,所以很不习惯,感觉除了花哨点,应用软件太少,玩一.........
    ▪ 透过Window-based Application创建项目(一)        通过Window-based Application创建项目(一) 通过Window-based Application创建项目   第1步:开始一个Window-based Application项目 这里将本实例项目取名为 WinBasedApplication .   第2步:创建一个UIViewController .........
    ▪ TextView兑现电话、网址链接       TextView实现电话、网址链接 TextView是android中一个组件,具有autolink的属性,确实情况下这个属性值是none   < TextView   android:layout_width="fill_parent"   android:layout_height="wrap_content"   andro.........

[1]前不久看了几天的object-c/cocoa的文档,感觉object-c不给力
    来源: 互联网  发布时间: 2014-02-18
最近看了几天的object-c/cocoa的文档,感觉object-c不给力啊

由于工作需要,研究下ipad应用开发的东西。

 

弄了个macbook,因为一直windows,所以很不习惯,感觉除了花哨点,应用软件太少,玩一天就腻了。。。看样子我果然没有啥美感细胞(举例:想找个pdfsplit的工具,找了半天,不像windows下,一下子一堆的选择。mail软件和outlook这种没法比,虽然有outlook的mac版本)

 

还有就是object-c,看了看一些官方介绍,代码,示例,step-by-step,中文论坛,盗版的pdf开发系列——自己动手在xcode和windows下gnustep用GNUmake写了些例子——

 

总之,感觉objective-c/cocoa不给力,语言层面上:

优点可能有的就是like c,效率高点

 

下面说下我不喜欢的——仅代表我个人观点(毕竟才接触一点时间而已,发发牢骚好了)

 

基本的数据的方法库不强大(或比较啰嗦)

主流的一些数据结构不内置(Json)

语言符号和关键字太杂太多(@property @synthesize等),方法调用感觉完全是为了不同而不同(历史不愿意改变)

高级语言都慢慢向虚拟机方面靠近,这里还得去手工处理对象的计数和内存

强大但我自己不喜欢的指针

。。。

 

虽然是去年年度语言,但偶怎么都喜欢不起来呢,真心希望MS的window phone多占点市场——C#怎么说也速度改进型的(这个就是YY了,技术层面的东东怎么能影响到人家封闭的帝国。。。)


    
[2] 透过Window-based Application创建项目(一)
    来源: 互联网  发布时间: 2014-02-18
通过Window-based Application创建项目(一)

通过Window-based Application创建项目

 

第1步:开始一个Window-based Application项目


这里将本实例项目取名为 WinBasedApplication .

 

第2步:创建一个UIViewController 。

 

鼠标选中项目[ WinBasedApplication ]下的目录[Classes],然后点鼠标右键:


 

 

 

选择 [IOS] > [Cocoa Touch Class] > [UIViewController subclass] , 注意在[Options]中的参数均不用选择。


 

将其取名为 FirstViewController .

 

 

至此,现在有4个Class文件,分别是:

 

FirstViewController.h

 

FirstViewController.m

 

WinBasedApplicationAppDelegate.h

 

WinBasedApplicationAppDelegate.m

 

 

第3步:修改  FirstViewController.h

 

#import <UIKit/UIKit.h>

@interface FirstViewController : UIViewController {

UILabel * label ;

UIButton * button ;

}

@property ( nonatomic, retain) UILabel *label;

@property ( nonatomic, retain) UIButton *button;

@end

 

 

第4步:修改  FirstViewController.m

 

 

#import "FirstViewController.h"

@implementation FirstViewController

@synthesize label,button;

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.

/*

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization.

    }

    return self;

}

*/

/*

// Implement loadView to create a view hierarchy programmatically, without using a nib.

- (void)loadView {

}

*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void )viewDidLoad {

//create the label

CGRect frame=CGRectMake (50 , 30 , 200 , 45 );

label =[[ UILabel alloc] initWithFrame:frame];

label . text = @"This is a label";

//create the button

frame=CGRectMake (50 , 100 , 200 , 45 );

button =[ UIButton buttonWithType: UIButtonTypeRoundedRect];

button .frame =frame;

[ button setTitle: @"OK" forState: UIControlStateNormal];

//add the label and button into current view.

[ self . view addSubview: label ];

[ self . view addSubview: button ];

    [ super viewDidLoad];

}

/*

// Override to allow orientations other than the default portrait orientation.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    // Return YES for supported orientations.

    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

*/

- (void )didReceiveMemoryWarning {

    // Releases the view if it doesn't have a superview.

    [ super didReceiveMemoryWarning];

    // Release any cached data, images, etc. that aren't in use.

}

- (void )viewDidUnload {

    [ super viewDidUnload];

    // Release any retained subviews of the main view.

    // e.g. self.myOutlet = nil;

}

- (void )dealloc {

[ label release];

[ button release];

    [super dealloc ];

}

@end

 

 

 

第5步:修改文件  WinBasedApplicationAppDelegate.m

 

#import "WinBasedApplicationAppDelegate.h"

#import "FirstViewController.h"

@implementation WinBasedApplicationAppDelegate

@synthesize window;

FirstViewController *firstViewController;

#pragma mark -

#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   

    // Override point for customization after application launch.

    firstViewController=[[FirstViewController alloc] initWithNibName:nil bundle:nil];

[self.window addSubview:firstViewController.view];

    [self.window makeKeyAndVisible];

    return YES;

}

- (void)applicationWillResignActive:(UIApplication *)application {

    /*

     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

     */

}

- (void)applicationDidEnterBackground:(UIApplication *)application {

    /*

     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

     If your application supports background execution, called instead of applicationWillTerminate: when the user quits.

     */

}

- (void)applicationWillEnterForeground:(UIApplication *)application {

    /*

     Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.

     */

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

    /*

     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

     */

}

- (void)applicationWillTerminate:(UIApplication *)application {

    /*

     Called when the application is about to terminate.

     See also applicationDidEnterBackground:.

     */

}

#pragma mark -

#pragma mark Memory management

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {

    /*

     Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.

     */

}

- (void)dealloc {

[firstViewController release];

    [window release];

    [super dealloc];

}

@end

 


 

 

最后,运行结果如下图所示:


 

 

 

 

 

 


    
[3] TextView兑现电话、网址链接
    来源: 互联网  发布时间: 2014-02-18
TextView实现电话、网址链接

TextView是android中一个组件,具有autolink的属性,确实情况下这个属性值是none

  < TextView

  android:layout_width="fill_parent"

  android:layout_height="wrap_content"

  android:text="01083838383"

  android:

  / >

  autolink共有5中可能的值,

  none,不支持autolink

  all,支持所有的格式

  email,支持电子邮件地址

  web,支持http网址

  phone,支持电话号码,电话号码在2.2下面只需要是一串数字,不需要前面的tel://,例如:01083838383

  map,支持google map url


    
最新技术文章:
▪Android开发之登录验证实例教程
Web服务器/前端 iis7站长之家
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3