UIImageView

1。图片旋转180

#define degreesToRadian(x) (M_PI * (x) / 180.0)

 

CGAffineTransform rotate = CGAffineTransformMakeRotation(degreesToRadian(180));

[_tailShadowImageViewsetTransform:rotate];

 

2。定义

    headImageView = [[UIImageView alloc]init];

    headImageView.image = [MHFileimageWithResourceName:@"more_bg_pad.png"];

    [self.viewaddSubview:headImageView];

 

/*

 * 函数作用读取资源文件夹下的图片

 * 函数参数:  imgName:图片名字

 * 函数返回值: 图片img

 */

+ (UIImage *)imageWithResourceName:(NSString *)imgName

{    

    return [UIImageimageWithContentsOfFile:[selfgetResourcesFile:imgName]];

}

 

 

 

3。处理(NSData *)data

   UIImage* image = [[[UIImagealloc]initWithData:data] autorelease];

 

 

4rgb颜色

 

#define HEXCOLOR(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

 

16进制都是以0x开头  f0f0f0之前要加上0x

_entryWebView.backgroundColor = self.view.backgroundColor = HEXCOLOR(0xf0f0f0);

 

5.圆角

    _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(13, (RECOMMENDED_HEIGHT - 97)/2, 96, 96)];

    _iconImageView.layer.masksToBounds = YES;

    _iconImageView.layer.cornerRadius = 6.0;

    _iconImageView.layer.borderWidth = 4.5;

    _iconImageView.layer.borderColor = [[UIColorcolorWithRed:192.0/250green:192.0/250blue:192.0/250alpha:1.0] CGColor];

//

//    _iconImageView.layer.shadowColor = [[UIColor redColor] CGColor];

//    _iconImageView.layer.shadowOffset = CGSizeMake(0, 1);

//    _iconImageView.layer.shadowOpacity = 0.5f;

//    _iconImageView.layer.shadowRadius = 1.0f;

 
posted @ 2012-12-13 10:01  六界剑仙  阅读(129)  评论(0)    收藏  举报