- 浏览: 309003 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
u011076522:
写的确实不错,总结的很好,内容大都属实
C/C++内存分配方式 -
水晶魔方:
...
联合编译工具推荐IncrediBuild -
caiwb1990:
又看了一遍~ 越看越清晰~
C/C++内存分配方式 -
caiwb1990:
每次准备面试的时候来瞅瞅。timer_yin 写道好文,正好补 ...
TCP/IP、Http、Socket的区别【转】 -
caiwb1990:
互相学习~kongxuan 写道这个不错,用简单的话将事情讲明 ...
TCP/IP、Http、Socket的区别【转】
1. 调用
2. 16进制颜色值的转换
3.md5
4.计算2个经纬度之间距离
5.输入框中是否有个叉号,在什么时候显示,用于一次性删除输入框中的内容
6.iOS本地推送
7.点击链接直接跳转到 App Store 指定应用下载页面
8.父级view 不响应touch事件 子view相应事件
9.给视图加上倒影效果
//1、调用 自带mail [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"mailto://admin@gmail.com"]]; //2、调用 电话phone [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"tel://8008808888"]]; //3、调用 SMS [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"sms://800888"]]; //4、调用自带 浏览器 safari [[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"http://http://caiwb1990.iteye.com"]]; //调用phone可以传递号码,调用SMS 只能设定号码,不能初始化SMS内容。
2. 16进制颜色值的转换
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
3.md5
+ (NSString*)md5:(NSString*)str { constchar*cStr = [str UTF8String]; unsignedcharresult[16]; CC_MD5(cStr, strlen(cStr), result); return[NSStringstringWithFormat:@"XXXXXXXXXXXXXXXX", result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], result[10], result[11], result[12], result[13], result[14], result[15] ]; }
4.计算2个经纬度之间距离
+(double)distanceBetweenOrderBy:(double)lat1:(double)lat2:(double)lng1:(double)lng2{ CLLocation* curLocation = [[CLLocationalloc]initWithLatitude:lat1longitude:lng1]; CLLocation* otherLocation = [[CLLocationalloc]initWithLatitude:lat2longitude:lng2]; doubledistance = [curLocation distanceFromLocation:otherLocation]; returndistance; }
5.输入框中是否有个叉号,在什么时候显示,用于一次性删除输入框中的内容
text.clearButtonMode=UITextFieldViewModeAlways;
6.iOS本地推送
第一步:创建本地推送 // 创建一个本地推送 UILocalNotification*notification = [[[UILocalNotificationalloc]init]autorelease]; //设置10秒之后 NSDate*pushDate = [NSDatedateWithTimeIntervalSinceNow:10]; if(notification != nil) { // 设置推送时间 notification.fireDate= pushDate; // 设置时区 notification.timeZone= [NSTimeZonedefaultTimeZone]; // 设置重复间隔 notification.repeatInterval= kCFCalendarUnitDay; // 推送声音 notification.soundName= UILocalNotificationDefaultSoundName; // 推送内容 notification.alertBody= @"推送内容"; //显示在icon上的红色圈中的数子 notification.applicationIconBadgeNumber= 1; //设置userinfo 方便在之后需要撤销的时候使用 NSDictionary*info = [NSDictionarydictionaryWithObject:@"name"forKey:@"key"]; notification.userInfo= info; //添加推送到UIApplication UIApplication*app = [UIApplicationsharedApplication]; [appscheduleLocalNotification:notification]; } 第二步:接收本地推送 - (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification{ UIAlertView*alert = [[UIAlertViewalloc]initWithTitle:@"iWeibo"message:notification.alertBodydelegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil]; [alertshow]; // 图标上的数字减1 application.applicationIconBadgeNumber-= 1; } 第三步:解除本地推送 // 获得 UIApplication UIApplication*app = [UIApplicationsharedApplication]; //获取本地推送数组 NSArray*localArray = [app scheduledLocalNotifications]; //声明本地通知对象 UILocalNotification*localNotification; if(localArray) { for(UILocalNotification*noti inlocalArray) { NSDictionary*dict = noti.userInfo; if(dict) { NSString*inKey = [dict objectForKey:@"key"]; if([inKey isEqualToString:@"对应的key值"]) { if(localNotification){ [localNotificationrelease]; localNotification = nil; } localNotification = [noti retain]; break; } } } //判断是否找到已经存在的相同key的推送 if(!localNotification) { //不存在初始化 localNotification = [[UILocalNotificationalloc]init]; } if(localNotification) { //不推送 取消推送 [appcancelLocalNotification:localNotification]; [localNotificationrelease]; return; } }
7.点击链接直接跳转到 App Store 指定应用下载页面
//跳转到应用页面 NSString*str = [NSStringstringWithFormat:@"http://itunes.apple.com/us/app/id%d",appid]; [[UIApplicationsharedApplication]openURL:[NSURLurlWithString:str]]; //跳转到评价页面 NSString*str = [NSStringstringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id;=%d", appid ]; [[UIApplicationsharedApplication]openURL:[NSURLurlWithString:str]];
8.父级view 不响应touch事件 子view相应事件
-(id)hitTest:(CGPoint)pointwithEvent:(UIEvent*)event { idhitView = [superhitTest:pointwithEvent:event]; if(hitView == self)returnnil; elsereturn hitView; }
9.给视图加上倒影效果
constCGFloat kReflectPercent = -0.25f; constCGFloat kReflectOpacity = 0.3f; constCGFloat kReflectDistance = 10.0f; + (void)addSimpleReflectionToView: (UIView*) theView { CALayer*reflectionLayer = [CALayerlayer]; reflectionLayer.contents= [theView layer].contents; reflectionLayer.opacity= kReflectOpacity; reflectionLayer.frame= CGRectMake(0.0f,0.0f, theView.frame.size.width, theView.frame.size.height* kReflectPercent); CATransform3Dstransform = CATransform3DMakeScale(1.0f, -1.0f,1.0f); CATransform3Dtransform = CATransform3DTranslate(stransform,0.0f, -(kReflectDistance + theView.frame.size.height),0.0f); reflectionLayer.transform= transform; reflectionLayer.sublayerTransform= reflectionLayer.transform; [[theViewlayer]addSublayer:reflectionLayer]; }
发表评论
-
Xcode6.2网盘下载地址
2015-03-15 09:14 2233Xcode6.2.dmg 网盘下载地址 http://p ... -
Mac OS bash基本命令失效后的修复
2014-10-30 17:08 3378升级系统后添加设备发现命令都失效了~ 比如: -bash: l ... -
Android设备在Mac上不能识别
2014-10-30 16:57 17439问题 本来Mac上做Android调试非常简单,实际上大部分 ... -
关于升级IOS8
2014-09-19 11:50 636升级IOS8差不多需要6G的空余空间。我觉得大部分人 ... -
XCode快捷键
2014-06-03 16:23 8241. 文件 CMD + N: 新文件 CMD + SHIF ... -
springboard无法启动应用程序 (错误:-3)
2014-03-05 08:04 1379自从升了Xcode5在ios7模拟器上调试的时候,经常会出 ... -
ios 检查网络
2013-11-08 15:39 814// 检测网络 if (([[Reachability ... -
ios- strong 和 weak的形象理解
2013-11-08 15:10 1278在网上看到了一个很形 ... -
如果还有不用ARC的,请告诉下原因
2013-06-21 14:21 989今天又看到有人在群里问有人用ARC吗? 呵呵,我是找不到不 ... -
必须推荐款 IOS APP
2013-06-06 11:24 1050Musyc By Fingerlab 非常有创意的一款音乐游 ... -
IOS开发-常见Exception
2013-11-08 15:01 599NSInvalidArgumentException: 未知选 ... -
发个sublime Text手册~~
2013-06-05 20:31 952台湾的,所有是繁体,不过挺不错哦 http://docs.s ... -
ios开发-类的"生命周期
2013-06-04 22:55 1196光有新学IOS的朋友问我 ... -
Xcode快捷键大全
2013-05-31 23:15 902... -
Mac快捷键大全
2013-05-31 23:10 2012全局 Cmd-C 复制文件 Cm ... -
IOS学习笔记1 --oc简介,语法
2012-08-24 11:31 2161学了段时间的IOS了, 把过去的学习笔记整理下把. iOS ...
相关推荐
ios 开发常用代码ios 开发常用代码
主要为大家详细介绍了iOS开发常用代码块,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
腾讯 QMUI Team 常用的 Xcode Code Snippets 代码片段,加速开发效率!.zip,用于Xcode使用的iOS通用代码片段,其中也包含若干专用于QMUI iOS框架的代码片段。
这就是Xcode的代码块功能,这篇文章跟大家分享一些常用的和自定义的代码块,有需要的下面来一起看看吧。 一、常用的: 1.strong: @property (nonatomic,strong) <#Class#> *<#object#>; 2.weak: @...
UserfulThirdRepo 1.用于收集记录一些常用的第三方库,便捷iOS开发,分析源码提高编程水平 2.保存项目中的一些代码块,方便以后开发中查看并使用
vtm-gdx常用 libgdx 后端代码 vtm-android-gdx安卓应用 vtm-desktop桌面应用程序 vtm-web HTML5/GWT 后端 vtm-web-app HTML5/GWT 应用程序 vtm-ios iOS 应用程序 GWT 和 iOS 的 libgdx 后端非常具有实验性。 入门 ...
IOS 由苹果公司开发的移动操作系统 Webkit 一个开源的浏览器引擎,在手机上的应用十分广泛 Webview WebView(网络视图)能加载显示网页,可以将其视为一个浏览器。它使用了WebKit渲染引擎加载显示网页 Activity ...
蜂巢源代码 Hive 节点实现。 - 这是大部分开发发生的地方。 - 稳定版本镜像在 GitHub 上。 前端 通用的 - Hive 的 Web 界面的开源实现,()。 - 适用于 Hive 的用户友好的成熟博客 dApp。 - 适用于 Android、iOS、...
通过职能划分,项目管理或特殊应用的处理都变得十分方便,例如可以轻松管理教师的电子教学开发平台。此外,也很容易确定升级网络服务的影响范围。 增加网络连接的灵活性 借助VLAN技术,能将不同地点、不同网络、...