работая через несколько других проблем, я обнаружил себя в этой точке.Я многому научился о том, что я пытаюсь сделать, но на этом я полностью озадачен.
Я пишу формат текстового поля для имени входа, которое я хотел бы иметь в своем приложении, и потому что apple don 'В нем нет ничего похожего на маску текстового поля. Я решил написать свою собственную ячейку, которая выглядит так, как будто на ней есть маска, но все, что я буду делать, - это конкатенация текстовых полей в фоновом режиме.проблема.Я пытаюсь вызвать textField: shouldChangeCharactersInRange: replaceString: для UITextField в моем Subclassed UITableViewCell, как описано в моем коде ниже.Однако я получаю Запрос на член 'uitextfield' в чем-то, не являющемся структурной ошибкой или ошибкой объединения ... любая помощь будет принята.
////. H
@interface RegisterDeviceViewController : UIViewController <UITableViewDelegate, UITextFieldDelegate> {
RegisterDeviceViewController *registerDeviceViewController;
//UITextFields for the registration cell
UITextField *regFieldOne;
UITextField *regFieldTwo;
UITextField *regFieldThree;
UITextField *regFieldFour;
UITableViewCell *myRegistrationField;
UITableViewCell *mySubmitButton;
}
//UITextFields for the registration cell
@property (nonatomic, retain) IBOutlet UITextField *regFieldOne;
@property (nonatomic, retain) IBOutlet UITextField *regFieldTwo;
@property (nonatomic, retain) IBOutlet UITextField *regFieldThree;
@property (nonatomic, retain) IBOutlet UITextField *regFieldFour;
@property (nonatomic, retain) IBOutlet UITableViewCell *myRegistrationField;
@property (nonatomic, retain) IBOutlet UITableViewCell *mySubmitButton;
@end
/////.m
#import "RegisterDeviceViewController.h"
@implementation RegisterDeviceViewController
//Custom registration cell fields
@synthesize regFieldOne;
@synthesize regFieldTwo;
@synthesize regFieldThree;
@synthesize regFieldFour;
@synthesize myRegistrationField;
@synthesize mySubmitButton;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
self.title = @"Registration";
[super viewDidLoad];
}
//Sets number of sections in the table
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
// Sets the number of rows in each section.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
//Loads both Custom cells into each section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"mythingy"];
if (cell == nil) {
cell = myRegistrationField;
}
UITableViewCell *cellButton = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"mummy"];
if (cellButton == nil) {
cellButton = mySubmitButton;
}
if (indexPath.section == 0) {
return cell;
cell.regFieldOne.delegate = self; //This is where the error is.
}
return cellButton;
}
//This delegate method is not being called.
//textField:shouldChangeCharactersInRange:replacementString:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
int length = [regFieldOne.text length] ;
if (length >= MAXLENGTH && ![string isEqualToString:@""]) {
regFieldOne.text = [regFieldOne.text substringToIndex:MAXLENGTH];
return NO;
}
return YES;
}
..........