【发布时间】:2023-04-08 00:17:01
【问题描述】:
我有一个表格视图,我想制作一个自定义 uinavigationn 栏我尝试了这段代码
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)];
//here for v, width= navBar width and height=navBar height
//
[view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"newsBanner.png"]]];
[self.navigationController.navigationBar addSubview:view];
问题是图像没有居中,因为它的尺寸是 640 x 72...有没有办法让它适合?
【问题讨论】: