より短いです
CGRect rect = self.webView.frame;
rect.origin = CGPointMake(0, 120);
self.webView.frame = rect;
それとも、これが最短の方法ですか(または効率的ですか)
CGRectMake を使用できます。4 つのパラメーター.. x、y、幅、高さ、すべて float。このような:self.webView.frame = CGRectMake(0, 0, 320, 480);
ビューを配置する方法はいくつかあります。donkimが提案したように、CGRectMakeを使用できます。他のオプションには、変換の設定、または処理が簡単な場合は中心の設定が含まれます。通常、CGRectMakeが最適ですが、これらのメソッドがあなたのケースでより役立つ場合に備えて、ここに配置したいと思います。
//Sets the webView's center, automatically adjusting the frame
self.webView.center = CGPointMake(x,y);
また
//Moves where the webview shows up away from its current location, but does not technically adjust its location.
self.webView.transform = CGAffineTransformMakeTranslation(0,120);