-1

I'm sure there is an easy answer to this issue, but.....

I get the message "Receiver type "UIAlertView' for instance message does not declare method initWithName

.H looks like this

#import1   <UIKit/UIKit.h>

@interface LoginUIViewController : UIViewController <UIAlertViewDelegate>

-(IBAction) LoginButton;

@end

.M looks like this

 #import "LoginUIViewController.h"

@implementation LoginUIViewController

-(IBAction) LoginButton { 

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" 
                                                   delegate:self
                                                    message:@"message"
                                          CancelButtonTitle:@"Cancel"
                                          otherButtonTitles:@"Cancel",nil];
    [alert show];
}
4

1 回答 1

0

方法是initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:。这些部分需要按该顺序指定并正确拼写,包括大写。

于 2012-10-11T14:30:21.957 回答