随笔分类 -  iPhone开发

不积跬步,无以至千里。
摘要:参考来自:http://www.cocoachina.com/iphonedev/toolthain/2011/1019/3387.html如何用Facebook graphic api上传视频:http://developers.facebook.com/blog/post/532/Keychain保存数据封装:https://github.com/carlbrown/PDKeychainBindingsController对焦功能的实现:http://www.clingmarks.com/?p=612自定义圆角Switch按件:https://github.com/domesticcats 阅读全文
posted @ 2012-04-06 23:30 FoxBabe 阅读(420) 评论(0) 推荐(1)
摘要:参考来自:http://www.cocoachina.com/iphonedev/toolthain/2011/1109/3480.html扫描wifi信息:http://code.google.com/p/uwecaugmentedrealityproject/http://code.google.com/p/iphone-wireless/条形码扫描:http://zbar.sourceforge.net/iphone/sdkdoc/install.htmltcp/ip的通讯协议:http://code.google.com/p/cocoaasyncsocket/voip/sip:http 阅读全文
posted @ 2012-04-06 23:21 FoxBabe 阅读(293) 评论(0) 推荐(1)
摘要:MPMoviePlayerViewController是苹果提供的播放视频的控制器,可以直接从当前的控制器中推出即可。 NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"Movie" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:moviePath]; MPMoviePlayerViewController *moviePlayerViewController 阅读全文
posted @ 2012-04-06 21:15 FoxBabe 阅读(880) 评论(0) 推荐(0)
摘要:一种简单的图片切换效果,如下:通过滚动中间的图片或页面控制,都可以实现图片的切换。在xib中添加UIScrollView和UIPageControl,并设置为对应类的IBOutlet,#import <UIKit/UIKit.h>@interface HomePage : UIViewController<UIScrollViewDelegate>{ IBOutlet UILabel *message; IBOutlet UIScrollView *myScrollView; IBOutlet UIPageControl *myPageControl;}@propert 阅读全文
posted @ 2012-04-06 13:04 FoxBabe 阅读(16191) 评论(2) 推荐(1)
摘要:在导航栏中加上分段控件是很常用的做法,效果如下:UISegmentedControl *segmentedControl=[[UISegmentedControl alloc] initWithFrame:CGRectMake(80.0f, 8.0f, 300.0f, 30.0f) ]; [segmentedControl insertSegmentWithTitle:@"最新上架" atIndex:0 animated:YES]; [segmentedControl insertSegmentWithTitle:@"热销商品" atIndex:1 an 阅读全文
posted @ 2012-04-06 12:57 FoxBabe 阅读(1476) 评论(0) 推荐(0)
摘要:1、在新建的工程中应该包含Mainwindow.xib,关于在Xcode4.2及以上中添加MainWindow.xib,可以查看这里。2、在MainWindows中添加Tab Bar Controller;3、向Tab Bar Controller中添加Navigation Controller,MainWindows的截图如下: 阅读全文
posted @ 2012-04-06 12:53 FoxBabe 阅读(539) 评论(0) 推荐(0)
摘要:参考来自:http://blog.csdn.net/muyu114/article/details/68964981、新建一个空的应用程序2、添加一个空的xib文件到这里工程的应该是下面这个样子的:3、改变File’s Owner的class为UIApplication4、从Library中添加一个Object,并设置其class为你对应的应用程序的类(这里是DemoAppDelegate)5、添加windows,并在程序中设置windows为IBOutletThe xAppDelegate.h should read something like this:@interface DemoAp 阅读全文
posted @ 2012-04-06 12:43 FoxBabe 阅读(770) 评论(0) 推荐(2)
摘要:方法一右侧进入BaseInfoEdit*View = [[BaseInfoEditalloc]initWithNibName:@"BaseInfo"bundle:nil];[self.navigationControllerpushViewController:Viewanimated:YES];返回方法[self.navigationControllerpopViewControllerAnimated:YES];方法二下方进入OilRecordAdd*View = [[OilRecordAddalloc]initWithNibName:@"OilRecordD 阅读全文
posted @ 2012-04-02 12:12 FoxBabe 阅读(274) 评论(0) 推荐(0)
摘要:%@ 对象%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位双字 阅读全文
posted @ 2012-03-21 20:13 FoxBabe 阅读(176) 评论(0) 推荐(0)
摘要:在上一篇中,使用了单个单元定位来实现九宫格,有点是很容易理解,但是在添加单元和设置位置时比较麻烦。那么,第二种方法就是用table来实现,将一格表示为一个图片和一个label的集合来实现。工程截图:每一个用ImageAndTitle来表示:#import <Foundation/Foundation.h>@interface ImageAndTitle : NSObject { NSString * Image; NSString * Title;}-(id)InitWithImage:(NSString *)image AndTitle:(NSString *)title;@.. 阅读全文
posted @ 2012-03-21 18:58 FoxBabe 阅读(704) 评论(0) 推荐(1)
摘要:总体思路:用图片定位。//// 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]; // 阅读全文
posted @ 2012-03-21 16:45 FoxBabe 阅读(478) 评论(0) 推荐(1)
摘要:在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.//... 阅读全文
posted @ 2012-03-21 16:10 FoxBabe 阅读(469) 评论(0) 推荐(1)
摘要:参考来自: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 阅读全文
posted @ 2012-03-18 21:52 FoxBabe 阅读(1120) 评论(3) 推荐(2)
摘要:通过一个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]); 阅读全文
posted @ 2012-03-18 21:49 FoxBabe 阅读(705) 评论(0) 推荐(1)
摘要:前一篇简单的介绍了iPhone应用程序间通信,主要是通过在被调用应用的Info.plist中加入URL方案,在应用中通过openUrl来实现程序的调用。而应用程序间的数据传递则可以更具url来实现,例如我要在test应用中输入一个参数,将其传递给URLSchemeDemo中。则可以按照下面方法实现: NSString *temp = [NSString stringWithFormat:@"URLSchemeDemoapp:message=%@",self.message.text]; NSURL *url = [NSURL URLWithString:temp]; [[U 阅读全文
posted @ 2012-03-18 20:58 FoxBabe 阅读(2006) 评论(0) 推荐(0)
摘要:前面已经介绍了程序中调用系统自带应用,在自己的程序中可以很方便的调用系统自带的应用程序,同样,我们也可以使用URL方案来启动自己的应用程序。用一个定制的URL方案来启动应用程序:1)创建URLSchemeExample应用程序;2)在<app>-Info.plist文件中添加一个URL types在Item0下添加URLSchemes下设置一个标示符(这里是foxtest),用来在启动该应用程序。3)在AppDelegate.m中,实现ApplicationDelegate的如下方法:/* *响应其他应用程序通过URL方案来调用该程序时的方法 */- (BOOL)applicati 阅读全文
posted @ 2012-03-18 16:08 FoxBabe 阅读(1089) 评论(0) 推荐(0)
摘要:参考来自: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 阅读全文
posted @ 2012-03-17 16:38 FoxBabe 阅读(922) 评论(1) 推荐(0)
摘要:工程可以从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 阅读全文
posted @ 2012-03-17 15:23 FoxBabe 阅读(1378) 评论(0) 推荐(0)
摘要:在程序中调用系统自带的应用,比如我进入程序的时候,希望直接调用safar来打开一个网页,下面是一个简单的使用:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.viewController = [[[ViewControl... 阅读全文
posted @ 2012-03-17 11:27 FoxBabe 阅读(1489) 评论(1) 推荐(1)
摘要: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... 阅读全文
posted @ 2012-03-17 10:50 FoxBabe 阅读(11364) 评论(2) 推荐(0)