#pragma mark -- 创建主页图像视图
-(void)createScaleHeadView {
UIView *topHeadView = [[UIView alloc]initWithFrame:CGRectMake(0, 0,78,44)];
topHeadView.backgroundColor = [UIColor clearColor];
_topImageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 5, 78, 78)];
_topImageView.backgroundColor = [UIColor whiteColor];
_topImageView.layer.cornerRadius = _topImageView.bounds.size.width /2.;
_topImageView.layer.anchorPoint = CGPointMake(0.5, 0.5);
_topImageView.image = [UIImage imageNamed:@"head"];
//******切割圆形头像*******************
UIGraphicsBeginImageContext(_topImageView.bounds.size);
CGRect imageRect =CGRectMake(0, 0, 78, 78);
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:imageRect];
[[UIColor redColor] setStroke];
path.lineWidth =1;
[path stroke];
[path addClip];
UIImage *image =[UIImage imageNamed:@"head"];
[image drawInRect:imageRect];
//用画布生成一个image对象
UIImage *newImage =UIGraphicsGetImageFromCurrentImageContext();
//关闭绘制 的上下文区间
UIGraphicsEndPDFContext();
_topImageView.image =newImage;
//******切割圆形头像***************************************
[topHeadView addSubview:_topImageView];
self.navigationItem.titleView = topHeadView;
}