UI类 - UIActionSheet的使用

标签:
uiactionsheetit |
分类: Mac/IOS那些事 |
补充 :Button背景图片的平铺代码如下:
_doSomethingButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
_doSomethingButton.frame = CGRectMake(30, 280, 260, 30);
_doSomethingButton.backgroundColor =[UIColor clearColor];
//平铺图片
UIImage
*buttonImgNormal = [UIImage imageNamed:@"whiteButton"];
UIImage
*strectchableImgNormal = [buttonImgNormal
stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[_doSomethingButton setBackgroundImage:strectchableImgNormal
forState:UIControlStateNormal];
UIImage
*buttonImgPress = [UIImage imageNamed:@"blueButton"];
UIImage
*strectchableImgPress=[buttonImgPress stretc
hableImageWithLeftCapWidth:12 topCapHeight:0];
[_doSomethingButton setBackgroundImage:strectchableImgPress
forState:UIControlStateHighlighted];
[self.view
addSubview:_doSomethingButton];
[_doSomethingButton addTarget:self
action:@selector(buttonPressed:)
forControlEvents:UIControlEventTouchUpInside];
[_doSomethingButton
setTitle:@"dosomthingbtn"forState:UIControlStateNormal];
在这个addTarget的基础上做一个uiActionsheet
-(void)buttonPressed:(id)sender{
UIActionSheet *actionSheet = [[UIActionSheet
alloc]initWithTitle:@"what do you want for?"
delegate:self
cancelButtonTitle:@"no cancelTitle"
destructiveButtonTitle:@"no destructiontitle"
otherButtonTitles:@"other01",@"other02", nil];
[actionSheet
showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex{
if
(buttonIndex == 0) {
UIAlertView *alertYes = [[UIAlertView
alloc]initWithTitle:@"alertYes"
message:@"button0Yes"
delegate:self
_doSomethingButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
hableImageWithLeftCapWid
在这个addTarget的基础上做一个uiActionsheet
-(void)buttonPressed:(id)sender{
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonInde