-2

嗨,我目前正在试用 David mark 等人的 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 的!

有什么帮助吗?

谢谢

4

1 回答 1

1

initwithtitle:... should be initWithTitle:... Please thoroughly check your work before posting a question like this however. Also posting the full error would be more helpful.

于 2013-08-22T14:13:27.780 回答