
iOS
lwq421336220
这个作者很懒,什么都没留下…
展开
-
//点击屏幕任何地方让键盘消失
//点击屏幕任何地方让键盘消失- (void)setUpForDismissKeyboard { NSNotificationCenter *nc = [NSNotificationCenterdefaultCenter]; UITapGestureRecognizer *singleTapGR = [[UITapGestureRecogniz转载 2017-02-28 13:20:37 · 627 阅读 · 0 评论 -
ios 获取系统版本号
[[UIDevicecurrentDevice].systemVersionfloatValue] >= 6.0原创 2013-05-23 16:18:46 · 1823 阅读 · 0 评论 -
定义全局变量
AppDelegate.h@interface AppDelegate :UIResponder UIApplicationDelegate>@property (strong,nonatomic)UIWindow *window;@propertyBOOL isLogin;@endAppDelegate.m@implemen转载 2013-03-20 16:36:01 · 838 阅读 · 0 评论 -
ios开发之技巧总结
iphone程序中实现截屏的一种方法在iphone程序中实现截屏的一种方法://导入头文件#import QuartzCore/QuartzCore.h//将整个self.view大小的图层形式创建一张图片image UIGraphicsBeginImageContext(self.view.bounds.size);[self.view.layer renderInConte转载 2013-03-20 11:37:02 · 2891 阅读 · 0 评论 -
nsfilemanger 怎么求沙盒目录下某一文件夹的大小
+(float)fileSizeForDir:(NSString*)path//计算文件夹下文件的总大小{ NSFileManager *fileManager = [[NSFileManager alloc] init]; float size =0; NSArray* array = [fileManager contentsOfDirecto转载 2013-03-20 13:07:30 · 2138 阅读 · 0 评论 -
怎样判断ios app 第一次启动
本文转自http://blog.csdn.net/jinglijun/article/details/7306836一个有用的例子是发送一个分析实例。这可能是一个很好的方法来确定有多少人下载实用应用程序。有人会说:“但是,嘿,苹果AppStore已经告诉我,应用程序的下载量了”。流行的解决方案是在大多数地方是用[NSUserDefaults standardUserDefaul转载 2013-03-18 17:42:31 · 1100 阅读 · 0 评论 -
导入图片的问题
Not a PNG filCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure解原创 2013-03-18 17:27:28 · 1091 阅读 · 0 评论 -
ios6,tableView设置背景透明无效
这个问题只在UITableViewStyleGrouped类型的UITableView中出现,UITableViewStylePlain类型的tableView没有这个问题,因为Group类型的TableView有个backgroundView,而plain类型的TableView没有(backgroundView属性为nil),目前看来,这可能因为backgroundView在中间挡住了背景色。转载 2013-03-18 17:34:35 · 5071 阅读 · 0 评论 -
有关两个UITextField执行时的顺序与方法
1、- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; 2、- (void)textFieldDidBeginEditing:(UITextField *)textField; 3、- (void)textFieldDidEndEditing:(UITextField原创 2013-02-27 11:37:07 · 3941 阅读 · 0 评论 -
将字符串切割成数组 componentsSeparatedByString
本文转自http://blog.sina.com.cn/s/blog_65de54500100unfd.html将字符串切割成数组- (void)viewDidLoad{ NSString *a = [[NSString alloc] initWithString : @"冬瓜,西瓜,火龙果,大头,小狗" ]; NSArray *b转载 2013-03-04 18:09:32 · 15999 阅读 · 0 评论 -
iOS单例模式的实现
本文转自http://blog.csdn.net/ajrm0925/article/details/7416546单例是指静态分配的实例,而 iphone sdk 中全是这种实例,例如[UIApplication sharedApplication] 返回一个指向代表应用程序的单例对象的指针。[UIDevice currentDevice] 获取一个代表所有使用硬件平台的对象。转载 2013-02-19 11:55:54 · 547 阅读 · 0 评论 -
如何从iphone中获取无线网络参数,包括运营商网络和WiFi?
Reachability *r = [Reachability reachabilityWithHostName:@“http://www.baidu.com”]; switch ([r currentReachabilityStatus]) { case NotReachable: // 没有网络连接原创 2013-02-19 18:01:36 · 3914 阅读 · 0 评论 -
KVO和KVC
本文转自http://blog.csdn.net/ajrm0925/article/details/7416419KVO(NSKeyValueObserving 的简称)、KVC(NSKeyValueCoding 的简称)在很多时候接触到很多地方都有对 KVC,KVO 的描述,但是都是一笔带过。只知道这是Object-C提供的一个不错的机制,可以很好的减少代码。首先我们先了转载 2013-02-19 11:51:23 · 2609 阅读 · 0 评论 -
UIVIEW圆角
在实际的应用中,总感觉圆角的东西比较好看, 像button,label,image等等,以前的时候我就经常给那些控件添加一个UIImageView作为背景,再搞张圆角的图片,不过今天发现了新方法看代码viewT.layer.cornerRadius = 10;//设置那个圆角的有多圆viewT.layer.borderWidth = 10;//设置边框的宽度,当然可以不要vie转载 2013-02-19 12:01:28 · 775 阅读 · 0 评论 -
NSBundle的使用
本文转自http://blog.csdn.net/ajrm0925/article/details/7416132NSBundle 束,是一种特定的文件类型,其中的内容遵循特定的结构。NSBundle 的一个主要作用是获取 Resources 文件夹中的资源。使用主束来获取需要的资源文件:NSBundle *bundle = [NSBundle mainBundle];NS转载 2013-02-19 11:57:15 · 449 阅读 · 0 评论 -
IPHONE多语言
IPHONE多语言转自:http://hi.baidu.com/myguru/blog/category/iphone%20%BF%AA%B7%A2一、获取系统所支持的国际化信息 在国际化之前,你可以在iphone中的”设置->通用->多语言环境->语言”中来查看你的iphone支持哪些语言, 当然也可以写一段代码测试一下你的iphone都支持 哪些语言.测试代码如下:转载 2013-02-19 11:59:20 · 739 阅读 · 0 评论 -
常用代码
本文转自http://bbs.taokejh.net/forum.php?mod=viewthread&tid=421. 随机数srandom(time(NULL)); //随机数种子id d = random(); // 随机数2. 视频播放 MPMoviePlayerControlle转载 2013-01-17 13:48:31 · 738 阅读 · 0 评论 -
UIWebView显示PDF文件
UIWebView*webView =[[UIWebView alloc] initWithFrame:CGRectMake(10,10,200,200)];NSURL *targetURL =[NSURLURLWithString:@"http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebVi转载 2013-08-22 16:23:44 · 2173 阅读 · 0 评论 -
给苹果发邮件
由于给账号续费,续费成功后正好未激活,给苹果打电话,就400那个,打通天之后总说正在电话中,浪费了几十块钱电话费。最后给苹果发邮件,半天之后邮件回回来了,问题解决,发邮件地址https://developer.apple.com/contact/submit.php原创 2013-08-28 09:01:06 · 1385 阅读 · 0 评论 -
iOS NSDate
//利用字符串获取该字符串所表示日期的上一天-(NSString*)upDate:(NSString*)nowdate{ NSTimeInterval secondsPerDay = 24 * 60 * 60; NSDate *yesterday; yesterday=[[selfconvertDateFromString:nowdate] dat原创 2014-02-20 15:52:17 · 795 阅读 · 0 评论 -
UISegmentedControl设置文字的点击颜色和不点击事的颜色
NSDictionary* selectedTextAttributes =@{NSFontAttributeName:[UIFontsystemFontOfSize:14],NSForegroundColorAttributeName:color(4,111, 209)}; [self.segsetTitleTextAttributes:selectedTe原创 2017-02-28 13:22:38 · 1682 阅读 · 0 评论 -
nsstring
本文转自http://blog.csdn.net/amdbenq/article/details/7869166/将str的最后一个字符去,如果是存储的汉字,要-2,因为汉字占用2个字节。str = [str substringToIndex:[str length] - 1];//1、创建常量字符串。 NSString *astring = @"Th转载 2013-03-07 12:09:57 · 1742 阅读 · 0 评论 -
ios7状态栏重叠问题的解决方法
转自http://blog.csdn.net/swingpyzf/article/details/14522439ios7状态栏重叠 ios7状态栏改成ios6样式:1、在info.plist中新增 View controller-based status bar appearance 项并且将Value设置成 NO 这样状态栏就变成白字了。2、在AppDele转载 2016-03-07 16:51:14 · 896 阅读 · 0 评论 -
Xcode7 使用NSURLSession发送HTTP请求的问题
自从使用了xcode7之后,发现各种问题,比如下面这个Application Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plis原创 2015-11-25 17:50:17 · 817 阅读 · 0 评论 -
xcode7下IOS状态栏的颜色
之前设置状态栏颜色的时候,只是[[UIApplicationsharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];这样就好了,可是在xcode7下,就是没有反应,该怎么办呢,网上找办法呗,最后找了一个,方法如下1.plist设置statusBar在plist里增加一行 UIS原创 2015-11-20 21:29:09 · 3824 阅读 · 0 评论 -
IOS7的状态栏和导航栏
本文转自http://www.2cto.com/kf/201403/285887.htmliOS 7中默认的导航栏在开始定制之前,我们先来看看iOS 7中默认导航栏的外观。通过Xcode用Single View Controller模板创建一个工程。然后将view controller嵌入到一个navigation controller中。如果你不想从头开始,那么也可以在这里下载到这个转载 2015-01-21 10:40:43 · 792 阅读 · 0 评论 -
定制iOS 7中的导航栏和状态栏
本文转自http://www.cocoachina.com/industry/20131104/7287.html下面就是本文将要介绍的内容:iOS 7中默认的导航栏设置导航栏的背景颜色在导航栏中使用背景图片定制返回按钮的颜色修改导航栏标题的字体修改导航栏标题为图片添加多个按钮修改状态栏的风格隐藏状态栏转载 2015-01-29 15:02:26 · 529 阅读 · 0 评论 -
nsarry排序
转自http://blog.csdn.net/lixuwen521/article/details/78488931.sortedArrayUsingSelector(按Key值大小对NSDictionary排序)[plain] view plaincopyNSMutableArray *array = [NSMutableA转载 2014-08-22 08:07:56 · 852 阅读 · 0 评论 -
iOS获取键盘的高度
转自http://blog.sina.com.cn/s/blog_9693f61a01017ffk.html- (void)viewDidLoad{ [super viewDidLoad]; //增加监听,当键盘出现或改变时收出消息 [[NSNotificationCenter defaultCenter] ad转载 2014-06-18 08:57:28 · 11242 阅读 · 0 评论 -
拨打电话总结
本文转自http://blog.csdn.net/hitwhylz/article/details/29199097关于iOS应用拨打电话, 我所知道的有3种办法, 具体如下:一。利用openURL(tel)特点: 直接拨打, 不弹出提示。 并且, 拨打完以后, 留在通讯录中, 不返回到原来的应用。[cpp] view plaincopy转载 2014-07-02 18:04:12 · 893 阅读 · 0 评论 -
iOS开发- 文件共享(利用iTunes导入文件, 并且显示已有文件)
http://blog.csdn.net/hitwhylz/article/details/29389939转载 2014-07-02 17:53:55 · 15615 阅读 · 0 评论 -
iphone开发注意事项
1.给UITableViewController添加ToolBar。 self.navigationController.toolbarHidden = NO; //默认是隐藏的。//添加MessageToolBar ,messageToolBar是IBOutlet的一个ToolBar。 self.toolbarItems = [[[NSMutableArra原创 2014-07-01 09:20:03 · 962 阅读 · 0 评论 -
IOS APP配置.plist汇总(转自coolweather )
此文转自http://www.cocoachina.com/bbs/read.php?tid=89684&page=1转载 2014-05-21 10:54:37 · 702 阅读 · 0 评论 -
iOS开发-自定义后台显示图片(iOS7-Background Fetch的应用)
本文转自http://blog.csdn.net/hitwhylz/article/details/25557725转载 2014-05-21 10:04:53 · 1970 阅读 · 0 评论 -
有关UIView、subview的几个基础知识点-IOS开发 (实例)
本文转自http://justcoding.iteye.com/blog/1455665转载 2014-05-21 11:39:07 · 586 阅读 · 0 评论 -
判断一个字符串是否为空
- (BOOL) isBlankString:(NSString *)string { if (string == nil || string ==NULL) { return YES; } if ([string isKindOfClass:[NSNullclass]]) { return YES; }原创 2014-03-21 13:32:17 · 740 阅读 · 0 评论 -
UIPanGestureRecognizer类——为view添加手势
转自http://www.cnblogs.com/wujian1360/archive/2011/08/29/2158305.html#import @interface TestGestureRecognizerViewController : UIViewController { UIView *aView;}@property(nonatomic,r转载 2013-01-14 11:24:48 · 615 阅读 · 0 评论 -
presentModalViewControllerAnimated 和 dismissModalViewControllerAnimated
转自http://blog.163.com/youthpasses@yeah/blog/static/161849228201251905220964/presentModalViewControllerAnimated 和 dismissModalViewControllerAnimated 使用presentModalViewControllerAnimated方法从A->B转载 2013-01-10 12:06:00 · 1209 阅读 · 0 评论 -
UINavigationController使用的一些技巧
转自http://www.cnblogs.com/pipizhu/archive/2011/05/30/2063235.html,创建并使用一个UINavigationControllerUINavigationController *aNav = [[UINavigationController alloc] init];然后添加一个视图进去,否则导航栏也没有意义的转载 2013-01-10 11:13:42 · 698 阅读 · 0 评论 -
iOS NSString的常用用法
iOS NSString的常用用法温故知新,常用常新 //1、创建常量字符串。NSString *astring = @"This is a String!"; //2、创建空字符串,给予赋值。NSString *astring = [[NSString alloc] init]; astring = @"This is a转载 2012-11-02 15:53:22 · 559 阅读 · 0 评论