質問

I've got a problem with the Xcode Interface Builder (last available version), and his Autoresizing Mask for an iPad application.

I have these views, which frames are all setted via IB, since the moment that I want to write less code as possible:

  • BannerAnteprime (UIScrollView), x: 0, y: 0, width: 768, height: 480.
  • CentralToolbar (UIToolbar), x: 0, y: 480, width: 768, height: 44 (default not editable)
  • BannerVideo (UIScrollView), x: 0, y: 522, width: 768, height: 480.

the App supports the rotation, so when the users rotate to Landscape or to Portrait orientation, I'd like that the views resize automatically, but, no matter what I do, I don't get the hoped results, I've printed the frame when the user has rotated the device, and here's what I've got:

// Printed o viewWillAppear, you can see here that the height are wrong, resized to 431
2011-12-28 15:26:38.363 iUDC[529:f803] BannerAnteprime: x 0.000000, y 0.000000, w 768.000000, h 431.000000
2011-12-28 15:26:38.363 iUDC[529:f803] BannerVideo: x 0.000000, y 524.000000, w 768.000000, h 431.000000
2011-12-28 15:26:38.364 iUDC[529:f803] CentralToolbar: x 0.000000, y 455.000000, w 768.000000, h 44.000000

// These logs are printed on didRotateFromInterface...
2011-12-28 15:26:51.464 iUDC[529:f803] BannerAnteprime: x 0.000000, y 0.000000, w 1024.000000, h 175.000000
2011-12-28 15:26:51.464 iUDC[529:f803] BannerVideo: x 0.000000, y 524.000000, w 1024.000000, h 175.000000
2011-12-28 15:26:51.464 iUDC[529:f803] CentralToolbar: x 0.000000, y 327.000000, w 1024.000000, h 44.000000
2011-12-28 15:27:01.992 iUDC[529:f803] BannerAnteprime: x 0.000000, y 0.000000, w 768.000000, h 431.000000
2011-12-28 15:27:01.992 iUDC[529:f803] BannerVideo: x 0.000000, y 524.000000, w 768.000000, h 431.000000
2011-12-28 15:27:01.993 iUDC[529:f803] CentralToolbar: x 0.000000, y 455.000000, w 768.000000, h 44.000000
2011-12-28 15:27:02.925 iUDC[529:f803] BannerAnteprime: x 0.000000, y 0.000000, w 1024.000000, h 175.000000
2011-12-28 15:27:02.925 iUDC[529:f803] BannerVideo: x 0.000000, y 524.000000, w 1024.000000, h 175.000000
2011-12-28 15:27:02.926 iUDC[529:f803] CentralToolbar: x 0.000000, y 327.000000, w 1024.000000, h 44.000000
2011-12-28 15:27:03.895 iUDC[529:f803] BannerAnteprime: x 0.000000, y 0.000000, w 768.000000, h 431.000000
2011-12-28 15:27:03.896 iUDC[529:f803] BannerVideo: x 0.000000, y 524.000000, w 768.000000, h 431.000000
2011-12-28 15:27:03.896 iUDC[529:f803] CentralToolbar: x 0.000000, y 455.000000, w 768.000000, h 44.000000

As you can see, there's something wrong with the dimensions and the positions. The mask configurations for the scrollviews are:

http://www.issamtp.org/ScrollViews.png

While for the toolbar:

http://www.issamtp.org/Toolbar.png

and these lead me to the most correct results that I can get, that are:

http://www.issamtp.org/portrait.png for portrait and:


(source: issamtp.org)
for landscape.

Where am I wrong?

役に立ちましたか?

解決

Solved. It was a mistake on the mask: I've selected TopMargin LeftMargin for the upper UIScrollView, LeftMargin BottomMargin for the lower one and LeftMargin only for the toolbar.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top