मेरे कोड बनाने:inputAccessoryView को पाठ क्षेत्र जोड़ने कैसे करें और TextView पहले प्रत्युत्तर
- (void)viewDidLoad {
[super viewDidLoad];
CGRect rectFake = CGRectZero;
UITextField *fakeField = [[UITextField alloc] initWithFrame:rectFake];
[self.view addSubview:fakeField];
UIView *av = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 39.0)];
av.backgroundColor = [UIColor darkGrayColor];
CGRect rect = CGRectMake(200.0, 4.0, 400.0, 31.0);
UITextField *textField = [[UITextField alloc] initWithFrame:rect];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.font = [UIFont systemFontOfSize:24.0];
textField.delegate = self;
[av addSubview:textField];
fakeField.inputAccessoryView = av;
[fakeField becomeFirstResponder];
}
मैंने कोशिश की अंत में
[textField becomeFirstResponder]
जोड़ने के लिए है, लेकिन यह कोई काम करता है।
एक और समस्या जो ENTER दबाए जाने पर कीबोर्ड को छुपाने के लिए विधि का प्रतिनिधित्व करती है, वह भी काम नहीं करती है।
- (BOOL) textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
इस UIView कोशिश * av = [[UIView alloc] initWithFrame: CGRectMake (0.0, 0.0, 320.0, 3 9 .0.0]]; –
क्षमा करें मैंने यह उल्लेख नहीं किया कि यह आईपैड के लिए है और यह दृश्य कुंजीपटल के साथ फैला है, इसलिए चौड़ाई समझ में नहीं आती है। – Michael