wonderzl的博客
wonderzl · 共 32 篇文章
选取相册视频,并获得路径。
- (NSString*)videoAssetURLToTempFile:(NSURL*)url { NSString * surl = [url absolutestring]; NSString * ext = [surl substringfromindex:[surl rangeofstring:@"ext="].location + 4]; NSTimeInterval ti = [[nsdate date]timeIntervalSinceReferenceDate]; NSString * filename = [nsstring stringwithformat: @"%f.…
2012-07-18 10:18 · iPhone开发 · 评论(0)
ad-hoc及企业版app打包之后在itunes中图标为白色的问题
准备512*512大小的png(将要显示的图片),在终端执行以下命令: $ output="Releases/$(date)" $ mkdir -p "$output" $ mkdir -p Payload/Payload $ cp -Rp build/Release-iphoneos/MyApp.app Payload/Payload $ cp MyApp.iTunesArtwork.png Payload/iTunesArtwork $ ditto -c -k Payload "$output/MyApp.ipa" $ rm -rf Payload
2012-07-03 16:36 · iPhone开发 · 评论(0)
iOS工具类之16进制颜色转为UIColor
将16进制颜色如#FF0000,转换为UIColor: #define DEFAULT_VOID_COLOR [uicolor whitecolor] + (UIColor *)colorWithHexString:(NSString *)stringToConvert { NSString *cString = [[stringtoconvert stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]] uppercaseString]; if ([cstring length] <…
2012-06-27 16:33 · iPhone开发 · 评论(0)
调试内存问题
Project -> Edit Scheme -> Run ***(工程名) -> Arguments -> Environment Variables添加 NSZombieEnabled YES MallocStackLogging YES MallocStackLoggingNoCompact YES
2012-06-12 10:14 · iPhone开发 · 评论(0)
Content-type的对应的一些类型
<?php $mime_type_match[ 'jpg '] = array( "image/jpeg ", "image/pjpeg "); $mime_type_match[ 'jpeg '] = array( "image/jpeg ", "image/pjpeg "); $mime_type_match[ 'gif '] = array( "image/gif "); $mime_type_match[ 'png '] = array( "image/png ", "image/x-png "); $mime_type_match[ 'tif '] = array( "image/…
2012-05-30 09:52 · 综合 · 评论(0)
[转]iOS开发之详解剪贴板
概述: 在iOS中,可以使用剪贴板实现应用程序之中以及应用程序之间实现数据的共享。比如你可以从iPhone QQ复制一个url,然后粘贴到safari浏览器中查看这个链接的内容。 一、在iOS中下面三个控件,自身就有复制-粘贴的功能: 1、UITextView 2、UITextField 3、UIWebView 二、UIKit framework提供了几个类和协议方便我们在自己的应用程序中实现剪贴板的功能。 1、UIPasteboard:我们可以向其中写入数据,也可以读取数据 2、UIMenuController:显示一个快捷菜单,用来复制、剪贴、粘贴选择的项。 3、UIResponder中…
2011-12-05 11:43 · iPhone开发 · 评论(0)
过滤html标签(修改版)
- (NSString *)flattenHTML:(NSString *)html { NSScanner *theScanner; NSString *text = nil; theScanner = [nsscanner scannerwithstring:html]; while ([thescanner isatend] == NO) { // find start of tag [thescanner scanuptostring:@"<" intostring:null] ; // find end of tag [thescanner scanuptostring:@">" …
2011-12-01 10:44 · iPhone开发 · 评论(0)
[转] iPhone:UIImage 图像截取,等比例缩放
@interface UIImage(UIImageScale) -(UIImage*)getSubImage:(CGRect)rect; -(UIImage*)scaleToSize:(CGSize)size; @end @implementation UIImage(UIImageScale) //截取部分图像 -(UIImage*)getSubImage:(CGRect)rect { CGImageRef subImageRef = CGImageCreateWithImageInRect(self.CGImage, rect); CGRect smallBounds = CGRect…
2011-09-29 10:02 · iPhone开发 · 评论(0)
[转载]iPhone文件系统NSFileManager
iPhone文件系统:创建、重命名以及删除文件 NSFileManager中包含了用来查询单词库目录、创建、重命名、删除目录以及获取/设置文件属性的方法(可读性,可编写性等等)。 每个程序都会有它自己的沙盒,通过它你可以阅读/编写文件。写入沙盒的文件在程序的进程中将会保持稳定,即便实在程序更新的情况下。 如下所示,你可以在沙盒中定位文件目录: //对于错误信息 NSError *error; // 创建文件管理器 NSFileManager *fileMgr = ; //指向文件目录 NSString *documentsDirectory= ; //创建一个目录 createDirecto…
2011-09-09 11:41 · iPhone开发 · 评论(0)
UIImage用imageNamed的内存问题
@implementation UIImage(imageNamed_Hack) (UIImage *)imageNamed:(NSString *)name { NSString *path = bundlePath], name]; return ; } @end
2011-09-08 09:33 · iPhone开发 · 评论(0)
截屏存图片到相册或者指定路径
#import <QuartzCore/QuartzCore.h> UIGraphicsBeginImageContext(currentView.bounds.size); //currentView当前的view [currentview.layer renderincontext:uigraphicsgetcurrentcontext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlb…
2011-06-13 11:15 · iPhone开发 · 评论(0)
存图片和视频到iPhone相册
UIImage *img = [uiimage imagenamed:@"daziran.jpg"]; // 保存图片到相册中 UIImageWriteToSavedPhotosAlbum(img, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); 当保存完成后,调用的回调方法: - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { // Was t…
2011-04-19 09:33 · iPhone开发 · 评论(0)
选择相册图片并保存
.h中: <UINavigationControllerDelegate, UIImagePickerControllerDelegate> .m中 - (IBAction)selectPhoto { NSLog(@"%@",NSStringFromSelector(_cmd)); if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypephotolibrary]) { UIImagePickerController *picker = [[uiimagepickercontrol…
2011-04-19 08:18 · iPhone开发 · 评论(0)
Push一个横屏页面
setOrientation: UIInterfaceOrientationLandscapeRight],使用此方法可强制性的转为横屏,但在3.0以后此方法是私有方法。所以,好的方法是通过view的transform来转为横屏。 [[uiapplication sharedapplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: YES]; CGFloat duration = [uiapplication sharedapplication].statusBarOrientat…
2011-03-28 16:39 · iPhone开发 · 评论(0)
NSPredicate及正则的一点使用
记录一点正则表达式的使用。 例如:判断字符串首字母是否为字母。 NSString *regex = @"[a-za-z]+"; NSPredicate *predicate = [nspredicate predicatewithformat:@"self matches %@", regex]; if ([predicate evaluatewithobject:astring]) { } 判断Array中是否包含某一规则的对象,并返回一个数组: NSPredicate *filterPredicate = ; 并调用:- (NSArray *)filteredArrayUsingPred…
2011-03-21 14:38 · iPhone开发 · 评论(0)