2011-05-04 58 views

回答

3

[UIImage imageNamed:]緩存圖像。嘗試使用[UIImage imageWithData:]來代替。

+0

更多信息:http:// stacko verflow.com/questions/316236/uiimage-imagenamed-vs-uiimage-imagewithdata – 2011-05-04 11:56:26

2

是的,它工作。 在我們的應用程序,我們與像

1的另一種方法)

[self.view setBackgroundColor:[UIColor colorWithPatternImage: 
    [UIImage imageWithContentsOfFile:[ 
     [NSBundle mainBundle] pathForResource:@"mainScreenBackground" ofType:@"png"]]]]; 

截取的內存使用情況相比,22 MB

2)

[self.view setBackgroundColor:[UIColor colorWithPatternImage: 
    [UIImage imageWithData: 
     [NSData ] pathForResource:@"mainScreenBackground" ofType:@"png"]]]]; 

截取存儲器使用15MB
非常感謝