2012 年文章归档
共 59 篇文章
IOS 开发,调用打电话,发短信,打开网址
转自:http://www.cnblogs.com/zcw-ios/articles/2607985.html 1、调用 自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]]; 2、调用 电话phone [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]]; 3、调用 SMS [[UIApplication sharedAppli…
2012-12-14 03:44 · ios
[ios]IOS 摄像头使用(1)-UIImagePickerController
转自:http://www.cnblogs.com/phnix/archive/2012/08/24/2653656.html 项目dkt:wirteVC 随笔- 17 文章- 0 评论- 6 IOS 摄像头使用(1)-UIImagePickerController IOS有两种拍照与拍摄视频的方式 1. 直接使用** UIImagePickerController , 这可以提供一个简单便捷的拍照与选择图库里图片的功能.** 2.另一种方式就是通过 AV Foundation framework ,来完全自定义拍照的界面与选择图库的界面. 这里介绍第一种, 如何使用 UIImagePick…
2012-12-12 11:47 · ios
[转]Objective-c NSDate 取时间,日期,星期,毫秒等
NSDate //得到当前的日期 NSDate *date = [NSDate date]; NSLog(@"date:%@",date); //得到(24 * 60 * 60)即24小时之前的日期,dateWithTimeIntervalSinceNow: NSDate *yesterday = [NSDate dateWithTimeIntervalSinceNow: -(24 * 60 * 60)]; NSLog(@"yesterday:%@",yesterday); NSDateFormatter *formatter =[[[NSDateFormatter alloc] init]…
2012-12-11 12:46 · ios
[ios]获取屏幕分辨率
UIScreen *mainScreen = [UIScreen mainScreen]; CGSize size = [mainScreen bounds].size; CGFloat scale = [mainScreen scale]; CGFloat screenWidth = size.width * scale; CGFloat screenHeight = size.height * scale;
2012-12-08 08:38
[android]Scroller 的一些思考
参考: Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解 http://blog.csdn.net/qinjuning/article/details/7419207 Scroller 与scrollby/scrollto的区别 Scroller的构造方法是new Scroller(context ); 他是 在执行startScroll(int x,int y,int dx,int dy,int dt);请求当前context下的view 执行自己的computeScroll()方法 【注:这个方法默认是空方法,需要自己覆写】从而实现移动 public …
2012-10-29 17:59 · ios
[ios]categories 动态增加方法
对Photo增加名为"AddOn"的 categories @interface Photo (AddOn) //AddOn categories名 - (UIImage *)image { blablalbalba…… } -(BOOL)isOld{ blablalbalba…… } @end
2012-10-29 15:04 · ios
[android]动态改变按钮背景状态 StateListDrawable
动态改变按钮背景状态 很少用到 上次和六哥聊到。六哥有心 查了下 以下是DEMO public static StateListDrawable setStateListDrawable(Context mActivity, int up, int down) { StateListDrawable stateListDrawable = new StateListDrawable(); BitmapDrawable db = new BitmapDrawable(mActivity.getResources(), LoadImage.loadImage(mActivity.getResou…
2012-10-29 10:52 · Android
[ios]tableView内部cell因内容大小变换 而变化 sizeWithFont:constrainedToSize: lineBreakMode:
[NSString*对象 sizeWithFont:constrainedToSize:] 这个方法用于获取 以传入模式下的 字符串像素大小。 这玩意今天坑了我很久。表示 各种陷阱。 如果你是从android转过来的 请看看下面。 首先 如果使用ios6的autolayout你会在最后发现你被坑了。 然后ios 的tablecell不会随着你的内容变化的缩小放大。 lableView也不会。 更蛋疼的是lableView不会换行--》也就是说你需要自己处理换行。今天用了个递归去+“/n” 自己换行就算了- -,还需要自己设置行数。否则显示不出来的亲。 【改:如果你把行数默认成0的话 他会自适…
2012-10-25 20:42 · ios
[ios]设置tableView的sectionIndex
今天逛devdiv发现这个了这个东西然后自己就写了个demo看看 以前看iphone app经常在table右边有一个列表。可以用于快速选择。 这个就是sectionIndexTitle了 设置sectionIndex -(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; 此时是默认对应 顺序对应 sectionIndex根据顺序对应 到section 修改sectionIndex对应 - (NSInteger)tableView:(UITableView *)tableView sectionForSect…
2012-10-25 10:27 · ios
[ios]persistence 持久化
Property List Archiving Objects 保存成 arbitrary graphs[对象映射图] Storing things in the Filesystem Application bundle directory[不可写,如要修改则丢出来到 其他目录 然后修改 ] Documents directory Caches directory other (使用NSSearchPathDirectory获得) 获得这些directory 的URl通过 -(NSArray *)URLsForDirectory:(NSSearchPathDiretory)director…
2012-10-24 18:12 · ios
[ios]NSUserDefaultDemo 类似android shareP
NSUserDefaultDemo 类似android的shareP 短小的信息持久化 比如说 用户配置信息等。 直接通过NSUserDefaults存取。 它的实质是使用plist保存的理论存放为手机存储大小。 获取[NSUserDefaults standardUserDefaults]; 如果增加/修改了内容则需要执行下,以提交。 [NSUserDefaults resetStandardUserDefaults]; 操作类似NSMutableDictionary;键值操作 增加/修改 [userDefault setObject:self.textField.text forKey:…
2012-10-24 11:13 · ios
[ios]隐藏键盘
在View的UITextField中经常需要输入完文字后隐藏软键盘,要实现着一点要让View的Controller实现UITextFieldDelegate代理,然后编写相应的代码。 #import <UIKit/UIKit.h> @interface TestVeiwController : UIViewController<UITextFieldDelegate> { IBOutlet UITextField *txt; } @property (nonatomic,retain) UITextField *txt; @end 然后记得要指定文本框的代理 - (void)viewDidL…
2012-10-24 10:39 · ios
[ios6] 基于CoreLocation 的地图demo
自定义showCallout 左右view - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{ MKAnnotationView *aView=[mapView dequeueReusableAnnotationViewWithIdentifier:@"testMapView"]; if(!aView){ aView=[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIde…
2012-10-23 00:00 · ios
[ios] 截屏demo
截屏demo 实现思想。 将当前self.view renderIn 当前ImageContext 然后绘制。 demo结合 基于soclia发送微博 截屏DEMO2 //方法2 UIGetScreenImage方法 是apple的私有方法 有概率不让上架 UIImage *snapshot; CGImageRef cgScreen = UIGetScreenImage(); if (cgScreen) { snapshot = [UIImage imageWithCGImage:cgScreen]; CGImageRelease(cgScreen); } UIScreen *mainScr…
2012-10-22 14:41 · ios
[ios]基于Social.framework 的ios6微博分享
今天扫论坛问题时看到说ios6有一个通过Social.framework的sns分享效果 就查了些资料 做了个DEMO 感觉比android通过intent实现分享还简单=-= 多一种实现分享微博的方法。 说下优缺点: 优点: 简单,快速,苹果支持什么他就支持什么[而且我们认为苹果未来绝对会支持更多的SNS] 缺点: io6+,大陆方面目前只支持新浪微博,神马腾讯,网易,xx都没有。界面不可定制。 总结:感觉在显示使用中 如果不担心友盟监听你的数据的话 友盟的那套支持新浪 腾讯 人人的包会更好点。 不过未来苹果会怎么做呢?没人知道 这位写的更详细: http://www.cnblogs.co…
2012-10-22 14:08
[ios] GCD-Grand Central Dispatch
GCD Grand Central Dispatch 大中枢派发。//感觉类似 android handler 但是好像更强大的样子 用于将BLOCK 放到其他线程中执行。 使用C语言。 并且 队列执行完 需要手动release(队列名)。 举例:适用于从网络获取数据。并且更新ui(更新UI使用GDC的dispath_async(dispatch_get_mainqueue(),^{block内容}) 此段代码含义为 在主线程队列执行 block内容) demo: 一个通过gdc获取网络图片并且刷新ui的demo - (void)viewWillAppear:(BOOL)animated {…
2012-10-18 16:35 · ios
[ios] blocks
blocks: 有序列的代码指令块 ^(){ blocksContent. } 1外部参数对block read only 2但是如果外部对象 为 __block x类型 xxx; 则可以在block中使用。 3如果你在block中写了一个实例对象。 这个对象是在block外也可以使用的。 ios 实例变量 _x typedef double (^xxx)(double op) 类别为:xxx 传入参数:1个 doulbe类型 返回类型:double 如果是 double (^xxx)(double op)=^(double op){return op * op} 则是直接对xxx设置blo…
2012-10-18 11:19 · ios
[ios] NSNumber->NSInteger
很弱智的内容 只是我今天竟然去查了api。。SO MARK。 NSNumber->NSInteger NSNumber * x; [x integerValue];//返回 NSInteger NSNumber 转Integer,float等的时候就用 [NSNumber对象 xxxxValue];//xxx是你想要的数值类型【不需要NS】。
2012-10-17 18:03 · ios
[ios]plist 加载
- (void)viewDidLoad { [super viewDidLoad]; NSString *Plist=[[NSBundle mainBundle] pathForResource:@"studentList" ofType:@"plist"]; //通过文件名(资源)获取路径 NSDictionary *dt=[[NSDictionary alloc]initWithContentsOfFile:Plist]; //通过通过文件创建字典。 NSDictionary *studentD=[dt objectForKey:@"student"]; //通过通过key找到二级字典 …
2012-10-16 18:25 · ios
[ios]如何创建一个全屏iphone应用
转自:http://heidianfeng.blog.163.com/blog/static/618434562010112123226240/ 如何创建一个全屏iPhone应用 在这个简短的教程中,我要告诉你如何建立一个全屏iPhone应用程序。 这篇文章可能是大家谁想要建立一个为iPhone平台的游戏很有用。 您将需要苹果开发工具和iPhone SDK的计算机上安装在你要完成本教程。 有两种方法; 在您的应用Info.plist中添加一个布尔关键UIStatusBarHidden并将其设置为true。 在运行时可以调用setStatusBarHidden您的应用程序来显示/隐藏状态栏。 …
2012-10-16 16:51 · ios