2011-02-07 3 views
0

Я хочу отобразить окно входа в систему, а затем ввести логин и пароль credencial, он откроет учетную запись. Поэтому я попытался, но он показал ошибку, например, /81: ошибка: «didReceiveMemoryWarning» uneclared (первое использование при этой функции)* : 81: error: expected ';' до того '{' лексема * 100: ошибка: ожидается заявление или заявление в конце вводаПримеры кода iphone gmail

и я разместил ниже код, пожалуйста, помогите Заранее спасибо

.h файл

#import <UIKit/UIKit.h> 

@interface Password1ViewController : UIViewController { 

UITextField *textfieldName; 
UITextField *textfieldPassword; 

} 
@property (nonatomic, retain) IBOutlet UITextField *textfieldName; 
@property (nonatomic, retain) IBOutlet UITextField *textfieldPassword; 

@end 

.m файл

#import "Password1ViewController.h" 

@implementation Password1ViewController 

@synthesize textfieldName; 
@synthesize textfieldPassword; 

-(void)alertView:(UIAlertView *)alertview clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
    if (buttonIndex != [alertview cancelButtonIndex]) 
    { 

     NSLog(@"Name: %@", textfieldName.text); 
     NSlog(@"Name: %@", textfieldPassword.text); 
    } 
} 

-(void) someMethod 
{ 
    UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"Please Login" message:@""           delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit",nil]; 

    [alert addTextFieldWithValue:@"" label:@"User Name"]; 
    [alert addTextFieldWithValue:@"" label:@"Password"]; 

    textfieldName = [alert textFieldAtIndex:0]; 
    textfieldName.keyboardType = UIKeyboardTypeAlphabet; 
    textfieldName.keyboardAppearance = UIKeyboardAppearanceAlert; 
    textfieldName.autocorrectionType = UITextAutocorrectionTypeNo; 

    textfieldPassword = [alert textFieldAtIndex:1]; 
    textfieldPassword.clearButtonMode = UITextFieldViewModeWhileEditing; 
    textfieldPassword.keyboardType = UIKeyboardTypeNumbersAndPunctuation; 
    textfieldPassword.keyboardAppearance = UIKeyboardAppearanceAlert; 
    textfieldPassword.autocorrectionType = UITextAutocorrectionTypeNo; 
    textfieldPassword.secureTextEntry = YES; 

    [alert show]; 
} 
/* 
// The designated initializer. Override to perform setup that is required before the view is loaded. 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 
     // Custom initialization 
    } 
    return self; 
} 
*/ 

/* 
// Implement loadView to create a view hierarchy programmatically, without using a nib. 
- (void)loadView { 
} 
*/ 

/* 
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
} 
*/ 

/* 
// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 
*/ 

- (void)didReceiveMemoryWarning { 
// Releases the view if it doesn't have a superview. 
    [super didReceiveMemoryWarning]; 

    // Release any cached data, images, etc that aren't in use. 
} 

- (void)viewDidUnload { 
    // Release any retained subviews of the main view. 
    // e.g. self.myOutlet = nil; 
} 

- (void)dealloc { 
    [textfieldName release]; 
    [textfieldPassword release]; 
    [super dealloc]; 
} 

@end 
+0

используйте четыре пробела перед каждой строкой кода и еще четыре пробела, если пишете код внутри цикла и так далее. Вы всегда можете просмотреть предварительный просмотр своего кода во время записи. – Mahesh

ответ

1

Вам не хватало закрывающей скобки, которую я исправил в своем редактировании. Итак, попробуйте теперь отредактировать код.

Смежные вопросы