//还没有尝试过,先保存在这
http://www.zpluz.com/forum.php?mod=viewthread&tid=2010
UIActionSheet *sheet=[[UIActionSheet alloc] initWithTitle:@"请登陆会员中心" delegate:self cancelButtonTitle:@"返回" destructiveButtonTitle:@"登录" otherButtonTitles:nil];
[sheet showInView:[UIApplication sharedApplication].keyWindow];
UILabel *title = [[sheet subviews] objectAtIndex:0];
title.font = [UIFont boldSystemFontOfSize:18];
[title setTextColor:[UIColor blackColor]];
[title setShadowOffset:CGSizeMake(2, 2)];
[title setShadowColor:[UIColor whiteColor]];
- UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Dynamic UIActionSheet" delegate:self
- cancelButtonTitle:nil
- destructiveButtonTitle:nil
- otherButtonTitles:nil];
- // 逐个添加按钮(比如可以是数组循环)
- [sheet addButtonWithTitle:@"Item A"];
- [sheet addButtonWithTitle:@"Item B"];
- [sheet addButtonWithTitle:@"Item C"];
- // 同时添加一个取消按钮
- [sheet addButtonWithTitle:@"Cancel"];
- // 将取消按钮的index设置成我们刚添加的那个按钮,这样在delegate中就可以知道是那个按钮
- sheet.cancelButtonIndex = sheet.numberOfButtons-1;
- [sheet showFromRect:view.bounds inView:view animated:YES];