iOS开发
下个夏天xia
谁的过去不是曾经。
展开
-
(iOS开发) 网络状态的监听,AFN
-(void)listenNetWorkingStatus { //1:创建网络监听者 AFNetworkReachabilityManager *managerafn = [AFNetworkReachabilityManager sharedManager]; //2:获取网络状态 [managerafn setReachabilityStatusChange...原创 2019-04-18 15:10:25 · 969 阅读 · 0 评论 -
(iOS开发)AutoLayOut中等比例设置视图
为了适应苹果的不同的屏幕,因此需要做屏幕的等比例适配!下面是简单的等比例适配的教程:下面是一个简单的让lable在cell中居中显示的案例1、创建自定义的cell的XIB文件,在此就不多说了。2、在xib上面放一个label:3、给TestLable添加个相对于父视图(cell的contentView)的Leading Space的约束4、点击如图显示的约束线条,就会出原创 2016-10-31 13:37:13 · 3658 阅读 · 0 评论 -
(iOS开发)iOS 9之后状态栏修改的方式
iOS 9之前是使用如下代码来设置状态栏的隐藏,修改样式[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES]; [[UIApplication sharedApplication]setStatusBarHidden:NO];但是,iOS 9之原创 2016-10-08 16:15:26 · 1009 阅读 · 0 评论 -
(iOS开发) RunLoop与NSTimer的相关
在开发中经常会遇到这种情况,自己开启了个定时器,但是在某些情况下的时候,timer的方法不响应,但是timer仍然开启着;这种情况就是timer所在的Runloop暂时关闭了。一、RunLoop 与NSRunLoopCommonModes当nstimer 使用scheduledTimerWithTimeInterval方法的时候,此时的nstimer会被加入到当前的线程的RunLo转载 2016-10-17 11:41:27 · 461 阅读 · 0 评论 -
(iOS开发)计算时间差
//后来时间 NSDate *currentDate = [NSDate date];//获取当前时间,日期 NSInteger nowtime=[currentDate timeIntervalSince1970]; //间隔时间 NSInteger intervalSinceNow =[self distanceTimeWithBeforeTime:begint原创 2016-09-20 15:31:56 · 744 阅读 · 0 评论 -
(iOS开发)百度地图SDK使用以及学习
一、环境的搭建1、下载百度地图SDK,地址:百度地图sdk下载2、注册账号、申请私钥:(注 :安全码就是 项目中的 Bundle Identifier)3、将下面的framework导入到自己的工程中去:4、还要引入一些需要的系统库文件:CoreLocation.framework、QuartzCore.framework、OpenGLES.framework、SystemCo原创 2016-10-26 14:37:49 · 1507 阅读 · 0 评论 -
(iOS开发)FFmpeg编译基础
1、下载:https://github.com/kewlbear/FFmpeg-iOS-build-script2、打开终端,cd到所在文件夹,在命令行输入:chmod +x build-ffmpeg.sh 然后./build-ffmpeg.sh(看是否要安装yasm)(这个是手机端的,不是tvos)3、将含有lib和include的FFmpeg-iOS文件夹重命名为转载 2016-09-23 15:36:22 · 433 阅读 · 0 评论 -
(iOS开发) 导航栏一侧有多个按钮的处理
//导航栏一侧有多个按钮的时候//写成一个view上UIView * viewBackInNavi=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, 30)];viewBackInNavi.backgroundColor=[UIColor clearColor];viewBackInNavi.userInteractionEnabled=Y原创 2016-10-10 17:01:21 · 2741 阅读 · 0 评论 -
(iOS开发)关于IOS9以后UIAlertView被UIAlerTController取代的有关问题
IOS 9 以后 UIAlertView就不被苹果所推荐使用了,因此苹果推出了 UIAlerTController来取代UIAlertView,下面介绍下UIAlerTController的使用方式。Tips:这个UIAlertController需要版本限制IOS8.0以上才可以使用UIAlertController* alert=[UIAlertCont原创 2016-10-10 10:41:02 · 852 阅读 · 0 评论 -
(iOS开发)横竖屏的使用和系统播放器的使用
必须这样声明,否则看不到@property (nonatomic, strong) MPMoviePlayerController *moviePlayer;//使用点方法来创建moviePlayer -(void)viewWillAppear:(BOOL)animated{ [self.moviePlayer play];//监听通知//将要进入全屏的通知[[NSNo原创 2016-09-23 15:34:33 · 941 阅读 · 0 评论 -
(iOS开发) 弹出选择相册图片以及之后的图片地址
1、首先需要遵循代理:UIImagePickerControllerDelegate2、PS:此方法适配iOS8之后,如果想用UIAlertView,请自己实现-(void)changeIcon:(UITapGestureRecognizer*)tap{ /** * 弹出提示框 */ //初始化提示框 UIAlertController *a原创 2016-11-01 09:56:47 · 4780 阅读 · 0 评论 -
(iOS开发) 动态cell高度
话不多说,直接上代码。一、用XIB来写:直接AutoLayOut拖拽1、首先,创建个带xib的cell,在cell上面放2个label2、给label 加上约束(ps:这边写的是2个lable都是动态的,因此不需要直接固定lable的高度),只需要约束以下lable1的左,上,右的距离,lable2的左,下,右的距离,然后再约束下lable1和lable2之间的距离就OK了,约原创 2016-11-01 11:33:39 · 445 阅读 · 0 评论 -
(iOS开发)小提示,cell内缩高度
自定义cell中加入:- (void)setFrame:(CGRect)frame { frame.size.height -= 10; // 减掉的值就是分隔线的高度 [super setFrame:frame];}原创 2018-10-30 10:57:43 · 209 阅读 · 0 评论 -
(iOS开发) .a文件的整合
$ lipo -create /Users/xxxxxx/lib/libv7.a /Users/xxxxxx/lib/lib64.a -output /Users/xxxxxx/lib/lib.a1、/Users/xxxxxx/lib/libv7.a2、/Users/xxxxxx/lib/lib64.a3、输出地址为/Users/xxxxxx/lib/lib.a...转载 2018-08-06 16:04:28 · 211 阅读 · 0 评论 -
(iOS) FFmpeg iOS 上的安装(可以指定任意版本) 一
一、准备部分1、去FFmpeg官网下载所需要的版本的源码:官网源码下载地址2、安装Homebrew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"3、安装yasm: brew install yasm4、下载:https://github.com/libav/gas...原创 2018-04-26 17:05:16 · 1816 阅读 · 0 评论 -
(iOS开发) 录屏功能的实现~包括暂停和继续功能
最近在pad上写了个录屏的项目,下面总结一下最近的收获:查看了下git上的不少的录屏的demo,好多没有实现暂停和继续的功能,当然我这个写的也有不少瑕疵,希望能提出来共同进步!一、需求:1、要求录屏的时候有暂停和继续功能2、对录制完的视频有做处理(获取第一帧图片,获取视频大小等等)二、实现:①、demo中的Lib文件夹的Recoder就是录制视频的相关文件原创 2017-01-13 16:41:57 · 16056 阅读 · 24 评论 -
(iOS开发) coreData自主学习的坑Tips
1. 新建的.xcdatamodeld的名字不能和entity的名字重复,否则会读出问题2. coredata默认的是swift,需要的话需要手动改成OC3. Target Membership 需要钩中的情况下去Editor ,然后 ,Create NSManagedObject .. 创建4. 创建完了,build一遍, 然后再把 Target Membership 给取消钩中,原创 2017-05-17 17:56:32 · 492 阅读 · 0 评论 -
(iOS开发) 往服务器上传视频
情景: 多选视频,然后打包成一个zip压缩包(里面有多个视频,一个json文件)一、先生成本地的文件:-(NSString *)getDocumentPath{ NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *dic = [NSHomeDirectory() stringByAp原创 2017-01-09 17:35:07 · 3449 阅读 · 0 评论 -
(iOS开发)导航栏navigationBar中间添加按钮
navigation bar 中间title变成button:self.navigationItem.titleView =button; UIButton * button =[UIButton buttonWithType:UIButtonTypeCustom]; button.frame=CGRectMake(20, 20, 100, 40); [button setTitle原创 2016-09-20 15:36:26 · 11162 阅读 · 0 评论 -
(iOS开发)关于tableView的frame设置的问题(上下移动64像素)
有时候发现tableView的frame的Y初始值有时候是0,有时候是64,为此曾困扰我,经查询,发现个Blog写的很好:http://blog.csdn.net/zhz459880251/article/details/49470461但是也总结了一个方法来确保tableView的Y初始值是从64开始,代码如下://添加此句,确保_tableView是用0,64 开始的( _ta转载 2016-09-20 11:55:13 · 5948 阅读 · 0 评论 -
(iOS开发)页面间跳转时隐藏ToolBar
实现隐藏tabbar若有:页面A有tabbar,跳转到页面B的时候隐藏tabbar,再点击返回页面A,显示tabbar实现页面A:-(void)viewWillAppear:(BOOL)animated{ self.tabBarController.tabBar.hidden = NO;}原创 2016-09-20 10:34:53 · 1579 阅读 · 0 评论 -
(iOS开发)IOS 9 APP版本检验更新和跳转
/** * 判断app安装版本和商店版本的比较 */-(void)judgeAPPVersion{ // https://itunes.apple.com/lookup?id=604685049 NSString *urlStr = @"https://itunes.apple.com/lookup?id=604685049"; NSURL *u原创 2016-09-23 15:33:33 · 1197 阅读 · 0 评论 -
(iOS开发)保存图片方法
// 1. 去图像路径 NSArray *docs = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *imagePath = [docs[0]stringByAppendingPathComponent:@"abc.png"];原创 2016-09-23 15:32:09 · 306 阅读 · 0 评论 -
(iOS开发)修改UITextField中placeholder的字体大小,颜色
//UITextField修改placeholder的字体大小 ,颜色 NSString *holderText =@"Hello,world"; NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc]initWithString:holderText]; [placeho原创 2016-09-23 15:19:04 · 461 阅读 · 0 评论 -
(iOS开发)当tableView数据较少的时候,隐藏下面,并显示白色
设置_tableView数据比较少的时候,下面显示的是白色[selfsetExtraCellLineHidden:_tableView];-(void)setExtraCellLineHidden: (UITableView *)tableView{ UIView *view = [UIViewnew];原创 2016-09-20 10:38:03 · 1245 阅读 · 0 评论 -
(iOS开发)webView的使用与注意事项
注意事项:1、webView上面添加tap等手势的时候必须添加:(web view手势)//必须实现 否则无法触发webView的点击事件- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGes原创 2016-09-20 14:17:53 · 2016 阅读 · 0 评论 -
(iOS开发)UIScrollView的使用以及注意事项
//1. 建立UIScrollView窗口,我们只打算用手机的上半屏显示图像,(这一步也可以在storyboard里完成)myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320 , 300)];//2.建立内容视图UIImageView * view = [[UIImageView alloc] init原创 2016-09-20 16:28:33 · 342 阅读 · 0 评论 -
(iOS开发)UIButton 半边圆角
//1、创建好myButton的各项//2、添加以下代码,实现半边圆角(下边的半边圆角)//3、想改变半边圆角,可以通过改变UIRectCornerBottomLeft | UIRectCornerBottomRight UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:myButto原创 2016-09-20 15:15:14 · 4972 阅读 · 1 评论 -
(iOS开发)Model中数据多怎么办,JSON中数据多,种类多的解析Model
//model是自己的类型 ,dic是json中所需要解析出来的字典[model setValuesForKeysWithDictionary:dic];//1、如果model里面的有不存在于dic中的元素会怎样?//在Model文件中添加一行@property (nonatomic,copy)NSString *other;//并输出得时候输出NSLog(@"t转载 2016-09-20 14:14:01 · 494 阅读 · 0 评论 -
(iOS开发)本地文件夹的创建
1、首先,先获取沙盒目录//获取Documents目录-(NSString *)dirDoc{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths ob原创 2016-09-20 14:07:57 · 1378 阅读 · 0 评论 -
(iOS开发)修改textfeiled中placeholder的字体,颜色,大小
textfeiled 使用(placeholder属性修改 )//placeholder的位置,大小 sureNewPassWordTF.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, currentPWDTF.frame.size.height)]; sureNewPassWordT原创 2016-09-20 11:52:41 · 365 阅读 · 0 评论 -
(IOS开发)使用afn往服务器传图片
AFHTTPRequestOperationManager *manager; // NSDictionary *parameters = @{@"uid": @"EFGH"};//对应上面接口非图片的参数 file是图片的key //创建请求 manager = [AFHTTPRequestOperationManager manager];原创 2016-09-20 11:51:11 · 1051 阅读 · 0 评论 -
(iOS开发)xcode 8和iOS 10中的有些问题解决
每次升级xcode之后,总会有改变,然后导致各种问题的出错。这次升级到xocde 8,仍然如此,在此贴上cocoaChina中的一个帖子,有些问题可以参考前辈们的解决方式,也可以留言。地址如下: http://www.cocoachina.com/bbs/read.php?tid-1696016.html转载 2016-09-23 15:20:21 · 497 阅读 · 0 评论 -
(iOS开发)tableview自带的删除方法(8.0之后适用)
-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActio原创 2016-09-23 15:23:48 · 1104 阅读 · 0 评论 -
(iOS开发)设置navigationbar的背景色以及title的字体颜色
// 设置导航栏的背景颜色 [self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];// 设置导航栏上的标题字体的颜色 [self.navigationController.navigationBar setTitleTextAttributes:@{UITextAt原创 2016-09-23 15:31:17 · 1874 阅读 · 0 评论 -
(iOS开发)storyBoard的简单使用
UIStoryboard * story=[UIStoryboard storyboardWithName:@"ListStoryboard" bundle:nil]; ListTableViewController * list=[story instantiateViewControllerWithIdentifier:@"list"]; list.navigationI原创 2016-09-23 15:30:37 · 611 阅读 · 0 评论 -
(iOS开发)刷新View的方法
[self viewWillDisappear:YES]; [self viewDidAppear:YES];-(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; while ([self.view.subviews lastObject] != nil) {原创 2016-09-23 15:29:55 · 5016 阅读 · 0 评论 -
(iOS开发)允许右滑等操作
-(void)viewDidAppear:(BOOL)animated{// 这一句实现了允许右滑手势 self.navigationController.interactivePopGestureRecognizer.enabled=YES;// 在自定义了返回按钮的情况下还能实现右滑手势 self.navigationController.interacti原创 2016-09-23 15:29:06 · 419 阅读 · 0 评论 -
(iOS开发)图片等实现360°旋转
-(void) startAnimation{ [UIView animateWithDuration:1.5 animations:^{ CABasicAnimation *fullRotation; fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"原创 2016-09-23 15:27:45 · 1591 阅读 · 0 评论 -
(iOS开发)根据字符串中的数值取出颜色
-(UIColor *)getColorFromString:(NSString *)colorString{ int colorInt=[colorString intValue]; if(colorInt<0) return [UIColor whiteColor]; NSString *nLetterValue; NSString *colo原创 2016-09-23 15:27:01 · 1460 阅读 · 0 评论