IPhone编程
文章平均质量分 81
EricSuper
这个作者很懒,什么都没留下…
展开
-
修改NavigationController中backbutton
在父viewController中如下设置: UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init]; backbutton.title = @"返回列表"; self.navigationItem.backBarButtonItem = backbutton; [backbutton re原创 2012-02-11 19:36:09 · 5123 阅读 · 0 评论 -
iPhone Tutorial: Adding a search bar in TableView
So to start create a new ViewBased Project and name it as MySearchScreenApp. You can start with any template you want but you can find in my previous posts why I always start with the most basic templ转载 2012-02-03 00:42:12 · 898 阅读 · 0 评论 -
Transitioning to ARC Release Notes
Automatic Reference Counting (ARC) is a compiler feature that provides automatic memory management of Objective-C objects. Rather than having to think about about retain and release operations, ARC al转载 2012-01-07 22:53:18 · 1530 阅读 · 0 评论 -
__week and autorelease pool in ARC in Xcode 4.2
NSString __weak *string;@autoreleasepool { string = [NSString stringWithFormat:@"%@", @"AAA"];}NSLog(@"string: %@", string);it outputs as the following what you want.string: (null)转载 2012-01-08 01:27:28 · 1273 阅读 · 0 评论 -
Automatic Reference Counting
Friday Q&A 2011-09-30: Automatic Reference CountingSince the moment Apple announced it, readers have asked me to write about Automatic Reference Counting, or ARC. Today is the day. I'll talk about A转载 2012-01-08 01:26:19 · 5316 阅读 · 0 评论 -
Automatic Reference Counting
LLVM HomeClang InfoAboutFeaturesComparisonsRelated ProjectsUser's ManualLanguage CompatibilityLanguage ExtensionsC++ StatusClang DevelopmentGet StartedGet InvolvedOpen ProjectsClang InternalsH转载 2012-01-06 23:13:16 · 1680 阅读 · 0 评论 -
Automatic Reference Counting
Automatic Reference Counting1. About this document1.1. Purpose1.2. Background2. General3. Retainable object pointers3.1. Retain count semantics3.2. Retainable object pointers as operan转载 2012-01-06 23:12:15 · 2660 阅读 · 0 评论 -
Automatic Reference Counting
Automatic Reference Counting1. About this document1.1. Purpose1.2. Background2. General3. Retainable object pointers3.1. Retain count semantics3.2. Retainable object pointers as operan转载 2012-01-06 23:14:24 · 1032 阅读 · 0 评论 -
将NSString转换编码集变为GBK或GB2312
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);NSString *retStr = [[NSString alloc] initWithData:data encoding:enc];附:编码集列表CFStringEncod转载 2011-12-12 21:47:35 · 3548 阅读 · 0 评论 -
How to use NSJSONSerialization
Your code seems fine except the result is an NSArray, not an NSDictionary, here is an example:The first two lines just creates a data object with the JSON, the same as you would get reading it转载 2011-12-11 00:45:36 · 2007 阅读 · 0 评论 -
远程读取中文网页内容并显示, keyword: html, stringWithContentsOfURL encoding
远程读取中文网页内容并显示, keyword: html, stringWithContentsOfURL encoding 实现的功能很简单,就像远程抓取www.baidu.com的网页内容,就像在浏览器里view->source看到的内容。最初的代码:UITextView *web = [[UITextView alloc转载 2011-12-11 00:43:59 · 1600 阅读 · 0 评论 -
iphone:html中文nsdata->nsstring乱码
NSStringEncoding strEncode = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000); NSString *strReceive = [[NSString alloc] initWithData:receivedData encoding:strEncode];转载 2011-12-11 00:50:53 · 2619 阅读 · 1 评论 -
从零开始开发iPhone,教你如何在真机调试iPhone应用程序
钥匙串访问(Keychain Access)工具打开主菜单- 证书助理(Certificate Assistant)-从证书代理请求证书(Request a Certificate From a Certificate Authority)输入iDP注册时的email,用户名自定义,选择“存储到磁盘”,选择‘Let me specify key pair information’。选择转载 2012-02-05 22:30:30 · 981 阅读 · 0 评论 -
iPhone NavigationBar和UIToolbar基础
navigation bar 分为三个部分,左按钮,右按钮和中间的View.在Controller中可以通过以三个方式来引用: self . navigationItem. titleViewself . navigationItem. leftBarButtonItemself . navigationItem. rightBarButtonItem左右按转载 2012-02-08 00:58:43 · 946 阅读 · 0 评论 -
UIWebView如何打开本地的网页
1,在xib文件中加入UIWebView控件。连接Controller中的对应的IBOutlet。@interface AboutViewController : UIViewController { IBOutlet UIWebView *webView;}@property(nonatomic,retain) UIWebView *webView;@end2,将html文原创 2012-02-13 17:41:36 · 3309 阅读 · 0 评论 -
UIWebView 显示本地html及引用资源
有些软件中可能会用到html页面,比如用在做帮助页面或者其它相关信息时。 这种情况下只需要将html页面文件以及索引用到的资源(图片、声音等) 都加入到bundle中,或者单独创建一个bundle, 在需要的时候调用UIWebView的相关方法即可NSBundle* bundle = [NSBundle mainBundle];NSString* resPath = [bunder res转载 2012-02-13 20:30:53 · 2018 阅读 · 0 评论 -
Xcode中下载和使用离线文档
1. 在Xcode的Preference菜单中选Downloads-Documentation,点击希望下载的文档,点左下角的上箭头图标,展开该项目的详细信息。2. 在详细信息中找到Feed地址,用Safari浏览器访问该地址,例如iOS 5的文档http://developer.apple.com/rss/com.apple.adc.documentation.AppleiPhone5_0.转载 2012-02-13 15:04:33 · 2130 阅读 · 0 评论 -
ScrollView Image ZOOM
[scrollView2 setMinimumZoomScale:1.0];[scrollView2 setMaximumZoomScale:4.0];[scrollView2 setDelegate:self];-(UIView *)viewForZoomingInScrollViewUISc原创 2012-02-13 14:33:23 · 1177 阅读 · 0 评论 -
在scrollview中双击定点放大的代码
双击放大是 iPhone 的一个基本操作,第三方程序里引入这一功能的话,主要是在 scrollview 呈现一张图片或者 PDF 页面时,双击可以放大,主要代码如下- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{ NS转载 2012-02-13 00:05:50 · 1066 阅读 · 0 评论 -
Xcode 4.1/4.2/4.2.1 免证书(iDP)开发+真机调试+生成IPA全攻略
开发环境使用的是目前为止最新的稳定版软件:Mac OS X Lion 10.7 + Xcode 4.1目前Xcode 4.2 Preview版也已经发布,据说其修改方法跟4.1非常类似,只改动了一行代码,请参看参考文章的第二篇。本文仍以4.1版本为例。更新:现在Xcode 4.2正式版和iOS 5均已发布,下面补充上4.2的修改方法。(2011-10-24)各步骤会标明版本,比如(Xc转载 2012-02-13 14:56:12 · 935 阅读 · 0 评论 -
细说UIScrollView上的Touch 事件
1 开篇最近在项目中遇到一个 需求就是在一个可以左右拨动的页面上,添加一些交互功能,比如说点击某个页面会有文字变化,图片变换,最后有比较特殊的需求是做个像slider功能的可以拖动的按钮,并且有吸附功能,即当滑动停止在两个图标间的时候,可以滑向离自己比较近的图标。(PS:本人是新手,哈哈,高手就全当路过吧),一看到的时候觉的没什么问题,很简单的不就是一个scrollview+t转载 2012-02-13 00:04:18 · 737 阅读 · 0 评论 -
修改navigation Bar 中部的title内容
如果建立的是NavigationBar就是。NavigationBar.topItem.title = @"your title";如果是NavigationController。。那就是self.navigationItem.title = @"your title";转载 2012-02-11 21:30:04 · 1306 阅读 · 0 评论 -
@selector 里面的方法名加参数
iPhone: NSTimer and that thing called userInfoTuesday, May 12, 2009 As I am implementing some stuff, I had reason to send along some information to a NSTimer's "onComplete" method. Eve转载 2012-02-08 14:05:27 · 5277 阅读 · 0 评论 -
改变导航条样式
转载 http://hua397.iteye.com/blog/11812991.背景色:(http://stackoverflow.com/questions/2259929/iphone-navigationbar-custom-background)网上说用category给UINavigationBar重写drawRect:@implementation UINav转载 2012-02-08 00:56:52 · 1166 阅读 · 0 评论 -
How to use the Segmented Control
Here is How You Use the Segmented Control [UISegmentedControl]by MattjDrake on SEPTEMBER 15, 2009 in CODE TIPSA segmented control displays a list of options that a user can choose from.转载 2012-01-01 14:43:19 · 1433 阅读 · 0 评论 -
iPhone UITableView异步加载图片
// Customize the appearance of table view cells.- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdent转载 2011-11-28 21:41:09 · 1348 阅读 · 0 评论 -
iPhone UITableView异步加载图片
//AsyncImageView.h#import @interface AsyncImageView : UIView { NSURLConnection*connection; NSMutableData*data;}- (void)loadImageFromURL:(NSURL*)url;转载 2011-11-28 21:25:19 · 2050 阅读 · 1 评论 -
Labels aligning in UITableViewCell
I use UITableView with cells created using UITableViewCellStyleSubtitle. Every cell's height is dynamically adjusted using the- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(N转载 2011-11-28 20:51:47 · 911 阅读 · 0 评论 -
In an iOS 5 Storyboard, how do you push a new scene to the original view controller from a Popover?
Sounds like it should work, but if it doesn't try the following: 1. Click the segue that doesn't work and give it an identifier. Let's say it's PopoverToNewSegue.In your implementation file fo转载 2011-11-22 09:23:16 · 508 阅读 · 0 评论 -
iPhone SDK Examples
This site is meant for the relatively new iPhone Developer who just wants simple examples to common tasks. It is meant as a starting point. Please take the time to read the documentation and under转载 2011-11-22 09:22:34 · 549 阅读 · 0 评论 -
Working with JSON in iOS 5 Tutorial
http://www.raywenderlich.com/5492/working-with-json-in-ios-5Note from Ray: This is the eighth iOS 5 tutorial in the iOS 5 Feast! This tutorial is a free preview chapter from our new bookiOS转载 2011-11-22 08:49:58 · 2157 阅读 · 0 评论 -
performSelectorOnMainThread
[selfperformSelectorOnMainThread:@selector(fetchedData:) withObject:datawaitUntilDone:YES];会创建一个新的线程实行fetchedData函数,并传入参数data,并且会等待函数退出后再继续执行。- (void)fetchedData:(NSData *)responseData {转载 2011-11-22 08:47:36 · 24162 阅读 · 8 评论 -
XCode4.2中使用Empty Application模板替代旧的Window Based Application
“FYI, I am very newbie in iPhone development.”I had upgraded Xcode to 4.2 beta 4 and realised that there is no more templates for iOS 4.Obviously, it did not include iOS 4 SDK because it said “w转载 2011-11-22 10:27:15 · 1127 阅读 · 0 评论 -
IOS error 汇总
error: Semantic Issue: Interface type cannot be statically allocated?You're probably missing '*' before imageWithCaptionController, your line should beUIViewController *imageWithCaptionContr转载 2011-11-22 10:18:15 · 474 阅读 · 0 评论 -
iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part I
With iOS 5, Storyboards represent a significant change to how we, as developers, construct our user interfaces using Interface Builder. So far my experience of Storyboards has been extremely positive转载 2011-11-22 10:16:36 · 1591 阅读 · 0 评论 -
iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part III
General Storyboard Tips and ResourcesUIStoryboard is a runtime representation of everything configured inside Interface Builder as such any individual scene can be loaded using either,[UIStorybo转载 2011-11-22 09:24:31 · 912 阅读 · 0 评论 -
IPHONE JSON 一个例子
Objective-CWorks with: Mac OS X version 10.7+untestedNSString *json_string = @"{ \"foo\": 1, \"bar\": [10, \"apples\"] }"; id obj =[NSJSONSerialization JSONObjectWithData:[json_string dataUsingE转载 2011-11-22 09:12:56 · 799 阅读 · 0 评论 -
navigation bar 隐藏
在viewController中的viewdidload方法中设置属性self.navigationController.navigationBarHidden=YES;原创 2011-11-22 08:57:46 · 1305 阅读 · 0 评论 -
iphone文件操作
如何在iPhone OS下创建、删除、读取、写入文件 创建与删除: //创建文件管理器 NSFileManager *fileManager = [NSFileManager defaultManager]; //获取路径 //参数NSDocumentDirectory要获取那种路径 NSArray *paths = NSSearchPa转载 2011-11-22 08:51:54 · 727 阅读 · 0 评论 -
How to use custom delegates in Objective-C
You will want to declare a delegate protocol for your class. An example of a delegate protocol and interface for class Foo might look like this:view plain@class Foo; @protocol FooDelegate @opti转载 2011-11-22 10:18:47 · 428 阅读 · 0 评论