創建了UITextField,具體代碼:
UItextField *mobileNumberField = [[UITextField alloc] initWithFrame:CGRectMake(10, 195, 300, 41)];
mobileNumberField.delegate = self;
mobileNumberField.borderStyle = UITextBorderStyleRoundedRect;
[mobileNumberField.layer setCornerRadius:14.0f];
mobileNumberField.placeholder = @"Mobile Number";
[self.paymentsHomeView addSubview:mobileNumberField];
但是顯示的效果是這樣:
不知道為什麼框會斷開。請高手幫忙改成這樣的效果:
很簡單,刪除這行:
mobileNumberField.borderStyle = UITextBorderStyleRoundedRect;
然後再加上這些:
[mobileNumberField setBackgroundColor:[UIColor whiteColor]];
[mobileNumberField.layer setBorderColor:[UIColor grayColor].CGColor];
[mobileNumberField.layer setBorderWidth:1.0];