iOS开发用Tableview实现能改变字体颜色的高仿系统的ActionSheet

由于项目设计ActionSheet的颜色是橘色,而系统自带的 UIActionSheet 或 UIAlertController 都是只有蓝色或红色,在ios8之后,重写willPresentActionSheet方法时actionSheet.subviews时里没有东西,所以只能自己自定义一个UIView


1. JoopicActionSheet.h

//
//  JoopicActionSheet.h
//  joopic
//
//  Created by jianxiong li on 16/1/14.
//  Copyright © 2016年 joobot. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol JoopicActionSheetDelegate <NSObject>

-(void)didSelectIndex : (NSInteger) index;

@end

@interface JoopicActionSheet : UIView

@property (nonatomic , strong) id<JoopicActionSheetDelegate> delegate;

-(id)initWithList : (NSArray *)list title : (NSString *) title;

-(void) showInView : (UIViewController *)controller;

@end

2.JoopicActionSheet.m

//
//  JoopicActionSheet.m
//  joopic
//
//  Created by jianxiong li on 16/1/14.
//  Copyright © 2016年 joobot. All rights reserved.
//

#import "JoopicActionSheet.h"

#define RGBCOLOR(r, g, b)       [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define RGBACOLOR(r, g, b, a)   [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
//获取设备的物理高度
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
//获取设备的物理宽度
#define ScreenWidth [UIScreen mainScreen].bounds.size.width

#define JoopicActionSheetItemHeight 57

@interface JoopicActionSheet ()<UITableViewDataSource , UITableViewDelegate , UIGestureRecognizerDelegate>

@property (nonatomic , strong) UITableView *tableview;
@property (nonatomic , strong) NSArray *listData;
@property (nonatomic , strong) NSString * title;
@property (nonatomic ,
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值