s1m*_*m0n 5 cocoa objective-c ipad ios
我有一个带有1的故事板UIViewController,持有1 UIView包含许多嵌套的UIViews.我将View Controller子类化为实现此方法:
- (BOOL)shouldAutorotateToInterfaceOrientation: UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
Run Code Online (Sandbox Code Playgroud)
我还补充道
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeLeft</string>
Run Code Online (Sandbox Code Playgroud)
到了Info.plist.
在主UIView的viewDidLoad中我这样做:
PASectionView* sectionView = [[PASectionView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 180)];
[self addSubview:sectionView];
Run Code Online (Sandbox Code Playgroud)
问题是控制只有756像素宽而不是预期的1024.有关详细信息,请参阅下面的屏幕截图.
我一直在网上搜索,但我无法找到解决这个令人沮丧的问题的方法.我正在使用Xcode 4.5和iOS5.1设置为基本SDK.
编辑 它通过用边界替换框架来工作.但是我不明白发生了什么,所以它不适用于帧大小.
A-L*_*ive 11
框架矩形,用于描述超视图坐标系中视图的位置和大小.
@property(非原子)CGRect框架
和
边界矩形,用于描述视图在其自身坐标系中的位置和大小.
@property(非原子)CGRect边界
使用边界,而不是框架.
| 归档时间: |
|
| 查看次数: |
5997 次 |
| 最近记录: |