简体   繁体   中英

actionSheet in iphone application

I am new to iphone.Is it possible to keep 3 textfields, 3 labels and 2 uibuttons in an actionsheet or alertview. Kindly give information.

Thanks in advance.

You can try this as:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"\n\n\n\n\n\n\n\n\n\n" message:@"" delegate:self cancelButtonTitle:@"Cancel"  otherButtonTitles:@"OK", nil];

UITextField *textfield1 = [[UITextField alloc] init];
textfield1.frame = CGRectMake(10.0, 30.0,260.0, 15.0);//set your frame as you required
textfield1.text=@"";
[textfield1 setBackgroundColor:[UIColor whiteColor]];
[alert addSubview:textfield1];
[textfield2 release];

UITextField *textfield2 = [[UITextField alloc] init];
textfield2.frame = CGRectMake(10.0, 48.0,260.0, 15.0);//set your frame as you required
textfield2.text=@"";
[textfield2 setBackgroundColor:[UIColor whiteColor]];
[alert addSubview:textfield2];
[textfield2 release];

UITextField *textfield3 = [[UITextField alloc] init];
textfield3.frame = CGRectMake(10.0, 65.0,260.0, 155.0);//set your frame as you required
textfield3.text=@"";
[textfield3 setBackgroundColor:[UIColor whiteColor]];
[alert addSubview:textfield3];
[textfield3 release];

UIView *tempView = [[UIView alloc]initWithFrame:CGRectMake(10.0, 80.0, 260.0, 100.0)];//set your frame as you required
tempView.backgroundColor = [UIColor clearColor];
[alert addSubview:tempView];

UILabel *label1 = [[UILabel alloc]init];
label1.frame = CGRectMake(0, 5, 50, 15);//set your label frame here
label1.text = @"Enter text";
[tempView addSubView:label1];
[label1 release];

UILabel *label2 = [[UILabel alloc]init];
label2.frame = CGRectMake(0, 25, 50, 15);//set your label frame here
label2.text = @"Enter text";
[tempView addSubView:label2];
[label2 release];

UILabel *label3 = [[UILabel alloc]init];
label3.frame = CGRectMake(0, 45, 50, 15);//set your label frame here
label3.text = @"Enter text";
[tempView addSubView:label3];
[label3 release];

UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.frame = //set your button frame here
[tempView addSubview:button1];

UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
button1.frame = //set your button frame here
[tempView addSubview:button2];

[tempView release];
[alert show];
[alert release];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM