我有一个旧项目,因为用户将其os更新为ios 9.0,所以面临一个错误。事情是我的视图被加载,所有按钮和功能工作正常但是ui只是空白。
这是我的应用程序在ios 9.1上运行
这是我的代码:
我的viewcontroller.h文件:
@property (strong, nonatomic) IBOutlet UIScrollView *theScrollView;
@property (weak, nonatomic) IBOutlet UIView *mainToolbar2;
我的viewcontroller.m:
CGRect scrollViewRect = CGRectInset(viewRect, -scrollViewOutset, 0.0f);
self.theScrollView = [[UIScrollView alloc] initWithFrame:scrollViewRect]; // All
self.theScrollView.autoresizesSubviews = NO;
self.theScrollView.contentMode = UIViewContentModeRedraw;
self.theScrollView.showsHorizontalScrollIndicator = NO;
self.theScrollView.showsVerticalScrollIndicator = NO;
self.theScrollView.scrollsToTop = NO;
self.theScrollView.delaysContentTouches = NO;
self.theScrollView.pagingEnabled = YES;
self.theScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.theScrollView.backgroundColor = [UIColor redColor];
self.theScrollView.delegate = self;
if (_isArabic) {
self.theScrollView.transform=CGAffineTransformMakeRotation(M_PI * (180) / 180.0);
}
[self.mainView addSubview:self.theScrollView];
CGRect toolbarRect = viewRect;
toolbarRect.size.height = TOOLBAR_HEIGHT;
self.mainToolbar = [[ReaderMainToolbar alloc] initWithFrame:toolbarRect document:document]; // ReaderMainToolbar
self.mainToolbar.delegate = self; // ReaderMainToolbarDelegate
[self.mainView addSubview:self.mainToolbar];
if (fakeStatusBar != nil) [self.mainView addSubview:fakeStatusBar]; // Add status bar background view
for (UIView *subView in self.mainToolbar.subviews)
{
[subView removeFromSuperview];
}
[self.mainToolbar addSubview:self.mainToolbar2];
我认为在ios 9上有一些更改,用于从xib文件添加subview,我不知道。如何修复此问题以便应用程序也可以在ios 9上运行?
答案 0 :(得分:0)
我认为添加子视图没有任何区别。你可以试试像......
self.theScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
行@property (weak, nonatomic) IBOutlet UIView *mainToolbar2;