【问题标题】:How to fit a Image to UIView in IOS7如何在IOS7中将图像适合UIView
【发布时间】:2013-07-16 07:22:53
【问题描述】:

我在 IOS7 中将背景图像设置为 UIView 时遇到问题。我没有得到在 IOS7 中所做的所有缩放更改。在 IOS6 中它运行良好但在 IOS7 中没有。这里是代码我想做什么

UIGraphicsBeginImageContext(self.view.bounds.size);
[[UIImage imageNamed:@"loginframe.png"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

mloginview=[[UIView alloc]initWithFrame:CGRectMake(30,70,260,320)];
mloginview.backgroundColor=[UIColor colorWithPatternImage:image];
[self.view addSubview:mloginview];

这是试图适应 mloginView 的图像

进入模拟器的屏幕截图[输出]

【问题讨论】:

  • 这个问题刷入了基于 NDA 的 SDK。不允许 OP 讨论 iOS 7。

标签: uiview uiimage ios7


【解决方案1】:

我们不能公开讨论 iOS7,因为它处于 NDA 之下。去苹果论坛。说 backgroundColor 不是这样做的好方法。只需添加一个图像视图

【讨论】:

  • 我已经尝试过你告诉的方式(使用 UIImageView)。我仍然没有得到正确的输出
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-03
  • 2019-07-05
  • 1970-01-01
  • 1970-01-01
  • 2015-08-22
相关资源
最近更新 更多