#pragma mark -- 創(chuàng)建主頁圖像視圖
-(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();
//關(guān)閉繪制 的上下文區(qū)間
UIGraphicsEndPDFContext();
_topImageView.image =newImage;
//******切割圓形頭像***************************************
[topHeadView addSubview:_topImageView];
self.navigationItem.titleView = topHeadView;
}