【发布时间】:2013-01-31 23:08:36
【问题描述】:
我已经设置了一个具有以下内容的课程: MESSidePanelViewControllerSubClass 头文件
@property BOOL setLandscapeOK;
Imp 文件
- (NSInteger)supportedInterfaceOrientations {
// Restriction for the welcome page to only allow potrait orientation
if (setLandscapeOK == YES) {
NSLog(@"Reveal-setting all");
return UIInterfaceOrientationMaskAll;
}
NSLog(@"Reveal-setting portrait");
return UIInterfaceOrientationMaskPortrait;
}
我现在想从另一个文件(视图控制器)更新值。
登录视图控制器
其他视图控制器 imp 文件
- (NSInteger)supportedInterfaceOrientations {
// Restriction for the welcome page to only allow potrait orientation
NSLog(@"Login-supportInterfaceOrientations");
MESSidePanelViewControllerSubClass* setLandscapeOK = YES;
return UIInterfaceOrientationMaskAll;
}
我收到一个错误:
Implicit conversion of 'BOOL' (aka 'signed char') to 'MESSidePanelViewControllerSubClass *' is disallowed with ARC
我应该如何更新另一个文件中的 BOOL 值?
【问题讨论】:
-
也许你需要多读一点 what properties and instances are。这真的……很奇怪(将 BOOL 分配给与该类的属性名称相同的类的实例)
-
而不是
if (setLandscapeOK == YES),使用if (self.setLandscapeOK)。您无需将BOOL与YES/NO进行比较。
标签: ios ios5 uiviewcontroller boolean implicit-conversion