2014-04-02 44 views
0

我有一個UIWebview,在我的視圖中佔據了所有的位置。我的內容是在頂部,但我不改變我的UIWebview內容的代碼,我想顯示我的UIWebview在我的觀點(位置2)的所有設備(IOS6/IOS7)的中心,我怎麼能用我的UIWebview中的好參數或操作來做到這一點?如何在我的視圖中心顯示UIWebView內容?

我使用xib文件。 我不使用AutoLayout作爲我的視圖。

My situation actually

感謝提前

+0

你可以閱讀https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/WorkingwithConstraints/WorkingwithConstraints.html。對齊視圖。適當的限制。 – jnix

+0

我不使用autoLayout,對不起 –

+0

只需將UIWebVew框架的中心調整到ViewDidLoad中視圖的中心即可:webView.center = self.view.center; – EmilDo

回答

0

你可以做到這一點programattically爲...

CGRect viewrect = view.bounds. 

webview.center = CGPointMake(viewrect.size.width/2,viewrect.size.height/2); 

試試吧。