笔记

//单位时间内放大图片的动画
-(void)changeSize:(UIView*)tmp beginSize:(float)begins endSize:(float)ends time:(float)time{
    tmp.scale = begins;
    [UIView beginAnimations:nil context:tmp];
    [UIView setAnimationDuration:time];
    tmp.scale = ends;
    [UIView commitAnimations];
}
//单位时间内改变View的透明度

-(void)appear:(UIView*)tmp beginAlphaSize:(float)begins alphaEndSize:(float)ends time:(float)time{
    tmp.alpha = begins;
    [UIView beginAnimations:nil context:tmp];
    [UIView setAnimationDuration:time];
    tmp.alpha = ends;
    [UIView commitAnimations];
}


//获取当前系统的时间
    NSString* date;
    NSDateFormatter* formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"YYYY-MM-dd-hh:mm:ss:ms"];
    date = [formatter stringFromDate:[NSDate date]];
    NSLog(@"%@",date);


//修改 左侧 返回键的背景颜色

[[UIBarButtonItem appearance] setTintColor:[UIColor redColor]];


//图片随机移动
-(void)MoveRand:(UIView*)tmpView{
//    +[Utility getRandomNumber:-10 to:10]
    tmpView.point = CGPointMake(tmpView.point.x + [Utility getRandomNumber:-1 to:2], tmpView.point.y);
    [self performSelector:@selector(MoveRand:) withObject:tmpView afterDelay:0.5];
    
}

//数组随机排序
    NSArray    *array = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
    array = [array sortedArrayUsingComparator:(NSComparator)^(id obj1, id obj2) {
        return (arc4random() % 3) - 1;
    }];
    NSLog(@"array:%@", array);

//取出系统字体


    NSArray *familyNames = [UIFont familyNames];
    
    for( NSString *familyName in familyNames ){
        
        printf( "Family: %s \n", [familyName UTF8String] );
        
        NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName];
        
        for( NSString *fontName in fontNames ){
            
            printf( "\tFont: %s \n", [fontName UTF8String] );
            
        }
        
    }

//宏定义颜色值

#define UIColorFromRGB(rgbValue) \
    [UIColor colorWithRed:((rgbValue >> 16) & 0xFF)/255.f \
                    green:((rgbValue >> 8) & 0xFF)/255.f \
                     blue:(rgbValue & 0xFF)/255.f \
                    alpha:1.0f]


view有一个属性layer,通过设置cornerRadius来设置圆角的半径,view是正方形的才能保证通过调整圆角半径来形成圆形头像

 [view.layer setCornerRadius:CGRectGetHeight([view bounds]) / 2];
 view.layer.masksToBounds = YES;
然后再给图层添加一个有色的边框,类似qq空间头像那样
view.layer.borderWidth = 5;
view.layer.borderColor = [[UIColor whiteColor] CGColor];
view.layer.contents = (id)[[UIImage imageNamed:@"backgroundImage.png"] CGImage];
这样就可以制作成圆形头像了,很实用的。



//去掉tableview滚动条
    _tableView.showsHorizontalScrollIndicator = NO;
    _tableView.showsVerticalScrollIndicator = NO;

//直接让self.view 旋转90°
#define degreesToRadinas(x) (M_PI * (x)/180.0)
self.view.transform=CGAffineTransformMakeRotation(degreesToRadinas(90));

//遍历字典
    NSEnumerator *keys=[applist keyEnumerator];
    id keyIndic=nil;
    NSString *indexKey;
    while ((keyIndic=[keys nextObject])!=nil) {
//        id valueForkey=[applist objectForKey:keyIndic];
        NSLog(@"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++key=%@",keyIndic);
        indexKey=keyIndic;
    }



//枚举数组

  [arry enumerateObjectsUsingBlock:^(NSDictionary *dic, NSUInteger idx, BOOL *stop)
    {
        NSLog(@"object(%lu)'s description is %@",(unsigned long)idx, [dic description]);
    }
     ];

//可变数组申请内存

BtnTagArray = [[NSMutableArray alloc] initWithCapacity:1];


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值