自己一些平常收集的用到的知识点和博客文章链接

1、

dispatch_sync(dispatch_get_main_queue(), ^(){
    // 这里的代码会在主线程执行
});

2、http://my.oschina.net/w11h22j33/blog/206129 cacaapods链接

3、http://www.cnblogs.com/pure/archive/2013/03/31/2977420.html 多线程GCD

4、http://www.cnblogs.com/wengzilin/p/3444471.html 百度地图。。。

5、[timer invalidate]; 计数器停止

6、lipo -create Release-iphoneos/libbaidumapapi.a ./Release-iphonesimulator/libbaidumapapi.a -output libbaidumapap.a 百度地图Sdk真机与虚拟机合成

7、http://blog.csdn.net/rhljiayou/article/details/14525417 高仿微信界面

8、http://blog.csdn.net/easemob_im/article/details/40895511 环信介绍博客的连接

9、// iOS8及以后的推送

UIUserNotificationType userNotificationType = UIUserNotificationTypeAlert
                                            | UIUserNotificationTypeBadge 
                                            | UIUserNotificationTypeSound;
UIUserNotificationSettings *notificationSettings = 
  [UIUserNotificationSettings settingsForTypes:userNotificationType
                                    categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

10、http://www.tuicool.com/articles/7vUnay SDWebImage (以SDWebImage为例)

11、cocopods下载速度慢,用这个
pod install –verbose –no-repo-update
pod update –verbose –no-repo-update

12、http://bbs.lbsyun.baidu.com/forum.php?mod=viewthread&tid=13397 ios8下,百度地图无法定位的解决方法

13、http://segmentfault.com/q/1010000000504594 模态视图实现push到其他页面的功能

14、改变字体大小

UIFont *tabBarFont = [UIFont systemFontOfSize:20];
    NSDictionary *titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:tabBarFont,NSFontAttributeName, nil];
    for (UIViewController *tab in self.viewControllers) {
        [tab.tabBarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];
    }

15、 budsetting —Bitcode — no
plist里面添加

<key>NSAppTransportSecurity</key>
<dict>
    <!--彻底倒退回不安全的HTTP网络请求,能任意进行HTTP请求 (不建议这样做)-->
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

16、http://segmentfault.com/q/1010000000504594 模态视图实现push到其他页面的功能

17、
latform:ios,’7.0’
pod ‘AFNetworking’
pod ‘SDWebImage’
pod ‘MJRefresh’
pod ‘FXBlurView’,’~>1.6.3’ 毛物理效果
pod ‘FMDB’

18、 计算文本高度

 CGRect rect = [text  boundingRectWithSize:CGSizeMake(180.0f, 20000.0f) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil];
    CGSize size = rect.size;

19、

//判断是否有中文
    -(BOOL)IsChinese:(NSString *)str {
        for(int i=0; i< [str length];i++){
            int a = [str characterAtIndex:i];
            if( a > 0x4e00 && a < 0x9fff)
            {
                return YES;
            }

        }
        return NO;

    }

20、在project-setting中找到 “Run Static Analyzer” 键,然后把值修改为“YES”.这样在编码的时候,xcode就可以自动为我们检查内存泄露了.
21、修改navigationBar的颜色

[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor 您需要的颜色]}];
22、判断是否联网
#import <Foundation/Foundation.h>
    #import <CommonCrypto/CommonHMAC.h>
    #import <SystemConfiguration/SystemConfiguration.h>
    #import <netdb.h>
    #import <arpa/inet.h>
    #pragma mark -----判断是否联网
    -(BOOL) connectedToNetwork
    {
        // Create zero addy
        struct sockaddr_in zeroAddress;
        bzero(&zeroAddress, sizeof(zeroAddress));
        zeroAddress.sin_len = sizeof(zeroAddress);
        zeroAddress.sin_family = AF_INET;

        // Recover reachability flags
        SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
        SCNetworkReachabilityFlags flags;

        BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
        CFRelease(defaultRouteReachability);

        if (!didRetrieveFlags)
        {
            printf("Error. Could not recover network reachability flags\n");
            return NO;
        }

        BOOL isReachable = ((flags & kSCNetworkFlagsReachable) != 0);
        BOOL needsConnection = ((flags &kSCNetworkFlagsConnectionRequired) != 0);
        return (isReachable && !needsConnection) ? YES : NO;
    }

22、http://blog.csdn.net/l_ch_g/article/details/11738129 图片选择
23、启动页面5种规格
320x480default.png
320x480@2x.png
320x568@2x.png
375x667@2x.png
414x736@3x.png
24、http://www.w3school.com.cn/ js教程
25、友盟什么的分享功能,Localization native development region china 加到info里面,把英文改成中文
26、http://www.cnblogs.com/songliquan/p/4559051.html?utm_source=tuicool qq聊天界面
27、iOS中计算缓存文件大小http://blog.sina.com.cn/s/blog_a5243c7f0101sb39.html

28、ios自带表情和转义字符http://blog.csdn.net/liliangchw/article/details/8255960

29、iOS 自定义emoji表情键盘总结http://blog.sina.com.cn/s/blog_6317728d0102vwjv.html

30、ios 自带表情使用遇到的问题http://bbs.csdn.net/topics/390055415

31、emoji表情的Unicode编码范围为:
[0xE001,0xE05A]
[0xE101,0xE15A]
[0xE201,0xE253]
[0xE301,0xE34D]
[0xE401,0xE44C]
[0xE501,0xE537]

32、一步一步学习封装ios表情键盘http://www.cnblogs.com/bcblogs/p/4704046.html

33、iOS开发之自定义表情键盘(组件封装与自动布局)
http://www.cocoachina.com/ios/20140918/9661.html

34、ios键盘github下载https://github.com/ws00801526/XMChatBarExample

35、http://www.cnblogs.com/xiaodao/archive/2012/10/08/2715477.html coreData博客

36、http://www.iqiyi.com/w_19rtfxdxfx.html 不错的学习coredata,socket编程的视频

37、iOS与h5的交互(混编)
http://www.th7.cn/web/js/201507/109658.shtml [很不错的链接]
http://www.oschina.net/question/2308605_223365 [x5谁看谁赚,不解释]

- (void)webViewDidFinishLoad:(UIWebView *)webView
{

    //js方法名+参数
    NSString* jsCode = [NSString stringWithFormat:@"report('%@')",self.jsStr];

    //调用html页面的js方法
    [webView stringByEvaluatingJavaScriptFromString:jsCode];

} 

38、YYKit第三方 and 保持界面流畅的技巧
https://github.com/ibireme/YYKit http://blog.ibireme.com/2015/11/12/smooth_user_interfaces_for_ios/

39、苹果官方Demo合集 http://www.jianshu.com/p/7d4710b815c2
github地址:
https://github.com/WildDylan/appleSample

40、tableView选中时cell的状态http://blog.csdn.net/lkxasdfg/article/details/8660827

41、判断NSString是否包含某个字符串http://www.tuicool.com/articles/BBzAnmv

42、导航控制器导航栏相关属性的修改http://www.itstrike.cn/Question/e0fd5e29-34ef-49fe-9a55-a018878199a2.html

43、
layoutSubviews在以下情况下会被调用:
1、init初始化不会触发layoutSubviews
2、addSubview会触发layoutSubviews
3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化
4、滚动一个UIScrollView会触发layoutSubviews
5、旋转Screen会触发父UIView上的layoutSubviews事件
6、改变一个UIView大小的时候也会触发父UIView上的layoutSubviews事件
44、读取图片的各种方法http://blog.sina.com.cn/s/blog_a843a8850101flo3.html
45、UIWebView加载本地html文件 http://blog.csdn.net/kaitiren/article/details/17115085
46、

//清除cookies
    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies])
    {
        [storage deleteCookie:cookie];
    }
 //清除UIWebView的缓存
    [[NSURLCache sharedURLCache] removeAllCachedResponses];

    NSURLCache * cache = [NSURLCache sharedURLCache];
    [cache removeAllCachedResponses];
    [cache setDiskCapacity:0];
    [cache setMemoryCapacity:0];

47、更换开发的笔记本之后出现自打包不了的情况,这个时候可以通过iTunes进行打包,具体怎么操作网上一搜就有,就几步显示包内容,然后拖到iTunes上就会转成ipa;接下来说说我自己做的方法:从新的开发笔记本上从钥匙串的证书助理,从证书颁发机构请求证书按要求输入邮箱等后导出从CertificateSigningRequest,接着在苹果开发者中心那里Certificates——Pending 添加一个证书,然后选择上面你导出的CertificateSigningRequest,点继续,接着下载生成的证书到桌面,双击即可。

48、关于内购可能用到的一篇文章https://onevcat.com/2013/11/ios-iap-checklist/

49、改变导航栏标题颜色

NSDictionary *dict = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName
                          ];
    self.navigationController.navigationBar.titleTextAttributes = dict;

改变大小、字体

[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor whiteColor]}];

50、NSJSONSerialization 抛出异常 - “Garbage at End” 解决方案
原因:
在转JSON, 抛出了”Garbage at End”错误,中文意思大概是“末尾有垃圾”,意思是含有JSON转换无法识别的字符。(JSON格式验证是没问题的)
经过笔者一阵折腾(stackoverflow),最终还是找到了解决方案,原因是 因为我的字符串是加密过的,导致解密后的数据加了一些 “操作符”
解决方案:
1.如果是data,先将DATA装成String,采用NSUTF8StringEncoding(系统提供的枚举貌似都可以,因为不是中文),然后看第二步
2.如果是NSString
yourStr =[yourStr stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]];
这时候所有控制符都会被替换成空字符。
接着将yourStr转化成NSData(注意跟你第一步你所用的编码格式需要相同),然后再进行NSJSONSerialization 操作!
原文链接:http://www.jianshu.com/p/c94ec3b2e1d8

51、判断数据是否为NSNull类型 [变量 isEqual:[NSNull null]]

52、使用SDWebImage加载大量图片后造成内存泄露的解决办法http://www.bubuko.com/infodetail-985746.html
完美解决SDWebImage加载多个图片内存崩溃的问题http://blog.csdn.net/benyoulai5/article/details/50462586

53、category 中声明新的属性:使用方法TF_SYNTHESIZE_CATEGORY_PROPERTY_RETAIN(rank_price, setRank_price);

#define TF_SYNTHESIZE_CATEGORY_PROPERTY_RETAIN(GETTER,SETTER) TF_SYNTHESIZE_CATEGORY_PROPERTY(GETTER,SETTER,OBJC_ASSOCIATION_RETAIN_NONATOMIC,id)
#define TF_SYNTHESIZE_CATEGORY_PROPERTY_COPY(GETTER,SETTER)   TF_SYNTHESIZE_CATEGORY_PROPERTY(GETTER,SETTER,OBJC_ASSOCIATION_COPY,id)
#define TF_SYNTHESIZE_CATEGORY_PROPERTY_ASSIGN(GETTER,SETTER) TF_SYNTHESIZE_CATEGORY_PROPERTY(GETTER,SETTER,OBJC_ASSOCIATION_ASSIGN,id)
#define TF_SYNTHESIZE_CATEGORY_PROPERTY_BLOCK(GETTER,SETTER,TYPE)   TF_SYNTHESIZE_CATEGORY_PROPERTY(GETTER,SETTER,OBJC_ASSOCIATION_COPY,TYPE)

#define TF_SYNTHESIZE_CATEGORY_PROPERTY(GETTER,SETTER,objc_AssociationPolicy,TYPE)\
- (TYPE)GETTER{return objc_getAssociatedObject(self, @selector(GETTER));}\
- (void)SETTER:(TYPE)obj{objc_setAssociatedObject(self, @selector(GETTER), obj, objc_AssociationPolicy);}

54、导航栏颜色比设置的偏浅
哈哈,这是IOS7的特性。并不是你设置的颜色的问题。
默认情况下,导航栏的translucent属性为YES。另外,系统还会对所有的导航栏做模糊处理,这样可以让iOS 7中导航栏的颜色更加饱和。

要想禁用translucent属性,可以在Storyboard中选中导航栏,然后在Attribute Inspectors中,取消translucent的勾选。

或者用代码设置你的
UINavigationController的translucent为NO

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值