2015年10月13日

事件分发、响应者链条 201905更新

摘要: iOS的三种事件:触摸事件/运动事件/远程控制事件 系列词语:事件传递、响应者链条、hitTest和pointInside typedef enum { UIEventTypeTouches, UIEventTypeMotion, UIEventTypeRemoteControl, } UIEven 阅读全文

posted @ 2015-10-13 22:02 🌞Bob 阅读(207) 评论(0) 推荐(0)

iPhone屏幕尺寸、分辨率及适配

摘要: 1.iPhone尺寸规格设备iPhone宽Width高Height对角线Diagonal逻辑分辨率(point)Scale Factor设备分辨率(pixel)PPI3GS2.4 inches (62.1 mm)4.5 inches (115.5 mm)3.5-inch320x480@1x320x4... 阅读全文

posted @ 2015-10-13 21:59 🌞Bob 阅读(537) 评论(0) 推荐(0)

collectionView布局原理及瀑布流布局方式--备用

摘要: 最近学习到了瀑布流的实现方法,瀑布流的实现方式有多种,这里应用collectionView来重写其UICollectionViewLayout进行布局是最为简单方便的。但再用其布局之前必须了解其布局原理。 在这里笔者挑出其中较为重要的几个方法来进行讲解。1.- (BOOL)shouldInvali... 阅读全文

posted @ 2015-10-13 21:36 🌞Bob 阅读(363) 评论(0) 推荐(0)

iOS 获得通讯录中联系人的所有属性--b

摘要: ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef results = ABAddressBookCopyArrayOfAllPeople(addressBook); for(int i = 0; i < CFArrayG 阅读全文

posted @ 2015-10-13 21:21 &#127774;Bob 阅读(317) 评论(0) 推荐(0)

iOS 后台运行实现 --备用

摘要: 文一我从苹果文档中得知,一般的应用在进入后台的时候可以获取一定时间来运行相关任务,也就是说可以在后台运行一小段时间。还有三种类型的可以运行在后以,1.音乐2.location3.voip文二在IOS后台执行是本文要介绍的内容,大多数应用程序进入后台状态不久后转入暂停状态。在这种状态下,应用程序不执行... 阅读全文

posted @ 2015-10-13 21:18 &#127774;Bob 阅读(291) 评论(0) 推荐(0)

iOS多线程常用类说明

摘要: iOS的多线程,涉及到如下一些类,这里集中做个介绍,免得混淆。 1、NSTimer 很显然,这是定时器类 2、NSTask iOS 不支持 NSTask 在很多并发操作的时候,多线程太耗资源,也太危险,这时候多进程出来了,通过 NSTask 可调用外部可执行程序 3、NSThread iOS 支持多 阅读全文

posted @ 2015-10-13 21:05 &#127774;Bob 阅读(269) 评论(0) 推荐(0)

iOS序列化与反序列化

摘要: 1到底这个序列化有啥作用?面向对象的程序在运行的时候会创建一个复杂的对象图,经常要以二进制的方法序列化这个对象图,这个过程叫做Archiving. 二进制流可以通过网络或写入文件中(来源于某教材的一段话)本人的理解是当你于写数据需要本地存储时,即将你的数据写到硬盘上的时候,你就必须对他进行序列化,转... 阅读全文

posted @ 2015-10-13 20:25 &#127774;Bob 阅读(211) 评论(0) 推荐(0)

iOS官方文档阅读 基本格式指北

摘要: 一些关键词作用 NS_AVAILABLE 表示可用 如 NS_AVAILABLE(NA, 6_0);例如上面这句就是表示 该方法在6.0系统后可用 如果在6.0以下的系统用不了的 或者直接崩溃. NS_DEPRECATED 表示弃用 如 NS_CLASS_DEPRECATED_IOS(4_0, 10 阅读全文

posted @ 2015-10-13 20:21 &#127774;Bob 阅读(250) 评论(0) 推荐(0)

iOS实现地图半翻页效果--老代码备用参考

摘要: // Curl the image up or downCATransition*animation = [CATransitionanimation];[animationsetDuration:0.35];[animationsetTimingFunction:UIViewAnimationCu... 阅读全文

posted @ 2015-10-13 20:19 &#127774;Bob 阅读(303) 评论(0) 推荐(0)

AVQueuePlayer

摘要: 想要视频一个接一个的无缝连续播放么? 还在用mpmovieplayercontroller么?out了! 介绍一个可以实现无缝连续播放视频的东西-------AVQueuePlayer ! AVQueuePlayer 是苹果最新推出的一个神器,支持多视频播放,无敌了!之前被无缝播放折磨了大半天,后来 阅读全文

posted @ 2015-10-13 20:17 &#127774;Bob 阅读(455) 评论(0) 推荐(0)

ios音频视频资料--

摘要: 视频播放 MediaPlayer.framework MPMoviePlayerViewController VS MPMoviePlayerController MPMoviePlayerViewController MPMoviePlayerController 版本支持 Available i 阅读全文

posted @ 2015-10-13 20:16 &#127774;Bob 阅读(262) 评论(0) 推荐(0)

ios coredata 老代码备用参考

摘要: iPhone OS在2009年6月份推出3.0版本SDK,其中一个特性是引入了Mac SDK中的core data。是一种ORM(Object Relationships Mapping)解决方案,类似java的Hibernate。有了这个,就不必像ios简单sqlite使用那样编写繁琐代码了,减少... 阅读全文

posted @ 2015-10-13 20:13 &#127774;Bob 阅读(278) 评论(0) 推荐(0)

uitableviewcell 自适应大小 参考

摘要: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {// 列宽CGFloat contentWidth = self.tableView.frame.size.... 阅读全文

posted @ 2015-10-13 20:10 &#127774;Bob 阅读(253) 评论(0) 推荐(0)

触发UIButton长按事件

摘要: UIButton*aBtn=[UIButtonbuttonWithType:UIButtonTypeCustom];[aBtnsetFrame:CGRectMake(40,100,60,60)];[aBtnsetBackgroundImage:[UIImageimageNamed:@"111.png... 阅读全文

posted @ 2015-10-13 20:00 &#127774;Bob 阅读(593) 评论(0) 推荐(0)

Objective-c开发中混合使用ARC

摘要: 首选“Compile Sources”的位置:选中工程->TARGETS->相应的target然后选中右侧的“Build Phases”,向下就找到“Compile Sources”了。如何在未使用arc的工程中引入一个使用了arc特性的文件:对相应的文件添加:-fobjc-arc参数如何在arc工... 阅读全文

posted @ 2015-10-13 19:21 &#127774;Bob 阅读(173) 评论(0) 推荐(0)

ios短信和电话--参考

摘要: 调用打电话功能[[UIApplicationsharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];调用发短信功能[[UIApplication sharedApplication]openURL:[NSURL URLWith... 阅读全文

posted @ 2015-10-13 19:20 &#127774;Bob 阅读(160) 评论(0) 推荐(0)

ios阻止锁屏 --老代码,供参考

摘要: // Disable the idle timer[[UIApplication sharedApplication]setIdleTimerDisabled:YES]; // Or for those who prefer dot syntax:[UIApplication sharedAppli... 阅读全文

posted @ 2015-10-13 19:18 &#127774;Bob 阅读(285) 评论(0) 推荐(0)

objective-c常用数学方法

摘要: 1、 三角函数 double sin (double);正弦 double cos (double);余弦 double tan (double);正切 2 、反三角函数 double asin (double); 结果介于[-PI/2, PI/2] double acos (double); 结果 阅读全文

posted @ 2015-10-13 19:14 &#127774;Bob 阅读(378) 评论(0) 推荐(0)

ios更改UITabBarController背景以及选中背景图片的方法

摘要: 一、背景图片 1、5.0以上版本 UIImage *image = [UIImage imageNamed:@"system_tabbar_bg.png"]; [self.tabBar setBackgroundImage:image]; 2、5.0以下版本 UIImage *image = [UI 阅读全文

posted @ 2015-10-13 19:12 &#127774;Bob 阅读(629) 评论(0) 推荐(0)

ios7 sdk 新特性

摘要: iOS 7 is a major update with compelling features for developers to incorporate into their apps. The user interface has been completely redesigned. In ... 阅读全文

posted @ 2015-10-13 19:10 &#127774;Bob 阅读(261) 评论(0) 推荐(0)

AES加密算法原理

摘要: 随着对称密码的发展,DES数据加密标准算法由于密钥长度较小(56位),已经不适应当今分布式开放网络对数据加密安全性的要求,因此1997年NIST公开征集新的数据加密标准,即AES[1]。经过三轮的筛选,比利时Joan Daeman和Vincent Rijmen提交的Rijndael算法被提议为AES 阅读全文

posted @ 2015-10-13 19:07 &#127774;Bob 阅读(4365) 评论(0) 推荐(0)

iOS 获取手机的型号,系统版本,软件名称,软件版本

摘要: 应用程序的名称和版本号等信息都保存在mainBundle的一个字典中,用下面代码可以取出来。NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];NSString* versionNum =[infoDict objectFor... 阅读全文

posted @ 2015-10-13 19:06 &#127774;Bob 阅读(229) 评论(0) 推荐(0)

iOS8中的UIActionSheet添加UIDatePicker后,UIDatePicker不显示问题

摘要: 解决方法:IOS8以前:UIActionSheet* startsheet = [[UIActionSheetalloc]initWithTitle:titledelegate:selfcancelButtonTitle:@"确定"destructiveButtonTitle:nilotherBut... 阅读全文

posted @ 2015-10-13 19:03 &#127774;Bob 阅读(250) 评论(0) 推荐(0)

iOS 8 定位失败问题

摘要: 首先plist定义两个string:NSLocationWhenInUseUsageDescriptionNSLocationAlwaysUsageDescription然后调用[self.locationManager requestWhenInUseAuthorization]或者[self.l... 阅读全文

posted @ 2015-10-13 19:01 &#127774;Bob 阅读(244) 评论(0) 推荐(0)

通过xib文件创建和连接UIView

摘要: 使用Xcode写程序,时间长了,对于界面上的元素,很多时候不想手写代码进行构建,但是有些UIView里面的子控件,又不能通过xib直接进行构造,要是总使用UIViewController来结合xib进行构造界面,在一些时候会觉得浪费(总觉得大才小用),系统开销也不一样,具体没测过,只是个人感觉。xi... 阅读全文

posted @ 2015-10-13 18:57 &#127774;Bob 阅读(262) 评论(0) 推荐(0)

获取iOS设备型号的方法总结

摘要: 三种常用的办法获取iOS设备的型号:1. [UIDevice currentDevice].model (推荐);2. uname(struct utsname *name) ,使用此函数需要#include;3.sysctlbyname(const char *name, void *oldp, ... 阅读全文

posted @ 2015-10-13 18:56 &#127774;Bob 阅读(499) 评论(0) 推荐(0)

iOS 7隐藏statusbar

摘要: - (BOOL)prefersStatusBarHidden { return YES; }[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];​plist... 阅读全文

posted @ 2015-10-13 18:53 &#127774;Bob 阅读(138) 评论(0) 推荐(0)

ios 报错记录

摘要: 1. 运行xcode 报错:unterminated conditional directive #ifdef 缺少对应的#endif 在结尾加上就好了 2.iOS添加非(c,c++)文件引发的"NSObjCRuntime.h"错误 引起原因是项目中的使用了c++的底层库 错在Prefix.pch中 阅读全文

posted @ 2015-10-13 18:51 &#127774;Bob 阅读(276) 评论(0) 推荐(0)

改变navigationbar 标题颜色

摘要: navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColoryellowColor]}; 阅读全文

posted @ 2015-10-13 18:50 &#127774;Bob 阅读(123) 评论(0) 推荐(0)

UITextField监听文字输入事件

摘要: [textField addTarget:self action:@selector(textFieldDidChange:)forControlEvents:UIControlEventEditingChanged];-(void)textFieldDidChange:(UITextField *... 阅读全文

posted @ 2015-10-13 18:47 &#127774;Bob 阅读(216) 评论(0) 推荐(0)

storyboard,xib

摘要: 1. 从xib的viewcontroll中启动storyboard 或者 从一个storyboard切换到另一个storyboard: – (IBAction)openStoryboard:(id)sender {UIStoryboard *secondStoryboard = [UIStorybo 阅读全文

posted @ 2015-10-13 18:35 &#127774;Bob 阅读(171) 评论(0) 推荐(0)

Xcode6中autolayout和sizeclass的使用

摘要: 一、关于自动布局(Autolayout)在Xcode中,自动布局看似是一个很复杂的系统,在真正使用它之前,我也是这么认为的,不过事实并非如此。我们知道,一款iOS应用,其主要UI组件是由一个个相对独立的可视单元构成,这些可视单元有的主要负责向用户输出有用的信息,有些则负责信息的输入(交互),交互的过... 阅读全文

posted @ 2015-10-13 18:33 &#127774;Bob 阅读(141) 评论(0) 推荐(0)

进入 App Store 打分

摘要: 很多用户用了好软件后忘记或嫌麻烦而不去 App Store 进行打分评星,为此开发者可以在应用中加入打分按钮,点击后直接跳转到 App Store 的评分界面。 App Store 上评论的链接地址是itms-apps://ax.itunes.apple.com/WebObjects/MZStor... 阅读全文

posted @ 2015-10-13 17:49 &#127774;Bob 阅读(217) 评论(0) 推荐(0)

动态设置uitableview高度,参考

摘要: - (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{//UITableViewCell *cell = [tableView cellForRowAtIndexPat... 阅读全文

posted @ 2015-10-13 17:45 &#127774;Bob 阅读(186) 评论(0) 推荐(0)

图片在内存中的占用的空间大小

摘要: 这个话题有点底层了 由于在开发当中尤其是在嵌入式设备开发当中,我们对内容使用要求很高,如Android的设备在开发过程中,我们在加载图片资源的时候,如果图片资源使用不合理经常会出现内存溢出的问题(安卓里面叫做 om(out memory) ios里面叫 内存过大),这个问题很是让人头疼。所以我们如果 阅读全文

posted @ 2015-10-13 17:41 &#127774;Bob 阅读(1684) 评论(0) 推荐(0)

ios 8和iOS 9 适用的uidatepicker

摘要: UIAlertController*alertController = [UIAlertControlleralertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n\n"message:nilpreferredStyle:UIAlertControllerSty... 阅读全文

posted @ 2015-10-13 17:37 &#127774;Bob 阅读(214) 评论(0) 推荐(0)

iOS的view翻转动画实现--代码老,供参考

摘要: 新建一个view-based模板工程,在ViewController文件中添加下面的代码,即可实现翻转效果;- (void)viewDidLoad {[superviewDidLoad];//需要翻转的视图UIView*parentView = [[UIViewalloc]initWithFrame... 阅读全文

posted @ 2015-10-13 17:31 &#127774;Bob 阅读(528) 评论(0) 推荐(0)

导航