मेरे पास UITableViewCell में UITextField है। किसी कारण से स्पष्ट बटन टेक्स्ट फ़ील्ड के पाठ पर संरेखित नहीं है।UITextField में टेक्स्ट के साथ स्पष्ट बटन क्यों गठबंधन नहीं किया गया है?
cell.selectionStyle = UITableViewCellSelectionStyleNone;
usernameField = [[UITextField alloc] initWithFrame:CGRectMake(22, 10, cell.contentView.frame.size.width, cell.contentView.frame.size.height)];
usernameField.adjustsFontSizeToFitWidth = YES;
usernameField.placeholder = @"Username";
usernameField.backgroundColor = [UIColor clearColor];
usernameField.keyboardType = UIKeyboardTypeDefault;
usernameField.autocapitalizationType = UITextAutocorrectionTypeNo;
usernameField.autocorrectionType = UITextAutocorrectionTypeNo;
usernameField.returnKeyType = UIReturnKeyNext;
usernameField.delegate = self;
usernameField.clearButtonMode = UITextFieldViewModeAlways;
[usernameField setEnabled:YES];
[cell addSubview:usernameField];
[usernameField becomeFirstResponder];
[usernameField release];
यहाँ चित्र समस्या प्रदर्शित करने के लिए है और:: यहाँ मेरी textfield कोड है
संपादित करें: मैं भी - (CGRect)clearButtonRectForBounds:(CGRect)bounds
साथ की कोशिश की और अभी भी कुछ नहीं
आप मदद करने के लिए बहुत-बहुत धन्यवाद, लेकिन अब पाठ और स्पष्ट बटन सेल की तह तक गठबंधन कर रहे हैं। मैं यह कोड वास्तव में पाठ को संरेखित करता हूं, स्पष्ट बटन नहीं। मैं सेल के केंद्र में स्पष्ट बटन को संरेखित करना चाहता हूं कोई सुझाव? –
यह काम किया! मैंने स्पष्ट बटन –
धन्यवाद के लिए फिट करने के लिए सीजीआरएक्ट विशेषताओं को बदल दिया है। स्पष्ट करने के लिए, मैंने ऊर्ध्वाधर ऑफसेट को सही करने के लिए सेल और टेक्स्ट फ़ील्ड की ऊंचाई को ध्यान में रखा। CGRect newFrame = albumTitleTextField.frame; newFrame.origin.y = (cell.bounds.size.height - newFrame.size.height)/2.0; [एल्बम टिटलेटेक्स्टफिल्ड सेटफ्रेम: नया फ्रेम]; –