iOS--小知识点(持续更新)

来源:互联网 发布:龚品梅 知乎 编辑:程序博客网 时间:2024/06/17 20:53

一. 颜色渐变

 CAGradientLayer *gradientLayer = [CAGradientLayer layer];    gradientLayer.colors = @[(__bridge id)[UIColor whiteColor].CGColor, (__bridge id)[UIColor grayColor].CGColor, (__bridge id)[UIColor whiteColor].CGColor];    gradientLayer.locations = @[@0.0, @0.5, @1.0];    gradientLayer.startPoint = CGPointMake(0, 0);    gradientLayer.endPoint = CGPointMake(1.0, 0);    gradientLayer.frame = CGRectMake(0, 100, 300, 2);    [self.view.layer addSublayer:gradientLayer];

二. (已删除)

三. 使用drowRect绘制简单图形

//获取上下文    CGContextRef context=UIGraphicsGetCurrentContext();    //设置绘制地区的颜色    CGContextSetRGBFillColor(context, 1, 0, 0, 1);    //设置绘制的位置和大小    CGContextFillRect(context, CGRectMake(0, 100, 100, 100));    NSString * text=@"文字";    UIFont * font=[UIFont systemFontOfSize:14];    //设置文字的位置    [text drawAtPoint:CGPointMake(0, 200) withAttributes:font.fontDescriptor.fontAttributes];    UIImage * img=[UIImage imageNamed:@""];    [img drawInRect:CGRectMake(0, 300, 100, 100)];

四. 可变数组与不可变数组之间的转换

NSMutableArray * mutablearray=[[NSMutableArray alloc]initWithCapacity:0];    NSArray * copyarray=[mutablearray copy];    copyarray=@[@"1",@"2",@"3"];    NSArray * array=[[NSArray alloc]init];    NSMutableArray * copymutablearray=[array mutableCopy];    [copymutablearray setObject:@"加入到第一位" atIndexedSubscript:0];    [copymutablearray addObject:@"排序加入"];    [copymutablearray addObjectsFromArray:copyarray];

五. 快速求和,最大值,最小值,平均值

 NSArray *array = [NSArray arrayWithObjects:@"2.0", @"2.3", @"3.0", @"4.0", @"10", nil];    CGFloat sum = [[array valueForKeyPath:@"@sum.floatValue"] floatValue];    CGFloat avg = [[array valueForKeyPath:@"@avg.floatValue"] floatValue];    CGFloat max =[[array valueForKeyPath:@"@max.floatValue"] floatValue];    CGFloat min =[[array valueForKeyPath:@"@min.floatValue"] floatValue];

六. 对控件的旋转,平移,缩放,复位

//平移      CGAffineTransform transForm = _pingyibu.transform;     _pingyibu.transform=CGAffineTransformTranslate(transForm, 100, 0);    //旋转    _pingyibu.transform = CGAffineTransformRotate(transForm, M_PI_4);    //缩放按钮    _pingyibu.transform = CGAffineTransformScale(transForm, 1.2, 1.2);    //初始化复位     _pingyibu.transform = CGAffineTransformIdentity;

七. 设置label的行间距

NSMutableAttributedString *attributedString =    [[NSMutableAttributedString alloc] initWithString:_xuanzhuanla.text];    NSMutableParagraphStyle *paragraphStyle =  [[NSMutableParagraphStyle alloc] init];    [paragraphStyle setLineSpacing:3];    //调整行间距    [attributedString addAttribute:NSParagraphStyleAttributeName                             value:paragraphStyle                             range:NSMakeRange(0, [_xuanzhuanla.text length])];    _xuanzhuanla.attributedText = attributedString;

八. 让应用直接闪退

AppDelegate *app = [UIApplication sharedApplication].delegate;    UIWindow *window = app.window;    [UIView animateWithDuration:1.0f animations:^{        window.alpha = 0;    } completion:^(BOOL finished) {        exit(0);    }];

九. 手机震动

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

十. 生成手机唯一ID:UUID

-(NSString*) uuid {    CFUUIDRef puuid = CFUUIDCreate( nil );    CFStringRef uuidString = CFUUIDCreateString( nil, puuid );    NSString * result = (NSString *)CFBridgingRelease(CFStringCreateCopy( NULL, uuidString));    CFRelease(puuid);    CFRelease(uuidString);    return result;}

十一. label自适应高度

 CGRect rect=[la.text boundingRectWithSize:CGSizeMake(WIDTH-70, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:la.font} context:nil];

十二. 使用AFN判断网络状态

 NSURL *url=[NSURL URLWithString:@"http://www.apple.com"];    AFHTTPRequestOperationManager *operationManager=[[AFHTTPRequestOperationManager alloc]initWithBaseURL:url];    //根据不同的网络状态改变去做相应处理    [operationManager.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {               switch (status) {            case AFNetworkReachabilityStatusReachableViaWWAN:                [self fasongsuoyou];                break;            case AFNetworkReachabilityStatusReachableViaWiFi:                       [self fasongsuoyou];                break;            case AFNetworkReachabilityStatusNotReachable:                [self alert:NSLocalizedString(@"wuwangluo",@"")];                break;            default:                break;        }    }];    //开始监控    [operationManager.reachabilityManager startMonitoring];

十三. image转换成data类型

NSData *data=UIImagePNGRepresentation(image);NSData *data=UIImageJPEGRepresentation(image, 1.0);

十四. 获取当前时间和时间戳

//当前时间NSDate *  senddate=[NSDate date];        NSDateFormatter  *dateformatter=[[NSDateFormatter alloc] init];        [dateformatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];NSString * locationString=[dateformatter stringFromDate:senddate];//当前时间戳NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];        NSTimeInterval a=[dat timeIntervalSince1970];        NSString *timeString = [NSString stringWithFormat:@"%f", a];        long s = [timeString intValue];

十五. 对比时间差

-(int)max:(NSDate *)datatime{    //创建日期格式化对象    NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];    [dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];    NSDate *  senddate=[NSDate date];    NSString *  locationString=[dateFormatter stringFromDate:senddate];    NSDate *date=[dateFormatter dateFromString:locationString];    //取两个日期对象的时间间隔:    //这里的NSTimeInterval 并不是对象,是基本型,其实是double类型,是由c定义的:typedef double NSTimeInterval;    NSTimeInterval time=[date timeIntervalSinceDate:datatime];    int days=((int)time)/(3600*24);    return days;}

十六. 使提示框消失(定时)

[alu dismissWithClickedButtonIndex:0 animated:NO];

十七. 设置self.title的颜色

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

十八. 请求定位权限以及定位属性

//定位管理器    _locationManager=[[CLLocationManager alloc]init];    //如果没有授权则请求用户授权    if ([CLLocationManager authorizationStatus]==kCLAuthorizationStatusNotDetermined){        [_locationManager requestWhenInUseAuthorization];    }else if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusAuthorizedWhenInUse){        //设置代理        _locationManager.delegate=self;        //设置定位精度        _locationManager.desiredAccuracy=kCLLocationAccuracyBest;        //定位频率,每隔多少米定位一次        CLLocationDistance distance=10.0;//十米定位一次        _locationManager.distanceFilter=distance;        //启动跟踪定位        [_locationManager startUpdatingLocation];    }

十九. 通过经纬度计算距离

BOOL JuLi=NO;    CLLocation *orig=[[CLLocation alloc] initWithLatitude:oldlat  longitude:oldlong];    CLLocation* dist=[[CLLocation alloc] initWithLatitude:nowlat longitude:nowlong];    CLLocationDistance kilometers=[orig distanceFromLocation:dist];    NSLog(@"距离:%f",kilometers);    if (kilometers>=10) {        JuLi=YES;    }    else{        JuLi=NO;    }    return JuLi;

二十. 弹出效果

/** *  弹出对话框的动画 * *  @param changeOutView 要执行的view *  @param dur           动画时长 */-(void)exChangeOut:(UIView *)changeOutView dur:(CFTimeInterval)dur{    CAKeyframeAnimation * animation;    animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];    animation.duration = dur;    //animation.delegate = self;    animation.removedOnCompletion = NO;    animation.fillMode = kCAFillModeForwards;    NSMutableArray *values = [NSMutableArray array];    [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];    [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]];    [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.9, 0.9, 0.9)]];    [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];    animation.values = values;    animation.timingFunction = [CAMediaTimingFunction functionWithName: @"easeInEaseOut"];    [changeOutView.layer addAnimation:animation forKey:nil];}

二十一. 设置TextField左右视图

-(id)initWithFrame:(CGRect)frame drawingLeft:(UIImageView *)icon drawingRight:(UIButton *)bu{    self = [super initWithFrame:frame];    if (self) {        self.leftView = icon;        self.leftViewMode = UITextFieldViewModeAlways;        self.rightView= bu;        self.rightViewMode=UITextFieldViewModeAlways;    }    return self;}-(CGRect)leftViewRectForBounds:(CGRect)bounds{    CGRect iconRect = [super leftViewRectForBounds:bounds];    iconRect.origin.x += 5;// 右偏10    return iconRect;}-(CGRect)rightViewRectForBounds:(CGRect)bounds{    CGRect burect=[super rightViewRectForBounds:bounds];    burect.origin.x +=-10;    return burect;}

二十二. 常用宏定义

#define PUSH(x) AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;[(UINavigationController*)appdelegate.window.rootViewController pushViewController:x animated:YES];#define POP AppDelegate *appdelegate=(AppDelegate *)[UIApplication sharedApplication].delegate;[(UINavigationController*)appdelegate.window.rootViewController popViewControllerAnimated:YES];#define POPROOT OGPAppDelegate *appdelegate=(OGPAppDelegate *)[UIApplication sharedApplication].delegate;[(UINavigationController*)appdelegate.window.rootViewController popToRootViewControllerAnimated:YES];#define IOS7 ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)#define IPHONE_4INCH ([UIScreen mainScreen].bounds.size.height > 480.0f)

二十三. 获取版本号提示版本更新

-(void)VersionButton{    NSString * string=[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://itunes.apple.com/lookup?id=??????????"] encoding:NSUTF8StringEncoding error:nil];    if (string!=nil && [string length]>0 && [string rangeOfString:@"version"].length==7) {        [self checkenAppUpdate:string];    }}-(void)checkenAppUpdate:(NSString *)appinfo{    NSString * version=[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];    NSString * appInfo1=[appinfo substringFromIndex:[appinfo rangeOfString:@"\"version\":"].location+10];    appInfo1=[[appInfo1 substringToIndex:[appInfo1 rangeOfString:@","].location] stringByReplacingOccurrencesOfString:@"\"" withString:@""];    if (![appInfo1 isEqualToString:version]) {        UIAlertView * alert=[[UIAlertView alloc]initWithTitle:@"" message:[NSString stringWithFormat:@"新版本%@, 已经发布",appInfo1] delegate:self cancelButtonTitle:@"知道了" otherButtonTitles: nil];        alert.delegate=self;        [alert addButtonWithTitle:@"前往更新"];        [alert show];        alert.tag=20;    }}-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{    if (buttonIndex==1 & alertView.tag==20) {        NSString * url=@"https://appsto.re/cn/-naScb.i";        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];    }}

二十四. 获取设备或APP信息

//返回应用程序名称+(NSString *) getAppName{    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];    return [infoDictionary objectForKey:@"CFBundleDisplayName"];}//返回应用版本号+(NSString *) getAppVersion{    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];    return [infoDictionary objectForKey:@"CFBundleShortVersionString"];}+(NSString *) getAppBundleVersion{    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];    return [infoDictionary objectForKey:@"CFBundleVersion"];}//设备型号+(NSString *) getSystemName{    return [[UIDevice currentDevice] systemName];}//设备版本号+(NSString *) getSystemVersion{    return [[UIDevice currentDevice] systemVersion];}

二十五. 内存泄漏分析

 静态分析内存泄露 使用Xcode自带的Analyze功能(Product-> Analyze)(Shift + Command + B),对代码进行静态分析,对于内存泄露(Potential Memory Leak), 未使用局部变量(dead store),逻辑错误(Logic Flaws)以及API使用问题(API-usage)等明确的展示出来。 静态分析的内存泄露情况比较简单,开发者都能很快的解决。这里不做赘述。动态分析内存泄露 使用Xcode自带的Profile功能(Product-> Profile)(Command + i)弹出工具框,选择Leaks打开,选择运行设备点左上角的Record录制按钮,项目就会在已选好的设备上运行,并开始录制内存检测情况。选Leaks查看泄露情况,在Leaks的详细菜单Details选项里选调用树Call Tree,可查看所有内存泄露发生在哪些地方。再在右侧的齿轮设置-Call Tree-勾选Hide System Libraries,则可直接看内存泄露发生的函数名、方法名。点击函数名、方法名,可直接跳到函数方法的细节,可以看到哪一句代码出现了内存泄露,以及泄露了多少内存。

接下来就要回到Xcode,找到出现内存泄露的函数方法,仔细分析如何出现的内存泄露; 一般使用ARC,按照上面一提到的内存理解和编码习惯是不会出现内存泄露的。但我们在开发过程中,经常要使用第三方的一些类库,特别是涉及到加密的类库,用c或c++来编码的加密解密方法,会出现内存泄露。此时,我们要明白这些内存分配,需要手动释放。要一步一步看,哪里分配了内存,在使用完之后一定要记得释放free它。

二十六. block循环利用导致内存泄漏

A *a = [[A alloc] init]; a.finishBlock = ^(NSDictionary paraments){ [a doSomething]; }; 对于这种在block块里引用对象a的情况,要在创建对象a时加修饰符block来防止循环引用。 block A *a = [[A alloc] init]; a.finishBlock = ^(NSDictionary paraments){ [a doSomething]; }; 或 A __block a = [[A alloc] init]; a.finishBlock = ^(NSDictionary paraments){ [a doSomething]; }; 或者,需要在block中调用用self的方法、属性、变量时,可以这样写__weak typeof(self) weakSelf = self;在block中使用weakSelf。 __weak typeof(self) weakSelf = self; [b doSomethingWithFinishBlock:^{ weakSelf.text = @"内存检测"; [weakSelf doSomething]; }];

二十七. label 的空格属性和局部字段颜色

设置 label 的 autoresizingMask 为 NO ,可以使用空格间隔字符串!    NSMutableAttributedString *hintString=[[NSMutableAttributedString alloc]initWithString:@"点击注册按钮服务协议"];      //获取要调整颜色的文字位置,调整颜色      NSRange range1=[[hintString string]rangeOfString:@"注册"];      [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:range1];      NSRange range2=[[hintString string]rangeOfString:@"服务协议"];      [hintString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range2];      hintLabel.attributedText=hintString;

二十八. 过滤特殊字符

// 定义一个特殊字符的集合    NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:    @"@/:;()¥「」"、[]{}#%-*+=_\\|~<>$€^•'@#$%^&*()_+'\""];    // 过滤字符串的特殊字符    NSString *newString = [trimString stringByTrimmingCharactersInSet:set];

二十九. 设置滑动的时候隐藏 navigationbar

1种:        navigationController.hidesBarsOnSwipe = Yes    第2种:        //1.当我们的手离开屏幕时候隐藏    - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset    {         if(velocity.y > 0)         {        [self.navigationController setNavigationBarHidden:YES animated:YES];        } else {        [self.navigationController setNavigationBarHidden:NO animated:YES];         }    }    velocity.y这个量,在上滑和下滑时,变化极小(小数),但是因为方向不同,有正负之分,这就很好处理  了。

三十. 屏幕截图

 // 1. 开启一个与图片相关的图形上下文    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size,NO,0.0);    // 2. 获取当前图形上下文    CGContextRef ctx = UIGraphicsGetCurrentContext();    // 3. 获取需要截取的view的layer    [self.view.layer renderInContext:ctx];    // 4. 从当前上下文中获取图片    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();    // 5. 关闭图形上下文    UIGraphicsEndImageContext();    // 6. 把图片保存到相册    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

三十一. 去掉 tabbar 和 navgationbar 的黑线

 //去掉tabBar顶部线条    CGRect rect = CGRectMake(0, 0, 1, 1);    UIGraphicsBeginImageContext(rect.size);    CGContextRef context = UIGraphicsGetCurrentContext();    CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);    CGContextFillRect(context, rect);    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();    [self.tabBar setBackgroundImage:img];    [self.tabBar setShadowImage:img];    //[self.navigationController.navigationBar setBackgroundImage:img];    //self.navigationController.navigationBar.shadowImage = ima;    self.tabBar.backgroundColor = SLIVERYCOLOR;

三十二. 判断字符串中是否含有中文

 -(BOOL)isChinese:(NSString *)str{        NSString *match=@"(^[\u4e00-\u9fa5]+$)";        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF matches %@", match];        return [predicate evaluateWithObject:str];    }

三十三. 解决父视图和子视图的手势冲突问题

 /** 解决手势冲突 */    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{        if ([touch.view isDescendantOfView:cicView]) {            return NO;        }        return YES;    }

三十四. 获取当前连接的Wi-Fi的名称

 NSString *wifiName = @"Not Found";        CFArrayRef myArray = CNCopySupportedInterfaces();        if (myArray != nil) {            CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));            if (myDict != nil) {                NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict);                wifiName = [dict valueForKey:@"SSID"];            }        }

三十五. 跨控制器跳转返回

for (UIViewController *controller in self.navigationController.viewControllers) {         if ([controller isKindOfClass:[@“你要返回的控制器类名” class]]) {             [self.navigationController popToViewController:controller animated:YES];         }     }

三十六. layer.cornerRadius 圆角流畅性的优化

loginBtn.layer.rasterizationScale = [UIScreen mainScreen].scale;

三十七. 导航栏和下方视图间隔距离消失

self.automaticallyAdjustsScrollViewInsets=YES;

三十八. 毛玻璃效果(ios8.0以后的版本)

    UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];    visualEffectView.frame = CGRectMake(0, 0, 320*[FlexibleFrame ratio], 180*[FlexibleFrame ratio]);    visualEffectView.alpha = 1.0;

三十九. 移动工程不需要配置路径

创建.pch文件时 , BuildSetting 中的 Prefix Header 中的路径开头可以写 $(SRCROOT)/工程地址, 这样写的好处可以使你的挪动代码不用手动更换路径!

四十. 判断两个数组是否相同

 NSArray *array1 = [NSArray arrayWithObjects:@"a", @"b", @"c",  nil];    NSArray *array2 = [NSArray arrayWithObjects:@"d", @"a", @"c",  nil];    bool bol = false;    //创建俩新的数组    NSMutableArray *oldArr = [NSMutableArray arrayWithArray:array1];    NSMutableArray *newArr = [NSMutableArray arrayWithArray:array2];    //对数组1排序。    [oldArr sortUsingComparator:^NSComparisonResult(id obj1, id obj2){        return obj1 > obj2;    }];    //对数组2排序。    [newArr sortUsingComparator:^NSComparisonResult(id obj1, id obj2){        return obj1 > obj2;    }];    if (newArr.count == oldArr.count) {        bol = true;        for (int16_t i = 0; i < oldArr.count; i++) {            id c1 = [oldArr objectAtIndex:i];            id newc = [newArr objectAtIndex:i];            if (![newc isEqualToString:c1]) {                bol = false;                break;            }        }    }    if (bol) {        NSLog(@" ------------- 两个数组的内容相同!");    }    else {        NSLog(@"-=-------------两个数组的内容不相同!");    }

四十一. block

对于block,都应该使用copy来声明,原因是block来捕获上下文的信息 官方文档

四十二. 使应用在后台运行

- (void)applicationDidEnterBackground:(UIApplication *)application  {      __block UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid;      bgTask = [application beginBackgroundTaskWithExpirationHandler:^{          dispatch_async(dispatch_get_main_queue(), ^{              if (bgTask != UIBackgroundTaskInvalid) {                  bgTask = UIBackgroundTaskInvalid;              }          });      }];      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{          dispatch_async(dispatch_get_main_queue(), ^{              if (bgTask != UIBackgroundTaskInvalid) {                  bgTask = UIBackgroundTaskInvalid;              }          });      });  }  

但其实不是应用一直在运行。

四十三. 计算一段NSString在视图中渲染出来的尺寸

+ (CGSize)sizeOfString:(NSString *)textString font:(UIFont *)font bound:(CGSize)bound {      NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];      paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;      paragraphStyle.alignment = NSTextAlignmentLeft;      if (font == nil) {          font = [UIFont systemFontOfSize:[UIFont systemFontSize]];      }      NSDictionary * attributes = @{NSFontAttributeName : font,                                    NSParagraphStyleAttributeName : paragraphStyle};      NSAttributedString* attributedString = [[NSAttributedString alloc] initWithString:textString attributes:attributes];      return [TTTAttributedLabel sizeThatFitsAttributedString:attributedString                                              withConstraints:CGSizeMake(bound.width, 999)                                       limitedToNumberOfLines:0];  }  

四十四. 获取相应的字体类型名

for(NSString *fontfamilyname in [UIFont familyNames])  {      NSLog(@"Family:'%@'",fontfamilyname);      for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname])      {          NSLog(@"\tfont:'%@'",fontName);      }      NSLog(@"~~~~~~~~");  }  

四十五. Masonry和SVProgreaaHUD需要注意

使用Masonry约束TTTAttributedLabel的时候,初始化TTTAttributedLabel需要设置frame为CGRectZero,否则约束会不生效。SVProgressHUD如果要自定义一些属性,比如loading状态转圈的颜色,必须先设置style为SVProgressHUDStyleCustom,这样自定义的状态才会生效。
                                  ##待续!!
0 0
原创粉丝点击