0
我有一個UIView控制器有一個背景圖像和一個UIWebView設置爲通過autoresizeResizingMask
屬性自動調整方向更改的大小。它在模擬器中運行平穩,但在設備上預覽時非常緩慢。爲什麼我的UIView行爲緩慢?
我使用web視圖CALayer
的一小部分來創建邊框和陰影,當我評論這些部分時,它運行得更順暢。這是否僅僅是玩CALayer視圖(我懷疑)還是我錯誤地實現了這些部分?
這裏的景色確實load方法
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
NSLog(@"Web project View Controller");
[super viewDidLoad];
UIImageView *bg = [[UIImageView alloc] initWithFrame:self.view.bounds];
bg.contentMode = UIViewContentModeCenter;
bg.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
bg.image = [UIImage imageNamed:@"fuzzyhalo.png"];
[self.view addSubview:bg];
projectView = [[UIWebView alloc] initWithFrame:self.view.bounds];
projectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
projectView.layer.backgroundColor = [UIColor blackColor].CGColor;
projectView.layer.shadowColor = [UIColor blackColor].CGColor;
projectView.layer.shadowOpacity = 1.0;
projectView.layer.shadowRadius = 5.0;
projectView.layer.shadowOffset = CGSizeMake(0, 0);
projectView.layer.borderColor = [UIColor blueColor].CGColor;
projectView.layer.borderWidth = 2.0;
CGRect newFrame = self.view.bounds;
newFrame.origin.x = 40;
newFrame.origin.y = 40;
newFrame.size.width = newFrame.size.width - 80;
newFrame.size.height = newFrame.size.height - 80;
projectView.frame = newFrame;
[self.view addSubview:projectView];
}
背景圖片也相當大。 1024x1024 72ppi PNG。
任何幫助非常感謝。謝謝。