您好我正在尝试David Mark et.al编写的iOS 6编程手册,我正在研究Autorotation和Autosizing部分。
如果any1可以帮我修复这个不断出现的恼人错误,我将不胜感激:
以下代码位于.m文件中:
#import "BIDViewController.h"
#define degreesToradians(x) (M_PI * (x) / 180.0)
@interface BIDViewController ()
@end
@implementation BIDViewController
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
self.view = self.portrait;
self.view.transform = CGAffineTransformIdentity;
self.view.transform =
CGAffineTransformMakeRotation(degreesToradians(0));
self.view.bounds = CGRectMake(0.0,0.0,320.0,460.0);
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
self.view = self.landscape;
self.view.transform = CGAffineTransformIdentity;
self.view.transform =
CGAffineTransformMakeRotation(degreesToradians(-90));
self.view.bounds = CGRectMake(0.0,0.0,480.0,300.0);
}
else if (interfaceOrientation ==
UIInterfaceOrientationLandscapeRight) {
self.view = self.landscape;
self.view.transform = CGAffineTransformIdentity;
self.view.transform =
CGAffineTransformMakeRotation(degreesToradians(90));
self.view.bounds = CGRectMake(0.0,0.0,480.0,300.0);
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)buttonPressed:(id)sender {
NSString *message = nil;
if ([self.foos containsObject:sender])
message = @"Foo Button Pressed";
else
message = @"Bar Button Pressed";
**UIAlertView *alert = [[UIAlertView alloc] initwithtitle:message**
message:nil
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
@end
弹出的错误是“UIAlertView没有可见的@interface”......
我尝试找到关于“标题”的拼写错误,但错误仍然存在......这是针对iOS的!
任何帮助?
谢谢
答案 0 :(得分:1)
initwithtitle:
...应为initWithTitle:
...请在发布此类问题之前彻底检查您的工作。发布完整错误也会更有帮助。