The code below works on iOS6 (and before) but the UITextField does not display in iOS7...any ideas on how to get a UITextField to display in an UIAlterView in iOS7?
Just working as charm
Two UITextField in UIAlertView for all version of iOS
-(IBAction) showAlertView {
UIAlertView *alert;
UITextField *callForwardNumber;
UItextField *callForwardCondition;
alert = [[UIAlertView alloc] initWithTitle:@"Enter Phone Number & Rule"
message:@""
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Save", nil];
//alert.transform = CGAffineTransformMakeTranslation(0, 110);
callForwardNumber = [[UITextField alloc] init];
callForwardNumber.keyboardType = UIKeyboardTypeNumberPad;
callForwardNumber.text = [R.prefs objectForKey:@"fwd_number"];
callForwardNumber.borderStyle = UITextBorderStyleRoundedRect;
callForwardNumber.delegate = self;
callForwardNumber.tag = 1;
callForwardCondition = [[UITextField alloc] init];
callForwardCondition.text = callCondition;
callForwardCondition.borderStyle = UITextBorderStyleRoundedRect;
callForwardCondition.delegate = self;
callForwardCondition.tag = 2;
[callForwardCondition setKeyboardType:UIKeyboardTypeNumberPad];
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
UIView* customAccessory =
[[UIView alloc] initWithFrame:CGRectMake(0, 0, 250, 55)];
callForwardNumber.frame = CGRectMake(0, 0, 245.0, 25.0);
callForwardCondition.frame = CGRectMake(0, 30.0, 245.0, 25.0);
[customAccessory addSubview:callForwardNumber];
[customAccessory addSubview:callForwardCondition];
[alert setValue:customAccessory forKey:@"accessoryView"];
[alert show];
} else {
alert.message = @"\n\n\n";
[alert show];
callForwardNumber.frame = CGRectMake(20.0, 45.0, 245.0, 25.0);
callForwardCondition.frame = CGRectMake(20.0, 75.0, 245.0, 25.0);
[alert addSubview:callForwardNumber];
[alert addSubview:callForwardCondition];
}
}