ios - Create view hierarchy programmatically with Auto Layout -


I want to create a visible hierarchy of the program using automatic layout The following structure is in the hierarchy: UIView -> UIWebView I Some place for a UIToolbar at the bottom of UIView want to go

The result should be in the form of this xib file: Enter image details here

The code is still:

  - (zero) load view {UIView * view = [[UIView alloc] initWithFrame: [[UIScreen main screen] border]]; Self.view = View; Self.webView = [[UIWebView alloc] init]; Self.webView.scalesPageToFit = Yes; [Self.view addSubview: self.webView]; Self.view.translatesAutoresizingMaskIntoConstraints = No; Self.webView.translatesAutoresizingMaskIntoConstraints = No; NSDictionary * nameMap = @ {@ "webview": self.webView}; NSArray * c1Array = [NSLayoutConstraint Visual Format with Hurdles: @ "H: | -0- [Webview] -0- |" Options: 0 metric: zero view: nameMap]; NSArray * c2Array = [NSLayoutConstraint Visual Format with Hurdles: @ "V: | -0- [Webview] -45- |" Options: 0 metric: zero view: nameMap]; [Self.view addConstraints: c1Array]; [Self.view addConstraints: c2Array]; }  

When I use these:

  po [[UIWindow keyWindow] _autolayoutTrace]  

me It seems that both UIView and UIWebView are obscure layouts.

What can be the problem in my approach?

You should not set translatesAutoresizingMaskIntoConstraints to make a translation for the administrator's self.view. If you remove that line, then you must have enough obstacles. BTW, there is no need for zero in their format string (although they have not hurt),

this "h: | [webView] |" is equal to "h: | -0- [webView] -0- |" .


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -