随笔分类 -  IPhone

摘要:这个是基于IOS5.0的ImagePicker,所以都没有release,大家适当加上去吧~先上效果图:小牺牲一下我小侄吧...#import <UIKit/UIKit.h> @interface DemoViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIActionSheetDelegate> @property (weak, nonatomic) IBOutlet UIImageView *selectedImage; 阅读全文
posted @ 2012-04-10 23:39 el. 阅读(881) 评论(0) 推荐(0)
摘要:这个是使用一个切片,使其填充到整个NavigationBar上面。- (void)viewDidLoad { [super viewDidLoad]; UIImage *smallImage = [UIImage imageNamed:@"hc_03.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:smallImage]; [imageView setFrame:CGRectMake(0, 20, 320, 44)]; imageView.contentM... 阅读全文
posted @ 2011-12-07 13:04 el. 阅读(518) 评论(0) 推荐(0)
摘要:- (void)webViewDidFinishLoad:(UIWebView *)webView { [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none';"]; }Customize the contextual menu of UIWebView 阅读全文
posted @ 2011-12-06 11:58 el. 阅读(198) 评论(0) 推荐(0)
摘要:NSString *htmlString = [NSString stringWithFormat: @"<html>" "<head>" "<meta name='viewport'" "content='width=device-width; initial-scale=1.0; maximum-scale=10.0;'" ">" ... 阅读全文
posted @ 2011-12-06 09:55 el. 阅读(1100) 评论(0) 推荐(0)
摘要://修改删除按钮的文字 -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { return @"删除"; } 阅读全文
posted @ 2011-12-05 10:42 el. 阅读(905) 评论(0) 推荐(0)
摘要:iPhoneApp获取文件教程是本文要介绍的内容,对于一个运行在iPhone得app,它只能访问自己根目录下得一些文件(所谓sandbox).一个app发布到iPhone上后,它得目录结构如下: 1、其中得 approot可以用 NSHomeDirectory() 访问到; 2、Documents 目录就是我们可以用来写入并保存文件得地方,一般可通过:NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString*documentsDirector... 阅读全文
posted @ 2011-11-29 18:52 el. 阅读(415) 评论(0) 推荐(0)
摘要:上代码!关键代码: UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setString:@"南方基地"]; 阅读全文
posted @ 2011-11-29 18:34 el. 阅读(161) 评论(0) 推荐(0)
摘要:不解释,直接上代码 NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; NSString *name = [infoDictionary objectForKey:@"CFBundleDisplayName"]; NSString *version = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; NSString *build = [infoDictionary objectForKey: 阅读全文
posted @ 2011-11-29 15:42 el. 阅读(2929) 评论(0) 推荐(0)
摘要:开发环境:XCode4.2操作系统:Lion 10.7.21.打开XCode,选择Create a new Xcode project;2.新建一个空项目,Empty Application3.Next.输入产品名称与公司名。其他不用填。先简单介绍一下下面这三个东西,以后再研究。Core Data 是数据库操作的一个组件ARC是IOS5的新特性,不用再自己手动释放内存Unit Test是单元测试,但是我自己没用过。4.点击Create就搞掂了。但是现在Xcode4.2与以往的Xcode3不一样,没有了mainWindow这个东东,所以不习惯的童鞋可以使用一下步骤,自己新建一个mainWindo 阅读全文
posted @ 2011-11-28 19:46 el. 阅读(491) 评论(0) 推荐(0)
摘要:1. XCode新建文件后,头部会有开发人员名称,公司名称等信息//Created by Richard Clarke on 11-6-7.// Copyright Surna Hongkong Limited2011. All rights reserved.要修改这两个名称可通过在terminal中运行以下命令:defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions'{"ORGANIZATIONNAME" = "My Company";}'defaults wr 阅读全文
posted @ 2011-11-26 10:55 el. 阅读(164) 评论(0) 推荐(0)
摘要:http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TextandWeb/TextandWeb.htmlListing 5-1 Handling the keyboard notifications// Call this method somewhere in your view controller setup code.- (void)registerForKeyboardNotifications{ [[NSNotificationCent. 阅读全文
posted @ 2011-11-26 10:24 el. 阅读(138) 评论(0) 推荐(0)
摘要:今天在调试中发现不断出现内存泄漏,后来调试后发现原来是因为UIButton在delloc的时候release了..因为UIButton在创建的时候是使用ButtonWithType的方法,而不是alloc或者create,只有在使用alloc与create关键字的方法下创建对象才会使此对象热retain值+1;而release是使retain-1,所以在创建UIButton之后是不需要releasse的 阅读全文
posted @ 2011-09-03 14:24 el. 阅读(192) 评论(0) 推荐(0)
摘要:今天使用网易公开课的时候发现,它的视频播放还不错,自己之前做的那个实在太卡,没有缓冲没有线程,于是乎就打算修改一下。结合performselect使用线程感觉还是不错的。头文件,里面主要是一个标志位,一个MPMoviePlayerViewController。//// PlayVideoViewController .h//// Created by Leung Kinglok on 11-6-23.// Copyright 2011年 scnu. All rights reserved.//#import <UIKit/UIKit.h>@class MPMoviePlayerVi 阅读全文
posted @ 2011-06-23 13:36 el. 阅读(1161) 评论(0) 推荐(0)