我一直在研究如何将应用程序的背景图像居中。这主要是为了允许我使用方形图像来减少要存储的资源量(并在进行更改时更新)。
问问题
315 次
1 回答
1
这是我用来实现结果的代码
// Create the window covering the bounds of the entire screen
self.window = [ [ [ UIWindow alloc ] initWithFrame:[ [ UIScreen mainScreen ] bounds ] ] autorelease ];
// Set the background for the game. This will show on the flip transition.
UIImageView *bg = [ [ UIImageView alloc ] initWithImage: [ UIImage imageNamed: @"Background.png" ] ];
bg.frame = self.window.bounds;
bg.contentMode = UIViewContentModeCenter;
[ self.window addSubview: bg ];
[ self.window sendSubviewToBack: bg ];
[ bg release ];
于 2013-01-29T10:53:31.637 回答