![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
iOS 随手记
Virgo丶
iOS软件工程师。
展开
-
iOS-清除缓存
- ( void )clearFile{ NSString * cachPath = [NSSearchPathForDirectoriesInDomains (NSCachesDirectory , NSUserDomainMask , YES )firstObject ]; NSArray * files = [[NSFileManage原创 2017-02-09 18:51:44 · 478 阅读 · 0 评论 -
iOS-比较两张图片内容是否相同,判断一个imageView是否有image
首先要把需要做出判断的imageView转成NSData,如果NSData为空,则没有图片if (UIImagePNGRepresentation(_picView.image) == nil) { data = UIImageJPEGRepresentation(_picView.image, 1); } else {原创 2015-12-17 11:13:50 · 12025 阅读 · 1 评论 -
iOS-网页调用百度地图API
UIWebView *webview = [[UIWebView alloc]init]; webview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); double latitude =45.748737; double longitude =12原创 2015-11-11 11:31:30 · 2563 阅读 · 0 评论 -
iOS-苹果App store 2015最新审核标准公布(2015.3)
http://www.weste.net/2015/03-24/102350.html原创 2015-10-10 16:18:07 · 1028 阅读 · 0 评论 -
iOS-xcode7 新特性相关
1.HTTP请求相关在info.plist 右键 -》OpenAs -》Source Code ->加入NSAppTransportSecurityNSAllowsArbitraryLoads2.didFinishLaunchingWithOptions里加入导航页,导致奔溃相关*** Assertion failure in -[UIAppli原创 2015-09-22 10:49:31 · 609 阅读 · 0 评论 -
iOS-iOS打开手机QQ与指定用户聊天界面
http://www.2cto.com/kf/201410/347659.html这里只是给了一个别人写好的链接而已。原创 2015-10-08 16:42:12 · 543 阅读 · 0 评论 -
iOS-禁用UINavigationController中的轻扫回退的手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = NO; } 这个方法要写在第一个界面。即:原创 2015-09-15 10:38:55 · 3007 阅读 · 0 评论 -
iOS-TextView、UIButton加边框,加下划线
textview对象.layer.borderColor = UIColor.grayColor.CGColor;textview对象.layer.borderWidth = 5; //必须设置宽度,否则加不上textview对象.layer.cornerRadius = 4;//圆角弧度原创 2015-01-08 14:17:51 · 1912 阅读 · 1 评论 -
iOS-判断字符串中是否只含有\n
一个字符串中,只有\n\n\n,通过str.length是不能判断出来的,这个时候str.length=3,所以就要通过以下的方法。 NSString *tempStr =@"\n"; BOOL isAllEnter = YES; for (int i =0; ilength; i++) { NSRange ran原创 2015-09-10 14:02:51 · 2455 阅读 · 0 评论 -
iOS - is missing from working copy
is missing from working copy出现这个问题,是因为svn里面文件的地址,和本地地址不同造成的原因:1.直接拖拽修改文件地址2.svn上文件地址改变之后,没有及时更新暂时只知道这两个。解决方法:针对1:把SVN上原先文件存在的地址删除,更新自己新写的上去。针对2:更新工程,用SVN上得新地址。原创 2015-08-05 15:57:49 · 536 阅读 · 0 评论 -
iOS-计算两个日期之间的天数
//计算两个日期之间的天数+ (NSInteger) calcDaysFromBegin:(NSDate *)beginDate end:(NSDate *)endDate{//创建日期格式化对象NSDateFormatter *dateFormatter=[[NSDateFormatteralloc] init];[dateFormatter setDat原创 2015-08-05 10:28:18 · 6731 阅读 · 3 评论 -
iOS-设置导航栏透明及字体、左右按钮、边框颜色
- (void) setNavBarImg:(UINavigationBar *)navBar{#define kSCNavBarImageTag 10 if ([navBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { //if iO原创 2015-08-12 14:05:42 · 3749 阅读 · 0 评论 -
iOS-pop到想要的界面
for(UIViewController *controllerin self.navigationController.viewControllers) { if([controller isKindOfClass:[BMLoginControllerclass]]){ BMLoginCont原创 2015-08-26 14:07:01 · 858 阅读 · 0 评论 -
iOS-iOS8之后,push界面导航栏上方空出20像素
self.automaticallyAdjustsScrollViewInsets = NO;原创 2015-12-01 11:27:24 · 3823 阅读 · 0 评论 -
iOS-手绘点(类似分段选择器下方突出的小三角)
UIBezierPath *path = [UIBezierPath bezierPath]; CGFloat width = 150.f; CGFloat height = self.tableView.height; CGFloat x = (self.width - width) / 2; CGFloat y = 64.5f; C原创 2016-01-20 14:20:45 · 1470 阅读 · 0 评论 -
iOS-替换系统backBarButtonItem的返回二字
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init]; backItem.title = @"这就换掉了?"; self.navigationItem.backBarButtonItem = backItem;原创 2017-02-09 17:17:59 · 919 阅读 · 0 评论 -
iOS-手绘点
手绘点UIBezierPath *path = [UIBezierPath bezierPath]; CGFloat width = 150.f; CGFloat height = self.tableView.height; CGFloat x = (self.width - width) / 2; CGFloat y = 64.5原创 2016-10-18 17:46:57 · 511 阅读 · 0 评论 -
iOS-选择生日,初始化日期选择器
#pragma mark — 选择生日- (void)editBrithday { UIAlertView * _brithdayAlert = [UIAlertView new]; _brithdayAlert.title = @"编辑生日"; [_brithdayAlert addButtonWithTitle: @"取消"]; [_brithday原创 2016-10-18 17:46:23 · 777 阅读 · 0 评论 -
iOS-文字转语音
AVSpeechSynthesisVoice:用来配置发音,支持的发音非常多.个人感觉台湾发音最好听~通过调用[AVSpeechSynthesisVoicespeechVoices]类方法可用看到支持的发音种类;AVSpeechUtterance:这个类就是用来将字符串合成为语音对象提供给AVSpeechSynthesizer来播放,这个类还有一些实例方法用来控制语速,音调原创 2016-11-08 17:55:44 · 733 阅读 · 0 评论 -
iOS-代码块在程序中只执行一次
staticdispatch_once_t disOnce; dispatch_once(&disOnce, ^ { //这里写只操作一次的代码 });原创 2016-11-08 13:30:58 · 3321 阅读 · 0 评论 -
iOS-上传 包的时候 提示 Redundant binary upload
CFBundleVersion: 代表build number,必须每个包不同CFBundleShortVersionString: 发布版本号需要:general->Version 改变一下版本号,重新打包上传即可。原创 2016-07-18 11:30:08 · 707 阅读 · 0 评论 -
iOS-UIImagePickerController 内存警告研究
在iOS开发具有拍照功能的APP的时候会出现内存警告黑屏的问题,因此我们判断当self.presentedViewControlle是UIImagePickerController 类型时,不做内存警告处理。这样就可以避免这样的问题。- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning];原创 2016-04-11 15:19:26 · 2310 阅读 · 0 评论 -
新浪分享 Insufficient app permissions!
http://www.mamicode.com/info-detail-936938.html我们在使用新浪分享的时候,可能会遇到很多问题。比如: java.lang.Throwable: {"error":"{\"error\":\"Insufficient app permissions!\",\"error_code\":10014,\"request\":\"\转载 2016-03-28 10:39:45 · 2501 阅读 · 1 评论 -
iOS-用手机查询手机UDID
请使用 iOS 设备的 Safari 浏览器打开 http://fir.im/udid原创 2016-02-04 10:51:10 · 875 阅读 · 0 评论 -
iOS-Ios8 Xcode6 设置Launch Image 启动图片
http://www.woowen.com/swift/2014/12/12/ios8设置Launch%20Image%20启动图片/原创 2016-01-12 15:45:05 · 522 阅读 · 0 评论 -
iOS-cocopods换源
Last login: Thu Dec 3 17:02:01 on ttys003lixiangnandeMacBook-Pro:~ lixiangnan$ gem sources -l //查询pods*** CURRENT SOURCES ***http://rubygems.org/ //查询出来pods源的结果lixiangnande原创 2015-12-03 17:11:21 · 675 阅读 · 0 评论 -
iOS-系统tabbar加选中条
-(void)viewDidAppear:(BOOL)animated{ [superviewDidAppear:animated]; UITabBar *tab =self.view.subviews[1]; tab.layer.borderColor = [UIColorwhiteColor].CGColor;原创 2015-08-26 14:25:02 · 1054 阅读 · 1 评论 -
iOS-tabbar控制从首页内容跳转到第二个Controller
AppDelegate *delegate = (AppDelegate *)[[UIApplicationsharedApplication] delegate]; BMBaseTabController *tab = (BMBaseTabController *)delegate.window.rootViewController; tab.selected原创 2015-08-26 11:25:02 · 9167 阅读 · 1 评论 -
iOS-UITableView 贴在最左侧
UITableView 在8.0系统里面,是距左边有一定距离的,如果想让UITableView贴在左侧,则需要做以下处理。 #define kSystemVersion [[[UIDevice currentDevice] systemVersion] integerValue] [self.tableVIewsetSeparatorInset:原创 2015-06-23 11:09:08 · 778 阅读 · 0 评论 -
iOS-svn工具Cornerstone上传忽略.a文件的处理方法
工程文件上传到svn中,.a文件会自动屏蔽(应该叫屏蔽,反正就是上传不上去)用Cornerstone工具,解决这个问题1.打开Cornerstone左上角,点Cornerstone->Preferences->Subversion2.Global lgnores下面有一个Use default global ignores 默认这里方框中会打钩(这就是.a文件不能上传的原因)在这里原创 2015-03-30 10:47:28 · 7958 阅读 · 0 评论 -
iOS-获取视频缩略图
#import #import - (UIImage *)getImage:(NSString *)videoURL { NSDictionary *opts = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:AVURLAssetPreferPreciseDura转载 2015-03-12 11:24:48 · 931 阅读 · 0 评论 -
iOS-不用ID的打包方法
据我观察,貌似打包都是需要通过ID的,但是情况紧急的情况下,你不知道ID,怎么破?1.开始打包。Product --> Archive2.到了导出的关键时刻。3.我们 右键 Show in Finder 4.看到心爱的程序程序,右键显示包内容。5.看到那个 Applications 继续点进去6.看到我们心爱的工程,不原创 2015-01-26 14:45:19 · 2071 阅读 · 0 评论 -
iOS-UITextField,UITextView 设置可输入字符串长度
1.实例化,并且加上delegate2.以UITextView为例#pragma mark - UITextViewDelegate- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{原创 2015-01-26 13:35:04 · 750 阅读 · 2 评论 -
iOS-iPhone开发之判断当前的网络状态
1、添加 framework:将 SystemConfiguration.framework 添加进工程。2、下载 http://developer.apple.com/library/ios/samplecode/Reachability/Reachability.zip复制里面的 Reachability.h 和 Reachability.m 到项目中3、调用的原创 2015-01-22 10:14:37 · 769 阅读 · 0 评论 -
iOS-引导页
1.在appDlegate 中 初始化导航页- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindowalloc] initWithFrame:[[UIScre原创 2015-01-19 15:58:32 · 857 阅读 · 0 评论 -
iOS 计时器-验证码相关
计时器-验证码相关(以忘记密码为例)1.点击发送验证码,要判断phoneTF是否空白以及手机号码是否正确,两个条件满足,next2.点击发送验证码,开始进行倒计时随机生成验证码的方法 NSString* strRandom =@""; for(int i=0; i <6; i++) {原创 2015-01-16 13:49:35 · 916 阅读 · 1 评论 -
iOS 系统控件显示中文
这样子,系统的控件就不会显示英文的了,本地化为中文了原创 2015-01-15 15:42:53 · 717 阅读 · 0 评论 -
iOS横竖屏设置
在info.plist文件中 找到这个上图是横竖屏都可以的现在设置成了,只能是竖屏的。原创 2015-01-15 15:30:10 · 875 阅读 · 0 评论 -
iOS开发- UILabel 自动换行 及 高度自适应
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 50)]; label.text = @"今天下午全市多云到阴有阵雨或雷雨,今天夜里到明天阴有阵雨,雨量可达大雨。 东北风5-6级阵风7级,逐渐增强到6-7级阵风8级。 今天最高气温:26左右, 明晨最低气温:22左右。 今晨最低气温:21。转载 2015-01-12 16:26:11 · 648 阅读 · 0 评论 -
iOS开发- 版本号介绍
名词解释Version, 通常说的版本号, 是应用向用户宣传说明时候用到的标识. 一般有2段或者3段式, 如:2.1,8.1.2Version 一般由产品部门确定, 完全迥异的更新需要改变主版本号, 比如 QQ 4.0 的变化非常大, 主版本的变化会更加吸引用户的眼球,所以有的应用会频繁的更新主版本号, 比如 FireFox 20.0 . 两段式的副版本号既包含小功能更新也会包转载 2015-01-12 16:21:26 · 572 阅读 · 0 评论