How can I show UIStepper
in UIAlertView
? Also suggest me any other alternative to show UIStepper
in pop-up.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
A better way of inserting views in UIAlertView
would be to add them as a subview
Try the following
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"\n\n" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
UIStepper* stepper = [[UIStepper alloc] init];
stepper.frame = CGRectMake(12.0, 5.0, 100, 10);
[alert addSubview:stepper];
[alert show];
回答2:
Try this.. Hope it will help you
UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(120, 20, 0, 0)];
UIAlertView *alert =[[UIAlertView alloc]init];// you can set your frame according to ypur requirment
[alert addSubview:stepper];
[alert show];