iOS 笔记 (一直持续更新中……)

Xcode 6 不支持32位的情况 解决方案     $(ARCHS_STANDARD_32_BIT)



字符串分割 

 NSArray * industrArray = [self.personnalInfo objectForKey:@"SelIndustry"];
        NSMutableArray * tempArray = [[NSMutableArray alloc]init];
        if ([industrArray count] != 0) {
               for (id index in industrArray) {
                    for (NSDictionary * dict in _industryListArray) {
                            
                    if (index == [dict objectForKey:@"ID"] ) {
                                
                        NSString * str = [dict objectForKey:@"IndustryName"];
                        [tempArray addObject:str];
                 }
            }
    }
  _industrLabel.text = [tempArray componentsJoinedByString:@"/"];


使用AFNetWorking判断网络状况

[[AFNetworkReachabilityManager sharedManager]startMonitoring];
    [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        NSLog(@"%d", status);
        switch (status) {
            case AFNetworkReachabilityStatusNotReachable:
            {
                NSLog(@"暂无网络");
                UIAlertView * alterView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"暂无网络" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
                [alterView show];
            }
                break;
            case AFNetworkReachabilityStatusReachableViaWWAN:
            {
                NSLog(@"蜂窝网络开启");
                [self requestData];
            }
                break;
             case AFNetworkReachabilityStatusReachableViaWiFi:
            {
                NSLog(@"WIFI网络开启");
                [self requestData];
            }
                
            default:
                break;
        }
    }];

判断本机IP

 struct hostent *host_entry = gethostbyname("api.turetop.com");
 char *buff;
 buff = inet_ntoa(*((struct in_addr *)host_entry->h_addr_list[0]));
 NSLog(@"%s",buff);


使用SDWebImage清楚缓存

[[SDImageCache sharedImageCache] clearDisk];
[[SDImageCache sharedImageCache] clearMemory];


手机号码验证
+ (BOOL) validateMobile:(NSString *)mobile
{
    //手机号以13, 15,18开头,八个 \d 数字字符
    NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
    NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
    return [phoneTest evaluateWithObject:mobile];
}


/********************************************************************************************************************/

StoryBoard传值

1、可用单例类进行传值;

2、if ([segue.identifier isEqualToString:@"PushBrandName"]) {
 
      id theSegue = segue.destinationViewController;
     [theSegue setValue:@"这是要传递的值" forKey:@"strTitle"];
 
 }

在下一个文件中接收要传递的信息;









评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值