2012-07-19 1 views
0

XCODE를 처음 사용하지만 익숙하지 않습니다. 기본적으로 내 프로젝트는 Nada Jaksic의 iPhone에 대한 테이블 기반 양식 만들기에 대한 재 작업입니다. 코딩 과정에서 잘못된 부분을 알게되어서 제 실수에서 배울 수 있습니다. 모든 도움을 주시면 감사하겠습니다! 내 SignupTableViewController.m 파일에서XCode 4.2 : 의미 상 문제 '@end'가 구현 컨텍스트에서 누락되었습니다 & 예기치 않은 '@'가 프로그램에서

#import <UIKit/UIKit.h> 

@interface SignupTableViewController : UITableViewController<UITextFieldDelegate, UIActionSheetDelegate> 

{ 


    IBOutlet UITableViewCell *cellExaminername; 
    IBOutlet UITableViewCell *cellExamineraddress; 
    IBOutlet UITableViewCell *cellExaminercity; 
    IBOutlet UITableViewCell *cellExaminerstate; 
    IBOutlet UITableViewCell *cellExaminerzip; 
    IBOutlet UITableViewCell *cellExamineremail; 
    IBOutlet UITableViewCell *cellSearchthroughdate; 
    IBOutlet UITableViewCell *cellTitleheldby; 
    IBOutlet UITableViewCell *cellPropertyaddress1; 
    IBOutlet UITableViewCell *cellPropertyaddress2; 
    IBOutlet UITableViewCell *cellPropertycity; 
    IBOutlet UITableViewCell *cellPropertystate; 
    IBOutlet UITableViewCell *cellProperyzip; 
    IBOutlet UITableViewCell *cellTitlesearchnotes;  



    IBOutlet UITextField* txtExaminername; 
    IBOutlet UITextField* txtExamineraddress; 
    IBOutlet UITextField* txtExaminercity; 
    IBOutlet UITextField* txtExaminerstate; 
    IBOutlet UITextField* txtExaminerzip; 
    IBOutlet UITextField* txtExamineremail; 
    IBOutlet UITextField* txtSearchthroughdate; 
    IBOutlet UITextField* txtTitleheldby; 
    IBOutlet UITextField* txtPropertyaddress1; 
    IBOutlet UITextField* txtPropertyaddress2; 
    IBOutlet UITextField* txtPropertycity; 
    IBOutlet UITextField* txtPropertystate; 
    IBOutlet UITextField* txtPropertyzip; 
    IBOutlet UITextField* txtTitlesearchnotes; 

    UIActivityIndicatorView* activityIndicator; 


} 

@property (nonatomic, retain) IBOutlet UITableViewCell *cellExaminername; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellExamineraddress; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellExaminercity; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellExaminerstate; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellExaminerzip; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellExamineremail; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellSearchthroughdate; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellTitleheldby; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellPropertyaddress1; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellPropertyaddress2; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellPropertycity; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellPropertystate; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellProperyzip; 
@property (nonatomic, retain) IBOutlet UITableViewCell *cellTitlesearchnotes; 


@property (nonatomic, retain) IBOutlet UITextField* txtExaminername; 
@property (nonatomic, retain) IBOutlet UITextField* txtExamineraddress; 
@property (nonatomic, retain) IBOutlet UITextField* txtExaminercity; 
@property (nonatomic, retain) IBOutlet UITextField* txtExaminerstate; 
@property (nonatomic, retain) IBOutlet UITextField* txtExaminerzip; 
@property (nonatomic, retain) IBOutlet UITextField* txtExamineremail; 
@property (nonatomic, retain) IBOutlet UITextField* txtSearchthroughdate; 
@property (nonatomic, retain) IBOutlet UITextField* txtTitleheldby; 
@property (nonatomic, retain) IBOutlet UITextField* txtPropertyaddress1; 
@property (nonatomic, retain) IBOutlet UITextField* txtPropertyaddress2; 
@property (nonatomic, retain) IBOutlet UITextField* txtPropertycity; 
@property (nonatomic, retain) IBOutlet UITextField* txtPropertystate; 
@property (nonatomic, retain) IBOutlet UITextField* txtPropertyzip; 
@property (nonatomic, retain) IBOutlet UITextField* txtTitlesearchnotes; 
-(void)signup; 

@end 

: 다음 SignupTableViewController.h 파일에서

.

#import "SignupTableViewController.h" 

@implementation SignupTableViewController 
@synthesize cellExaminername, cellExamineraddress, cellExaminercity, cellExaminerstate, cellExaminerzip, cellExamineremail, cellSearchthroughdate, cellTitleheldby, cellPropertyaddress1, cellPropertyaddress2, cellPropertycity, cellPropertystate, cellProperyzip, cellTitlesearchnotes; 
@synthesize txtExaminername, txtExamineraddress, txtExaminercity, txtExaminerstate, txtExaminerzip, txtExamineremail, txtSearchthroughdate, txtTitleheldby, txtPropertyaddress1, txtPropertyaddress2, txtPropertycity, txtPropertystate, txtPropertyzip, txtTitlesearchnotes; 

#pragma mark - 
#pragma mark View lifecycle 


- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // Uncomment the following line to preserve selection between presentations. 
    //self.clearsSelectionOnViewWillAppear = NO; 

    UIBarButtonItem* btnSubmitSignup = [[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"Join",@"") style:UIBarButtonItemStylePlain target:self action:@selector(signup)]; 
    [[self navigationItem] setRightBarButtonItem:btnSubmitSignup]; 
} 


#pragma mark - 
#pragma mark Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
// Return the number of sections. 
    return 1; 
} 


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    // Return the number of rows in the section. 
    return 14; 
} 


// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{  

    if (indexPath.row == 0) { 
     return cellExaminername; 
    } 
    if (indexPath.row == 1) { 
     return cellExamineraddress; 
    } 
    if (indexPath.row == 2) { 
     return cellExaminercity; 
    } 
    if (indexPath.row == 3) { 
     return cellExaminerstate; 
    } 
    if (indexPath.row == 4) { 
     return cellExaminerzip; 
    }  
    if (indexPath.row == 5) { 
     return cellExamineremail; 
    }  
    if (indexPath.row == 6) { 
     return cellSearchthroughdate; 
    } 
    if (indexPath.row == 7) { 
     return cellTitleheldby; 
    } 
    if (indexPath.row == 8) { 
     return cellPropertyaddress1; 
    }  
    if (indexPath.row == 9) { 
     return cellPropertyaddress2; 
    }  
    if (indexPath.row == 10) { 
     return cellPropertycity; 
    } 
    if (indexPath.row == 11) { 
     return cellPropertystate; 
    }  
    if (indexPath.row == 12) { 
     return cellProperyzip; 
    }  
    if (indexPath.row == 13) { 
     return cellTitlesearchnotes; 
    } 

} 

#pragma mark - 
#pragma mark Table view delegate 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    // Navigation logic may go here. Create and push another view controller. 
    /* 
    <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; 
    // ... 
    // Pass the selected object to the new view controller. 
    [self.navigationController pushViewController:detailViewController animated:YES]; 
    [detailViewController release]; 
    */ 
} 

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{ 
    [textField resignFirstResponder]; 
    return YES; 
} 

- (void)textFieldDidBeginEditing:(UITextField *)textField 




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

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

- (void)viewDidUnload { 
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. 
    // For example: self.myOutlet = nil; 
} 

-(void) signup 
{ 
    // make sure the keyboard is hidden 
    [txtExaminername resignFirstResponder]; 
    [txtExamineraddress resignFirstResponder]; 
    [txtExaminercity resignFirstResponder]; 
    [txtExaminerstate resignFirstResponder]; 
    [txtExaminerzip resignFirstResponder]; 
     [txtExamineremail resignFirstResponder]; 
    [txtSearchthroughdate resignFirstResponder]; 
    [txtTitleheldby resignFirstResponder]; 
    [txtPropertyaddress1 resignFirstResponder]; 
    [txtPropertyaddress2 resignFirstResponder]; 
    [txtPropertycity resignFirstResponder];  
    [txtPropertystate resignFirstResponder]; 
    [txtPropertyzip resignFirstResponder]; 
    [txtTitlesearchnotes resignFirstResponder]; 



    activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; 
    [activityIndicator setCenter:CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height/2.0+20)]; 
    [activityIndicator startAnimating]; 
    [self.view addSubview:activityIndicator]; 

    if (![self validateSignupForm]) 
     return; 

    //do your signup code here 

} 

-(BOOL)validateSignupForm 
{ 
    BOOL rtn = YES; 
    // Declare your Alert, NSArray, increment int 
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil  message:NSLocalizedString(@"FormIncomplete", @"") delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    NSArray *fieldArray;  
    int i = 0; 

    // Load up our field array with the UITextField Values 
    fieldArray = [NSArray arrayWithObjects: 
        [NSString stringWithFormat:@"%@",txtExaminername.text], 
        [NSString stringWithFormat:@"%@",txtExamineraddress.text], 
        [NSString stringWithFormat:@"%@",txtExaminercity.text], 
        [NSString stringWithFormat:@"%@",txtExaminerstate.text], 
        [NSString stringWithFormat:@"%@",txtExaminerzip.text], 
        [NSString stringWithFormat:@"%@",txtExamineremail], 
        [NSString stringWithFormat:@"%@",txtSearchthroughdate.text], 
        [NSString stringWithFormat:@"%@",txtTitleheldby.text], 
        [NSString stringWithFormat:@"%@",txtPropertyaddress1.text], 
        [NSString stringWithFormat:@"%@",txtPropertyaddress2.text], 
        [NSString stringWithFormat:@"%@",txtPropertycity.text],     
        [NSString stringWithFormat:@"%@",txtPropertystate.text], 
        [NSString stringWithFormat:@"%@",txtPropertyzip.text],     
        [NSString stringWithFormat:@"%@",txtTitlesearchnotes.text]]; 



    // loop through the array, alert if text field is empty, and break the the loop, other wise increment i 
    for (NSString *fieldText in fieldArray){ 
     NSLog(fieldText); // make sure all is reading correctly in the console 
     if([fieldText isEqualToString:@""]){    
      [alert show]; 
      rtn = NO; 
      break; // break out!! 
     } 
     i++;   
    } 

    // check that all the field were passed (i == array.count) 
    //if(i == [[NSNumber numberWithInt: fieldArray.count] intValue]){ 
    //NSLog(@"Passed validation..."); 
    //rtn = YES;   
    // { 

    //if (rtn) 


    @end 

답변

5

귀하의 -validateSignupForm 방법은 폐쇄 } 누락

이것이 사실 일 수 있다는 힌트는 Xcode가 @end을 들여 쓰려한다는 욕구입니다.

+0

정말 고마워요! 나는 이것이 내 실수에 불과하다는 것을 알았다. – user1539154

+0

괜찮습니다! 정답에 체크 표시 승인 버튼을 클릭해야합니다. – andyvn22