我想爲我的應用程序設置一個隨機背景圖像,這樣每次有人啓動應用程序時都會顯示一個新的背景圖像。設置一個隨機應用程序背景圖像iOS 6
Here's什麼香港專業教育學院試圖在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
方法至今:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSMutableArray *myImageNames = [NSMutableArray arrayWithObjects:@"image1.png", @"image2.png", @"image3.png", nil];
int index = arc4random() % [myImageNames count];
UIColor *background = [[UIColor alloc] initWithPatternImage:[myImageNames objectAtIndex:index]];
self.window.backgroundColor = background;
}
我沒有得到任何錯誤,但我doesn't工作... 任何想法? :)
這工作!謝謝 – 2013-02-19 11:47:24
welcome..accept任何一個答案,如果你有正確的答案。 – Guru 2013-02-19 11:53:23