图片分类 @implementation UIImageView (ext) +(UIImageView*)imageViewWith:(UIImage*)img imgFrame:(CGRect)_rect{ UIImageView *imgView = [[[UIImageViewalloc] initWithFrame:_rect] autorelease]; imgView.image = img; return imgView; } //图片拉绳 + (UIImageView *)imageViewForResizableImage:(UIImage *)image inRect:(CGRect)rect { UIImageView *imageView = [[[UIImageViewalloc] initWithFrame:rect] autorelease]; imageView.userInteractionEnabled = YES; if ([image respondsToSelector:@selector(resizableImageWithCapInsets:)]) { imageView.image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height/, image.size.width/, image.size.height/, image.size.width/)]; } else { imageView.image = [image stretchableImageWithLeftCapWidth:image.size.width/ topCapHeight:image.size.height/]; } return imageView; } @end
用block快速创建一个block +(XPNetWork*)shareNetWork{
static XPNetWork *network = NULL; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
network = [[self alloc] init];
});
return network;
} UITableviewCell进行分组的
一个集合(NSArrary)包含多个个集合(NSArray addobject:nsarrary]。section
一个集合包含 多个字典( nsarrary add object :字典】 row 赋值的时候 //self.mydata是最大集合
NSArray *sectionArray=self.mydata[indexPath.section];//得到组 section
NSDictionary *resDic=sectionArray[indexPath.row];//得到row.
//通过字典进行赋值。
NSString *keySt = [NSString stringWithFormat:@"%@:",[[resDic allKeys] objectAtIndex:]];
NSString *valueSt = [[resDic allValues] objectAtIndex:];