私は背景画像とUIWebViewがautoresizeResizingMask
プロパティを介して方向変更に自動的にサイズ変更するように設定されたUIViewコントローラを持っています。これはシミュレータでスムーズに実行されますが、デバイス上でプレビューされると非常に遅くなります。UIViewの動作が遅いのはなぜですか?
ウェブビューCALayer
を少し使用して境界線とシャドウを作成します。これらの部分をコメントアウトすると、よりスムーズに動作します。これはコースCALayer(これは私が疑う)を使って遊んでいるとき、またはこれらの部分を間違って実装しているときのコースと同じですか?ここで
ビューは、背景画像も非常に大きい負荷法に
// 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。
大変助かりました。ありがとう。