03 2012 档案
摘要:属性通过所谓的访问器方法,即访问信息的方法,将类变量和方法公开给外部使用(getter ,setter)。使用属性比使用手动构建的方法更有优势,包括点表示法和内存管理。@interface Car : NSObject{ int year; //类变量 NSString *make; NSString *model; NSArray *colors;}这样只是申明了类的变量,不是类的属性。此时不能通过点表示法来访问,即car.make是错误的。将上面的类变量设置为属性:#import <Foundation/Foundation.h>@interface Car ...
        阅读全文
            
摘要:Objectice-C中使用NSLog来输出日志信息,在Objectice-C和C中字符串最大的区别就是"fox"与@"fox",C字符串是指向一个字节字符串的指针,而NSString字符串(以@开头)是对象。操作C字符串的方法是修改每个字节中保存的值。NSString字符串是不可变的,你不能访问每个字节并编辑他们。而且实际的字符串数据也并非保存在对象中。NSString *fox = @"fox";printf("Hello:%s\n",[fox UTF8String]);NSLog("Hello:%@
        阅读全文
            
摘要:Objectice-C中所有Cocoa Touch类都派生来自NSObject类,及类层次结构树的根。详细类图如下:
        阅读全文
            
摘要:在第一篇Car的方法中加入一个类方法:+ (NSString *) motto{ return(@"Ford Prefects are Mostly Harmless");}#import <UIKit/UIKit.h>#import "Car.h"//统一定义颜色和button风格#define COOKBOOK_PURPLE_COLOR [UIColor colorWithRed:0.20392f green:0.19607f blue:0.61176f alpha:1.0f]#define BARBUTTON(TITLE, SELECT
        阅读全文
            
摘要:Objectice-C申明一个car接口如下:#import <Foundation/Foundation.h>@interface Car : NSObject{ int year; NSString *make; NSString *model;}- (void) setMake:(NSString *) aMake andModel:(NSString *) aModel andYear: (int) aYear;- (void) printCarInfo;- (int) year;@end实现该接口:#import "Car.h"@implementat
        阅读全文
            
摘要:NSMutableArray *MutableArray = [NSMutableArray alloc] arrayWithArray:array] //创建可变数组(从现有的数组上建立)[MutableArray removeObjectAtIndex:1] //删除数组中指定位置的的元素[MutableArray replaceObjectAtIndex:1 withObject:@"tihuan"] //在相应位置for(NSString *string in MutableArray){ NSLog(@"string:%@",string);}
        阅读全文
            
摘要:%@ 对象%d, %i 整数%u 无符整形%f 浮点/双字%x, %X 二进制整数%o 八进制整数%zu size_t%p 指针%e 浮点/双字 (科学计算)%g 浮点/双字%s C 字符串%.*s Pascal字符串%c 字符%C unichar%lld 64位长整数(long long)%llu 无符64位长整数%Lf 64位双字
        阅读全文
            
摘要:在上一篇中,使用了单个单元定位来实现九宫格,有点是很容易理解,但是在添加单元和设置位置时比较麻烦。那么,第二种方法就是用table来实现,将一格表示为一个图片和一个label的集合来实现。工程截图:每一个用ImageAndTitle来表示:#import <Foundation/Foundation.h>@interface ImageAndTitle : NSObject { NSString * Image; NSString * Title;}-(id)InitWithImage:(NSString *)image AndTitle:(NSString *)title;@..
        阅读全文
            
摘要:总体思路:用图片定位。//// ViewController.m// SquaresDemo//// Created by Fox on 12-3-21.// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.//#import "ViewController.h"#import "NextView.h"NextView *nextView;@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; //
        阅读全文
            
摘要:在IOS里两个UIView窗口之间传递参数方法有很多,比如1.使用SharedApplication,定义一个变量来传递.2.使用文件,或者NSUserdefault来传递3.通过一个单例的class来传递4.通过Delegate来传递。这次主要学习如何使用通过Delegate的方法来在不同的UIView里传递数据 。比如: 在窗口1中打开窗口2,然后在窗口2中填入一个数字,这个数字又回传给窗口1。窗口1窗口2窗口2的结果传递给窗口1工程截图:窗口一://// ViewController.h// DelegateDemo//// Created by Fox on 12-3-21.//...
        阅读全文
            
摘要:一、文件命令ls – 列出目录ls -al – 使用格式化列出隐藏文件cd dir - 更改目录到 dircd – 更改到 home 目录pwd – 显示当前目录mkdir dir – 创建目录 dirrm file – 删除 filerm -r dir – 删除目录 dirrm -f file – 强制删除 filerm -rf dir – 强制删除目录 dir *cp file1 file2 – 将 file1 复制到 file2cp -r dir1 dir2 – 将 dir1 复制到 dir2; 如果 dir2 不存在则创建它mv file1 file2 – 将 file1 重命名或移动
        阅读全文
            
摘要:参考来自:http://www.cnblogs.com/pengyingh/articles/2341880.html1. NSString转化为UNICODE String:(NSString*)fname = @“Test”;char fnameStr[10];memcpy(fnameStr, [fname cStringUsingEncoding:NSUnicodeStringEncoding], 2*([fname length]));与strcpy相比,memcpy并不是遇到'\0'就结束,而是一定会拷贝完n个字节2. NSString 转化为 char *NSStr
        阅读全文
            
摘要:通过一个URL,获取URL中包含的各种信息。例如: NSURL *url = [NSURL URLWithString: @"http://some-site.com:999/dir1/dir2;param?field-1=value-1&field-2=value-2#anchor1"]; NSLog(@"Scheme: %@", [url scheme]); //方案 NSLog(@"Host: %@", [url host]); //主机 NSLog(@"Port: %@", [url port]);
        阅读全文
            
摘要:前一篇简单的介绍了iPhone应用程序间通信,主要是通过在被调用应用的Info.plist中加入URL方案,在应用中通过openUrl来实现程序的调用。而应用程序间的数据传递则可以更具url来实现,例如我要在test应用中输入一个参数,将其传递给URLSchemeDemo中。则可以按照下面方法实现: NSString *temp = [NSString stringWithFormat:@"URLSchemeDemoapp:message=%@",self.message.text]; NSURL *url = [NSURL URLWithString:temp]; [[U
        阅读全文
            
摘要:前面已经介绍了程序中调用系统自带应用,在自己的程序中可以很方便的调用系统自带的应用程序,同样,我们也可以使用URL方案来启动自己的应用程序。用一个定制的URL方案来启动应用程序:1)创建URLSchemeExample应用程序;2)在<app>-Info.plist文件中添加一个URL types在Item0下添加URLSchemes下设置一个标示符(这里是foxtest),用来在启动该应用程序。3)在AppDelegate.m中,实现ApplicationDelegate的如下方法:/* *响应其他应用程序通过URL方案来调用该程序时的方法 */- (BOOL)applicati
        阅读全文
            
摘要:ffmpeg Documentation:http://ffmpeg.org/ffmpeg.htmlffmpeg4iphone:http://code.google.com/p/ffmpeg4iphone/
        阅读全文
            
摘要:参考来自:http://www.cocoachina.com/bbs/read.php?tid=79169&keyword=ffmpeg一、编译ffmpeg模拟器版本1、到https://github.com/gabriel/ffmpeg-iphone-build下载ffmpeg-iphone-build2、先将gas-preprocessor.pl拷贝到/usr/sbin/目录中。3、到ffmpeg官网上下载ffmpeg源码下载地址:source snapshot4、在终端下定位到ffmpeg的目录下运行./configure --disable-doc --disable-ffmp
        阅读全文
            
摘要:工程可以从https://github.com/erica/uidevice-extension下载,主要用于读取各种平台(iPhone、iPad、模拟器)下设备的信息。工程截图:main.m函数/* Erica Sadun, http://ericasadun.com iPhone Developer's Cookbook, 3.0 Edition BSD License, Use at your own risk */#import <UIKit/UIKit.h>#import "UIDevice-Reachability.h"#import &qu
        阅读全文
            
摘要:在程序中调用系统自带的应用,比如我进入程序的时候,希望直接调用safar来打开一个网页,下面是一个简单的使用:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.viewController = [[[ViewControl...
        阅读全文
            
摘要:NSMutableURLRequest通过POST方法向服务器请求时间,很简单的一个例子,使用HTTP入门。- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *urlString = [[NSString alloc] initWithFormat:@"http://api.air-id.net/InterFace/datetime.php"]; NSMutableU...
        阅读全文
            
摘要:参考:http://hi.baidu.com/smallwolf99/blog/item/d221e811a3346dd4a6ef3f8d.html整理电脑时不小心卸载掉了winpcap,当时不知道是用来干嘛的。今天使用wireshark 这款很强大的网络监视软件,满心欢喜的打开,可是每次打开都会弹出“The NPF driver isn't running...”的错误提示窗口。解决方法如下:首先,你需要重新安装winpcap(最好下载一个最新版本:官方下载,这会官方好像打不开,也可以华军下载),然后(1)如果你使用的是Linux、Ubuntu系统,请用 >$ su Admin
        阅读全文
            
摘要:google BTstack地址:http://code.google.com/p/btstack/使用方法:http://code.google.com/p/btstack/wiki/GettingStarted步骤说明:在IOS设备中通过Cydia来安装BTstack,直接搜索即可安装;get the BTstack project from the Google code SVN:从Google的SVN代码服务器中获得工程,SVN Location为http://btstack.googlecode.com/svn/trunk/,关于怎么在Xcode4中使用SVN,请参考Xcode4使用
        阅读全文
            
摘要:首先打开xcode->window->organizer,在左下角点击+,然后add repository,如下图:接下来在Name中输入工程名称(自定),在Location中输入您配置的svn路径,然后next,如图:如果svn路径没错,则下面直接点击Add,即可连接到svn服务器了。选择要修改的工程,可以check out到本地目录,并在左边的导航栏中列出已经check out出的工程。如图:点击左边check out出的工程,可以对工程文件进行update、commit等操作。
        阅读全文
            
摘要:今天工程编译的时,显示错误:Unsupported compiler 'GCC 4.2' selected for architecture 'i386'xcode build errors:Unsupported compiler ‘GCC 4.2′ selected for architecture ‘i386′Solution:This can be caused by importing a project for a pre- iOS 5 SDK into a copy of xcode with iOS 5 SDK only.To fix, clic
        阅读全文
            
摘要:工程截图:ViewController.h//// ViewController.h// NSXMLParserDemo//// Created by Fox on 12-3-15.// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.//#import <UIKit/UIKit.h>@interface ViewController : UIViewController<NSXMLParserDelegate>- (void)parseXMLFileAtURL:(NSURL *)URL parseE
        阅读全文
            
摘要:通过Reachability来判断设备的网络环境,方法比较简单。直接将Reachability.h和Reachability.m加入到工程中,然后添加SystemConfiguration.framework框架,就可以使用了。工程截图:ViewController.h//// ViewController.h// NetworkStatusDemo//// Created by Fox on 12-3-15.// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.//#import <UIKit/UIKit.h>
        阅读全文
            
摘要:该工程是使用苹果官方的GameKit框架来实现蓝牙设别之间的通信,首先当然是要在项目中加入GameKit.framework框架。工程的截图如下:ViewController.h如下://// ViewController.h// GameKitDemo//// Created by Fox on 12-3-14.// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.//#import <UIKit/UIKit.h>#import <GameKit/GKSession.h>#import <Ga
        阅读全文
            
摘要:参考来源:http://www.cnblogs.com/zhanglong0426/archive/2010/10/07/1845268.html高级一些的编辑器,都会包含宏功能,vim当然不能缺少了,在vim中使用宏是非常方便的::qx 开始记录宏,并将结果存入寄存器xq 退出记录模式@x 播放记录在x寄存器中的宏命令稍微解释一下,当在normal模式下输入:qx后,你对文本的所有编辑动作将会被记录下来,再次输入q即退出了记录模式,然后输入@x对刚才记录下来的命令进行重复,此命令后可跟数字,表示要重复多少次,比如@x20,可以重复20次。这个在文本的批处理中是非常有用的。同时编辑多个文件在v
        阅读全文
            
摘要:CoreBluetooth是Apple官方的框架,但是缺点是只支持IOS5,iPad2 和 iPhone4都不支持,iPhone4s支持。限制太大了,CoreBluetooth-Demo是个开源项目,点击这里下载。
        阅读全文
            
摘要:运行激活软件toolkit.txt 2.33,如果出现应用程序正常初始化失败,则应该下载最新的 .NET Framework 4,按后再激活,版本低是不行的,另外.NET Framework最好在官网上下载,否则也可能失败。附上下载地址:Microsoft .NET Framework 4(独立安装程序)
        阅读全文
            
摘要:开发环境使用的是目前为止最新的稳定版软件:Mac OS X Lion 10.7 + Xcode 4.1各步骤会标明版本,比如(Xcode4.1请执行)和(Xcode4.2请执行)未标明的步骤为两个版本均需执行的步骤!当然您需要先越狱您的设备并通过Cydia安装AppSync众所周知,在Xcode上开发的程序只能在模拟器中运行,如果要放到真机上则要花费99美金购买开发者证书iDP。这严重阻碍了我等草根开发者探索的脚步。写个小程序,同学间分享一下这个小小的愿望都不能满足,自然不能善罢甘休。在没有iDP的情况下,要想将程序放到iPhone上调试,并最终发布IPA用于分享,需要以下几个步骤:1.自己为
        阅读全文
            
摘要:建立UIApplicationDelegateDemo主要用来明确应用程序进入前台、按home键进入后台以及在此唤醒进入前台函数的调用顺序。 1 // 2 // AppDelegate.h 3 // UIApplicationDelegateDemo 4 // 5 // Created by Fox on 12-3-14. 6 // Copyright (c) 2012年 __MyCompanyName__. All rights reserved. 7 // 8 9 #import <UIKit/UIKit.h>10 11 @class ViewController;12 13.
        阅读全文
            
摘要:@protocol UIApplicationDelegate<NSObject>@optional- (void)applicationDidFinishLaunching:(UIApplication *)application;//当程序完成载入后调用- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);//当程序完成载
        阅读全文
            
摘要:参考来源一:http://xiongzhend.blog.163.com/blog/static/64098501201041383342989/参考来源二: http://blog.iosxcode4.com/archives/23 iPhone可以使用CoreLocation框架确定他的物理位置,可以利用三种技术来实现该功能:GPS,WiFi定位和蜂窝基站三角网定位。但在程序中我们只需设定我们希望的精度级别,由CoreLocation决定采用哪种技术可以更好的满足我们的请求。1.Wi-Fi定位扫描本地路由器,使用它们的MAC地址搜索一个中心位置数据库,所有iPhone和iPod tou..
        阅读全文
            
摘要:前期尝试过私有API,但是没有成功,还是用下面这个方法吧!获取IMEI:1 UIDevice *myDevice = [[UIDevice alloc] init];2 3 NSString *myimei = [myDevice imei];4 5 if (myimei.length!=15) {6 myimei = @"0000000000000000";7 }获取UID: UIDevice *device = [UIDevice currentDevice];//创建设备对象 NSString *deviceU...
        阅读全文
            
摘要:1 #import <UIKit/UIKit.h> 2 3 @interface UITestViewController : UIViewController <UIWebViewDelegate> 4 { 5 6 } 7 8 @end 9 10 11 //12 // UITestViewController.m13 // UITest14 //15 16 #import "UITestViewController.h"17 18 @implementation UITestViewController19 20 - (void)viewDidLo
        阅读全文
            
摘要:1 #import <UIKit/UIKit.h> 2 3 @interface UITestViewController : UIViewController <UIWebViewDelegate> 4 { 5 6 } 7 8 @end 9 10 11 12 13 //14 // UITestViewController.m15 // UITest16 //17 18 #import "UITestViewController.h"19 20 UIActivityIndicatorView *activity;21 22 @implementati
        阅读全文
            
摘要:- (void)viewDidLoad { [super viewDidLoad]; CGPoint frameCenter = self.view.center; float width = 50.0; float height = 50.0; CGRect viewFrame = CGRectMake(frameCenter.x-width,frameCenter.y-height, width*2, height*2); UIView *myView = [[UIView alloc] initWithFrame:viewFra...
        阅读全文
            
摘要:1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 @implementation UITestViewController 9 10 11 - (void)buttonClick:(id)sender {12 13 NSLog(@"you clicked button: %@",[sender title]);14 }15 16 - (void)viewDidLoad {17 18 [super viewDidLoad];.
        阅读全文
            
摘要:1 // 2 // UITestViewController.h 3 // UITest 4 // 5 6 #import <UIKit/UIKit.h> 7 8 @interface UITestViewController : UIViewController <UITextViewDelegate> 9 { 10 11 } 12 13 @end 14 15 16 17 // 18 // UITestViewController.m 19 // UITest 20 // 21 22 #import "UITestViewController.h"
        阅读全文
            
摘要:1 // 2 // UITestViewController.h 3 // UITest 4 // 5 6 #import <UIKit/UIKit.h> 7 8 @interface UITestViewController : UIViewController <UITextFieldDelegate> 9 { 10 11 } 12 13 @end 14 15 16 17 18 // 19 // UITestViewController.m 20 // UITest 21 // 22 23 #import "UITestViewControll...
        阅读全文
            
摘要:1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 @implementation UITestViewController 9 10 -(void)switchAction:(id)sender11 {12 NSLog(@"switch changed");13 }14 15 - (void)viewDidLoad {16 17 [super viewDidLoad];18 19 CGRect switchRect...
        阅读全文
            
摘要:1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 UILabel *lblSliderValue; 9 10 @implementation UITestViewController11 12 -(void)sliderAction:(id)sender13 {14 int stepAmount = 10;15 float stepValue = (abs([(UISlider *)sender value]) / stepAmount...
        阅读全文
            
摘要:1 - (void)segmentClick:(id)sender 2 { 3 NSLog(@"you selected segment %d",[sender selectedSegmentIndex]); 4 } 5 6 - (void)viewDidLoad { 7 8 [super viewDidLoad]; 9 10 NSArray *arrSegments = [[NSArray alloc] initWithObjects:11 [NSString stringWithStrin...
        阅读全文
            
摘要:1 // 2 // UITestViewController.h 3 // UITest 4 // 5 6 #import <UIKit/UIKit.h> 7 8 @interface UITestViewController : UIViewController <UIScrollViewDelegate> 9 {10 11 }12 13 @end14 15 16 17 //18 // UITestViewController.m19 // UITest20 //21 22 #import "UITestViewController.h"23 24
        阅读全文
            
摘要:1 #import <UIKit/UIKit.h>2 3 @interface UITestViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>4 {5 6 }7 8 @end 1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 NSMutableArray *comp1; 9 NSMutableArray *com
        阅读全文
            
摘要:1 #import <UIKit/UIKit.h>2 3 @interface UITestViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>4 {5 6 }7 8 @end 1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 @implementation UITestViewController 9 10 - 
        阅读全文
            
摘要:1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 UIScrollView *myScrollView; 9 UIPageControl *myPageControl; 10 11 @implementation UITestViewController 12 13 - (void)loadScrollViewWithPage:(UIView *)page 14 { 15 int pageCount = [[myScrol...
        阅读全文
            
摘要:- (void)viewDidLoad { [super viewDidLoad]; CGRect labelFrame = CGRectMake(10,10,200,44); UILabel *myLabel = [[UILabel alloc] initWithFrame:labelFrame]; myLabel.backgroundColor = [UIColor clearColor]; myLabel.textColor = [UIColor redColor]; myLabel.font = [UIFont fontWithNam...
        阅读全文
            
摘要:- (void)viewDidLoad { [super viewDidLoad]; UIImage *anImage = [UIImage imageNamed:@"apple.png"]; UIImageView *myImageView = [[UIImageView alloc] initWithImage:anImage]; [[self view] addSubview:myImageView]; //scale our height and width by 50% CGSize viewSize = myIma...
        阅读全文
            
摘要:#import "UITestViewController.h"@implementation UITestViewController- (void)pickerChanged:(id)sender{ NSLog(@"value: %@",[sender date]);}- (void)viewDidLoad { [super viewDidLoad]; CGRect pickerFrame = CGRectMake(0,120,0,0); UIDatePicker *myPicker = [[UIDatePicker alloc] initW...
        阅读全文
            
摘要:#import "UITestViewController.h"@implementation UITestViewController-(void)buttonDown:(id)sender{ NSLog(@"Button pushed down");}-(void)buttonRelease:(id)sender{ NSLog(@"Button released");}-(void)checkboxClick:(UIButton *)btn{ btn.selected = !btn.selected;}- (void)viewDi
        阅读全文
            
摘要:#import "UITestViewController.h"NSTimer *timer;@implementation UITestViewController- (void)hideAlert:(NSTimer *)sender{ UIAlertView *alert = [sender userInfo]; [alert dismissWithClickedButtonIndex:0 animated:YES];}- (void)viewDidLoad { [super viewDidLoad]; UIAlertView *myAler...
        阅读全文
            
摘要://// UITestViewController.m// UITest//#import "UITestViewController.h"@implementation UITestViewController- (void)viewDidLoad { [super viewDidLoad]; [self.view setBackgroundColor:[UIColor blackColor]]; UIActivityIndicatorView *myActivityView = [[UIActivityIndicatorView alloc] ...
        阅读全文
            
摘要:1 // 2 // UITestViewController.m 3 // UITest 4 // 5 6 #import "UITestViewController.h" 7 8 @implementation UITestViewController 9 10 - (void)viewDidLoad {11 12 [super viewDidLoad];13 14 UIActionSheet *mySheet = [[UIActionSheet alloc] initWithTitle:@"Email Deletion Options" 15 ...
        阅读全文
            
摘要:如何进入命令行操作模式再图形界面下,用finder 打开 应用程序 》实用程序》终端如果连图形界面都进不去了(比如安错了显示驱动),开机时按 F8,用-s参数启动,然后输入命令 mount -uw /获得权限为了防止误操作破坏系统,再用户状态下时没有权限操作系统重要文件的,所以先要取得root权限sudo -s然后输入密码,输入密码时没有任何回显,连星号都没有,只管输完回车就行了。——————————————————————————————————————————————基本命令列出文件ls 参数 目录名例: 想看看跟目录下有什么,ls /想看看驱动目录下有什么,ls /System/Libr
        阅读全文
            
摘要:转载来自:http://wiki.magiche.net/pages/viewpage.action?pageId=2064410目录目录发起一个同步请求创建一个异步请求队列请求请求队列上下文ASINetworkQueues, 它的delegate提供更为丰富的功能取消异步请求安全的内存回收建议向服务器端上传数据下载文件获取响应信息获取请求进度cookie的支持大文件断点续传ASIDownloadCache 设置下载缓存多种的缓存并存缓存策略缓存存储方式缓存其它特性实现自定义的缓存使用代理请求ASIHTTPRequest, 请求的其它特性ASIHTTPRequest是一款极其强劲的HTTP访问
        阅读全文
            
摘要:使用ASIHTTPRequest+JSON一个简单的天气获取Demo,直接上代码:工程结构截图如下:加入ASIHTTPRequest的方法请查看上一篇文件,ViewController.h代码如下: 1 // 2 // ViewController.h 3 // ASIHTTPRequestDemo 4 // 5 // Created by Fox on 12-3-13. 6 // Copyright (c) 2012年 __MyCompanyName__. All rights reserved. 7 // 8 9 #import <UIKit/UIKit.h>10 11 @in
        阅读全文
            
摘要:参考来自:http://www.cnblogs.com/dotey/archive/2011/05/10/2041966.html官方网站:http://allseeing-i.com/ASIHTTPRequest/。可以从上面下载到最新源码,以及获取到相关的资料。使用iOS SDK中的HTTP网络请求API,相当的复杂,调用很繁琐,ASIHTTPRequest就是一个对CFNetwork API进行了封装,并且使用起来非常简单的一套API,用Objective-C编写,可以很好的应用在Mac OS X系统和iOS平台的应用程序中。ASIHTTPRequest适用于基本的HTTP请求,和基于R
        阅读全文
            
摘要:一、RTP协议概述 RTP 为交互式音频、视频等具有实时特性的数据提供端到端的传送服务。在IP 网络上,一般是在 UDP 之上运行 RTP 协议。如果支持它的网络能提供组播功能,则 RTP 也可用组播将数据送给多个目的用户。 RTP 包括两个关系十分密切的子协议: 实时传输协议(RTP):用于传输实时数据。 实时控制协议(RTCP):用于监视网络的服务质量,并传递与会者会话中的信息。下面首先给出有关 RTP 的一些定义。• RTP会话(RTP session):RTP传输服务使用者之间的连接被称为RTP会话,就每一个会话参加者而言,会话由一对传输层地址(即一个网络层地址加上两个端口地址...
        阅读全文
            
摘要:之前Socket一直使用Linux c来实现,优点是很容易掌握socket的通信流程,缺点是过程比较繁琐。所以选择了AsyncSocket来实现socket通信。另外实现了RTSP的通信过程,并在play命令之后,再次开始一个UDP会话,用于传输数据。 项目原型是用RTSP+RTP来实现摄像头的实时监控,RTSP使用TCP来实现,RTP使用UDP实现,直接上代码吧!工程结构截图如下:关于怎么在项目中使用AysncSocket,请查看http://www.cnblogs.com/foxmin/archive/2012/03/11/2389734.htmlRTSPClient.h如下: 1...
        阅读全文
            
摘要:今天在使用AsyncSocket时,按照说明,将AsyncSocket.h和AsyncSocket.m加入到工程后,再添加CFNetwork框架,结果出现如下错误:经过多番查找,原来是直接加入的工程中的文件并没有编译,解决办法是:选择TARGETS下的Build Phase,下编译的源文件下将AsyncSocket.m添加进去,OK!
        阅读全文
            
摘要:word2010中多级列表的使用,通过多级列表是让很多人头痛的一个问题,下面介绍一种简单的方法立马搞定。最初文档如下:先为要添加的位置设置标题:完成后的效果:定义多级列表设置一级列表:设置二级列表:设置缩进量:确定之后的效果:即完成了多级列表的自动编号,非常简单的几步。
        阅读全文
            
摘要:1. telnet 192.168.1.98 812. Ctrl+]3. 回车4. 将待发送的请求(see following example.)粘贴在光标处。Windowns 下好像只能一个一个敲, 痛苦....OPTIONS rtsp://30.0.0.17/pinball.wmv RTSP/1.0CSeq: 1User-Agent: WMPlayer/11.0.5721.5251 guid/b4112aa1-c1da-4f3a-9d43-978db491b5d9Content-Length: 05. 回车再回车 添加空行简单的rtsp交互过程: C表示rtsp客户端,S表示rtsp服..
        阅读全文
            
摘要:转载来自:http://www.dzsc.com/data/html/2009-12-22/81035.html作者:王姗姗,华清远见嵌入式学院讲师。 一、概述 TCP(传输控制协议)和UDP(用户数据报协议是网络体系结构TCP/IP模型中传输层一层中的两个不同的通信协议。 TCP:传输控制协议,一种面向连接的协议,给用户进程提供可靠的全双工的字节流,TCP套接口是字节流套接口(STreamsocket)的一种。 UDP:用户数据报协议。UDP是一种无连接协议。UDP套接口是数据报套接口(datagramSocket)的一种。 二、TCP和UDP介绍 1)基本TCP客户—服务器程序...
        阅读全文
            
摘要:UDPClient/*UDP/IP应用编程接口(API)*//**客户端的工作流程:首先调用socket函数创建一个Socket,填写服务器地址及端口号,*从标准输入设备中取得字符串,将字符串传送给服务器端,并接收服务器端返回的字*符串。最后关闭该socket。*/#include<stdio.h>#include<stdlib.h>#include<string.h>#include<errno.h>#include<sys/types.h>#include<sys/socket.h>#include<netine
        阅读全文
            
摘要:TCPClient 1 /*TCP/IP应用编程接口(API)*/ 2 /* 3 *客户端的工作流程:首先调用socket函数创建一个Socket,然后调用bind函数 4 *将其与本机地址以及一个本地端口号绑定,请求连接服务器,通过新的socket 5 *向客户端发送字符串" hi,I am client!"。最后关闭该socket。 6 */ 7 #include<stdio.h> 8 #include<stdlib.h> 9 #include<string.h>10 #include<errno.h>11 #includ
        阅读全文
            
摘要:CocoaAsyncSocket支持tcp和udp。其中:AsyncSocket类是支持TCP的AsyncUdpSocket是支持UDP的AsyncSocket是封装了CFSocket和CFSteam的TCP/IP socket网络库。它提供了异步操作,本地cocoa类的基于delegate的完整支持。主要有以下特性:队列的非阻塞的读和写,而且可选超时。你可以调用它读取和写入,它会当完成后告知你自动的socket接收。如果你调用它接收连接,它将为每个连接启动新的实例,当然,也可以立即关闭这些连接委托(delegate)支持。错误、连接、接收、完整的读取、完整的写入、进度以及断开连接,都可以通过
        阅读全文
            
 
                    
                     
                    
                 
                    
                
 
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号