一,效果图。

二,代码。

RootViewController.h

#import <UIKit/UIKit.h>

@interface RootViewController : UIViewController
<UIActionSheetDelegate>

@end

 

RootViewController.m

复制代码
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"手机找回密码", nil];
    [actionSheet showInView:self.view];

}
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    switch (buttonIndex) {
        case 0:
        {
            NSLog(@"--0--");
        }
            break;
        case 1:
        {
             NSLog(@"--1--");
        }
            break;
        default:
            break;
    }
}
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
    for (UIView *subViwe in actionSheet.subviews) {
        if ([subViwe isKindOfClass:[UIButton class]]) {
            UIButton *button = (UIButton*)subViwe;
            button.titleLabel.font=[UIFont systemFontOfSize:15];
            [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
            
        }
    }
}
复制代码
内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!