
Objective-C/IOS
Mirage520
这个作者很懒,什么都没留下…
展开
-
iPhone开发学习笔记007——Xcode4.2下iPhone多视图开发(自已创建MainWindow.xib和不用MainWindow.xib两种实现)
使用Xcode4以前的版本进行iPhone开发,新建Window-based Application类型的工程时,都会自动生成MainWindow.xib,并且都至少包含一个UIApplicationDelegate和一个UIWindow对象。但是Xcode4以后,新建工程时,工程template这一块有很大改动,没有Window-based Application这一项了,但是有个Emp转载 2012-05-27 15:47:42 · 1526 阅读 · 0 评论 -
IOS开发笔记(七)---对iOS多视图开发的补充(针对XCode4.2开发环境,Empty Application没有XIB/Storyboard文件的问题)
昨天参照书中的例子,回到家后开始实现示例中的代码.发现XCode4.2中没有Window Base Application这一选项.使用Empty Application没有主界面的Storyboard文件.于是打开google,发现Jeroen Trappers有一篇文章有详细的解决方法.地址:http://www.trappers.tk/site/2011/06/16/转载 2012-05-27 14:35:59 · 928 阅读 · 0 评论 -
IPHONE应用开发 - xcode4.2 添加“标签栏”
1.创建”Empty Application“项目2.添加1个”Window“类型的IB到项目,并取名为”MainWindow“3.File's Owner的Class字段填写为”UIApplication“添加1个Object,Class填写为”你的应用代理名“然后把File's Owner的delegate连接属性 连转载 2012-05-28 10:28:56 · 866 阅读 · 0 评论 -
XCode 4.2 导航控制器
导航控制器让用户使用内置动画在视图之间顺利移动,我们无需编写历史记录控制,导航控制器会自动处理Back按钮事件,让用户"出栈".导航控制器提供了一个简单的菜单栏.我们可以向菜单栏中添加按钮或者其他更复杂的控件. UINavigationController是构建分层应用的主要工具,他与UITabBarController很类似.但是UINavigationControlle转载 2012-05-30 17:47:10 · 1141 阅读 · 0 评论 -
ios多窗体项目
http://www.cnblogs.com/dotey/archive/2011/06/09/2075954.html 第二个iPhone应用程序:“Say Hello” http://edenhe.me/2011/04/28/uiwindow-uiview%E5%92%8Cuiviewcontroller/ UIWindow, UIView和UIViewController转载 2012-06-04 15:34:34 · 809 阅读 · 0 评论 -
IOS开发中的UIScreen、UIView、UIWindow和UIViewController
一、参考View Programming Guide for iOShttp://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/Introduction/Introduction.htmlView Controller Programming Gu转载 2012-06-04 15:55:09 · 814 阅读 · 0 评论 -
iOS常用的几个基础类 一个不用xib文件的例子
我们从这张图开始说吧。从这张图我们可以很清楚的看到iOS开发的MVC结构。UIApplication,Application Delegate 和 View Controller都是控制器。UIWindow和各种其他的UIView都是视图。1。 程序的启动函数UIApplicationMain 该函数主要创建一个UIApplication对象和一个UIApplicationDele转载 2012-06-04 16:16:56 · 1421 阅读 · 0 评论 -
浅谈iOS 5的StoryBoard
StoryBoard是iOS 5的新特征,旨在代替历史悠久的NIB/XIB(其实StoryBoard还是基于NIB/XIB的,不过开发人员已经无需直接跟NIB打交道了)。目前关于StoryBoard的文档并不多,苹果的iOS 5的开发者文档里也仅有不多的介绍。所以,本文只是简单的谈谈本人对StoryBoard的一些粗浅的理解。(StoryBoard有时也叫做StoryBoarding,我不太注转载 2012-06-04 15:50:27 · 585 阅读 · 0 评论 -
tabBar选项卡的背景色如何修改(自定义tabBar)&&推送nav到指定(根)视图控制器
在tabBar区域加个视图CGRect frame = CGRectMake(0,0,320,48); UIView *v = [[UIView alloc]initWithFrame:frame]; [v setBackgroundColor:[[UIColor allor]initWithRed:70.0/255.0 green:65.0/255.0 blue:转载 2012-06-05 15:19:48 · 1867 阅读 · 0 评论 -
UITabBarController UINavigationController 相结合代码
UITabBarController *tabBarCtr = [[UITabBarController alloc]init]; SecondViewController *secondViewCtrl1=[[SecondViewController alloc]init];UINavigationController *navCtrl1=[[UINavi转载 2012-06-05 14:59:17 · 972 阅读 · 0 评论 -
[iPhone HandBook]UITabBar和UINavBar混用(带视频)
UITabBarController和UINavigationController是iPhone里经常使用的两个控件,这篇教程的目的就是把UINavigationController放到UITabBar里面,或者说UITabBar其中一个item是UINavigationController。其实iPhone里很多这样的应用,最常见的就是Phone和iPod这两个程序了。如下图:其实我转载 2012-06-05 20:44:37 · 875 阅读 · 0 评论 -
Xcode 4.3 StoryBoard 基础 事件和跳转处理
刚学iOS 就直接用 xcode 4.3 头瞬间大了 不过学了 之后发现比之前的xib 方便好多也满顺手 只是网络上的教程不多 。下面是页面进行跳转的方法页面上跳转 一般有两种 一种是 用view 当事件源。 比如上图 按住control 点击button 直接拉到 下个界面 当点击 button 就直接跳转 连接的界面。还有种 是controller 连接 c转载 2012-06-05 16:53:39 · 1309 阅读 · 0 评论 -
UINavigationController与UITabBarController
@interface __2AppDelegate : NSObject { UIWindow *window;UINavigationController *navController1;UINavigationController *navController2;UINavigationController *navController3;UIN转载 2012-06-05 20:03:36 · 926 阅读 · 0 评论 -
UITabBarController with hidden UITabBar
...None of these solutions I've been able to find (here, or elsewhere) to hide a UITabBar as part of a UITabBarController worked well for me. In general, the solutions I found转载 2012-06-07 10:14:22 · 1170 阅读 · 0 评论 -
修改IOS应用的名称
iOS应用在设备上的显示名称比较重要,它必须和提交程序信息时的一致,如果不一致那么你的软件将被驳回下面是APPLE的工作人员EMAIL给我的建议:To change the installed application name, in Xcode:1. Select your Target on the left side under Groups & Files2.转载 2012-06-07 17:27:17 · 1098 阅读 · 0 评论 -
NSMutableURLRequest,在POST方式下传递参数
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; NSLog(@"Load currentCookie:%@", cookie); [request setV转载 2012-06-09 06:31:07 · 1274 阅读 · 0 评论 -
iOS通过http post上传图片
由于iOS无法通过html表单来上传图片,因此想要上传图片,必须实现http请求,而不能像其他语言那样通过html表单的post就能上传。 上传图片的http post请求的格式是这样的:Content-type: multipart/form-data, boundary=AaB03x--AaB03xcontent-disposition: form-data; name="fie转载 2012-06-09 06:39:45 · 2098 阅读 · 0 评论 -
Xcode-Cocoa “release is unavailable” Error
1) Turn off ARC for this project. This is done by setting 'Objective-C Automatic Reference Counting'to NO in the 'Build Settings' tab of your target in the project page.2) Remove all retain转载 2012-05-21 13:18:17 · 1235 阅读 · 0 评论 -
UITextView添加圆角边框
今天因为项目需要,用了一下UITextView,在nib设置里面找半天找不到UITextView的边框风格之类的设置。网上google了一番,有些给出了一些解决办法,就是在UITextView下面加一个有圆角边框的视图,例如UIButton,UITextField等,也有人说重载,自己画边框。个人觉得这些办法可以实现效果,但不是正统的办法。想想objc应该不会这么差劲,连个设置边框的方法都没有。后转载 2012-06-11 12:06:03 · 1112 阅读 · 0 评论 -
NSURLRequest : Post data and read the posted page
A few things firstDecide how you want to encode your data - JSON or url-encoding are a good start.Decide upon a return value - will it be 1, TRUE or 0, FALSE, or even YES/non-nil nothing/nil.转载 2012-06-11 14:47:37 · 997 阅读 · 0 评论 -
iphone ios json解析流程,教程
JSON 是現時流行的資料格式,與 XML 相比,JSON 更為輕巧。在傳輸相同資料時,JSON 在大部份情況也會較 XML 的檔案小,在手機網路上傳輸 JSON 亦會比 XML快。在 iPhone Cocoa Touch Framework 中並沒有 Library 去操作 JSON 資料格式。幸好有一些人為 Objective C 製作了能夠操作 JSON資料格式的 Library。而转载 2012-06-12 10:41:24 · 924 阅读 · 0 评论 -
IOS开发笔记:xcode4.2下xib的创建和UI连接的实现方法
刚开始学习ios开发,由于直接使用的xcode4.2开始学习的,资料很少,其操作和网上比较普通的xcode3.x差异很大,所以是摸着石头过河的感觉。经过N久尝试,终于学会了UI和代码的连接。发现有两个方法可以实现:项目创建: 1.新建工程 > ios > Appliction > Single View Appliction 2.在主项目代码文转载 2012-05-24 09:36:33 · 18948 阅读 · 0 评论 -
base64 on iphone-sdk
For Base64 encoding:#import @interface NSString (NSStringAdditions)+ (NSString *) base64StringFromData:(NSData *)data length:(int)length;@end-------------------------------------------#impor转载 2012-06-14 16:19:16 · 866 阅读 · 0 评论 -
Xcode4.2开发入门之一些变化
1. 工程项目模板类型的更改 Xcode4时代 Xcode4.2新模板Navigation-based Application ------->Master-Detail Application => iphoneSplite View-based Applicati转载 2012-05-25 16:03:22 · 860 阅读 · 0 评论 -
XCode 4 中建立一个Empty Application步骤(创建并关联xib视图文件)
1. Create new project in Xcode 4.2 beta and choose “Empty Application” template2. Add “New File” to the project by choosing “iOS -> User Interface -> Empty”3. Choose “iPhone” and name “MainWin转载 2012-05-25 17:15:55 · 1546 阅读 · 0 评论 -
siri 苹果语音控制功能
1.苹果语音控制功能编辑本义项siri求助编辑百科名片 Siri是苹果公司在其产品iphone 4S上应用的一项语音控制功能。Siri可以令iPhone4S变身为一台智能化机器人,利用Siri用户可以通过手机读短信、介绍餐厅、询问天气、语音设置闹钟等。Siri可以支持自然语言输入,并且可以调用系统自带的天气预报、日程安排、搜索资料等转载 2012-05-26 01:20:40 · 4908 阅读 · 0 评论 -
IPhone之自定义弹出窗口
初始化代码:if (!_alertView){_alertView = [[UIAlertView alloc] initWithTitle:title message:@"\n\n\n" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"登录", nil];_alertView.delegate = self;u转载 2012-06-25 17:12:16 · 951 阅读 · 0 评论 -
IOS 自定义导航栏背景图片和颜色
首先准备导航栏背景图片,大小 320x44, @2x文件大小640x88,iOS5以后更改背景图片较简单[java] view plaincopyprint?UINavigationBar *navBar = self.navigationController.navigationBar; #define kSCNa转载 2012-06-27 09:26:49 · 3130 阅读 · 0 评论 -
ios 翻页效果
[UIView beginAnimations:@"FlipAnim" context:NULL];// 動畫開始[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeftforView:[self superview] cache:YES];// 翻轉效果[UIView setAnimationC转载 2012-06-26 17:14:21 · 1217 阅读 · 0 评论 -
iOS的主要框架介绍
本文是《Sunvey the Major Framworks》一文的翻译 框架是一个目录,这个目录包含了共享库,访问共享库里代码的头文件,和其它的图片和声音的资源文件。一个共享库定义的方法或函数可以被应用程序调用。 IOS提供了很多你可以在应用程序里调用的框架。要使用一个框架,需要将它添加到你的项目中,你的项目才可以使用它。许多应用程序都使用了如Founda转载 2012-06-25 23:41:52 · 913 阅读 · 0 评论 -
iOS开发 对话框UIActionSheet和UIAlertView用法
UIActionSheet和UIAlertView在iOS中,都是弹出一个对话框,用户必须点击上面的按钮后才能执行其他操作。下图是UIActionSheet,对话框显示在底部:下图是AlertView,显示在屏幕正中:当按钮在两个以内时,按钮是水平显示的,当超过两个时,会垂直显示。相当代码:首先在viewController h头文件添加UIActionSh转载 2012-06-26 16:34:51 · 1116 阅读 · 0 评论 -
iOS开发之在地图上绘制出你运动的轨迹
iOS中的MapKit集成了google地图api的很多功能加上iOS的定位的功能,我们就可以实现将你运行的轨迹绘制到地图上面。这个功能非常有用,比如快递追踪、汽车的gprs追踪、人员追踪等等。这篇文章我们将使用Map Kit和iOS的定位功能,将你的运行轨迹绘制在地图上面。实现 在之前的一篇文章:iOS开发之在google地图上显示自己的位置中描述了如何在地图上显示自己的位置转载 2012-06-26 17:24:00 · 1414 阅读 · 1 评论 -
MapKit学习笔记
1、概述插入MapView,设置Delegate(一般为Controller),Annotati*****记录兴趣位置点(AnnotationView用来显示兴趣位置点),annotation是可选的,选中的annotation会显示callout,用来显示信息。2、设置地图显示类型:mapView.mapType = MKMapTypeStandard;mapView.map转载 2012-06-27 11:01:43 · 815 阅读 · 0 评论 -
在MkMapView中在指定位置添加大头针
在MkMapView中添加自己当前位置的大头针的基础上实现指定位置添加大头针,实现的效果如下:添加相关代码:@interface iphone_MapViewController : UIViewController { IBOutlet MKMapView *mapView; }添加DisplayMap :#import #im转载 2012-06-27 11:19:52 · 1074 阅读 · 0 评论 -
UISegmentedControl 分段控件-IOS开发
UISegmentedControl分段控件代替了桌面OS上的单选按钮。不过它的选项个数非常有限,因为你的IOS设备屏幕有限。当我们需要使用选项非常少的单选按钮时它很合适。一、创建UISegmentedControl* mySegmentedControl = [[UISegmentedControl alloc]initWithItems:nil];是不是很奇怪没有指定位转载 2012-07-10 16:23:19 · 678 阅读 · 0 评论 -
在UINavigationController的导航栏中添加UISegmentedControl
UISegmentedControl *segmentedControl=[[UISegmentedControl alloc] initWithFrame:CGRectMake(80.0f, 8.0f, 200.0f, 30.0f) ]; [segmentedControl insertSegmentWithTitle:@"Food to eat" atIndex:0 animated:YES转载 2012-07-10 17:06:18 · 975 阅读 · 0 评论 -
UINavigationItem添加UISegmentControl
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:[UIImage imageNamed:@"grid.png"],[UIImage imageNamed:@"list.png"],nil]]; [segmentedContro转载 2012-07-10 17:38:10 · 1165 阅读 · 0 评论 -
ios自定义标签栏
CustomTabBarViewController.h#import "CustomTabBar.h"@interface CustomTabBarViewController : UIViewController { CustomTabBar *tabBar;}@property (nonatomic, retain) CustomTabBar *tabBar;@e转载 2012-07-15 22:10:16 · 1591 阅读 · 0 评论 -
IOS图片处理
1. 图片缩放:- (UIImage*)resizeImage:(UIImage*)image toWidth:(NSInteger)width height:(NSInteger)height{ // Create a graphics context with the target size // On iOS 4 and later, use UIGraphicsB转载 2012-07-15 22:04:24 · 1182 阅读 · 0 评论 -
IOS UIGraphicsBeginImageContextWithOptions 版本适配问题
CGFloat scale = 1.0;if([[UIScreen mainScreen]respondsToSelector:@selector(scale)]) { CGFloat tmp = [[UIScreen mainScreen]scale]; if (tmp > 1.5) { scale = 2.0; }} if转载 2012-07-15 22:14:08 · 2637 阅读 · 0 评论