id)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage方法用来设置FWEffectBarItem的被选中和未选中时的图片
title属性用来设置FWEffectBarItem的文字。
二、UISlider的使用
UIView *subview = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT - 115 - 40, WIDTH, 40)];
subview.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
[self.view addSubview:subview];
self.slider = [[FWSlider alloc] initWithFrame:CGRectZero];
self.slider.minimumValue = -100;
self.slider.maximumValue = 100;
self.slider.value = 0;
self.slider.frame = CGRectMake(WIDTH / 2 - 100, 10, 200, 20);
[self.slider addTarget:self action:@selector(updateva lue:) forControlEvents:UIControlEventTouchUpInside];
[self.slider addTarget:self action:@selector(updateTipView:) forControlEvents:UIControlEventValueChanged];
[self.slider setThumbImage:[UIImage imageNamed:@"icon_slider_thumb"] forState:UIControlStateNormal];
[subview addSubview:self.slider];
setThumbImage用来设置滑块,该slider没有完全实现,当我们滑动的时候,没有显示当前值,有待改善
四、FWBeautyProcessType枚举的定义
typedef NS_ENUM(NSInteger, FWBeautyProcessType)
{
//智能优化
FWBeautyProcessTypeAutoBeauty,
//编辑
FWBeautyProcessTypeEdit,
//增强
FWBeautyProcessTypeColorList,
//特效
FWBeautyProcessTypeFilter,
//边框
FWBeautyProcessTypeBolder,
//魔幻笔
FWBeautyProcessTypeMagicPen,
//马赛克
FWBeautyProcessTypeMosaic,
//文字
FWBeautyProcessTypeText,
//背景虚化
FWBeautyProcessTypeBlur
};
该枚举定义了【美化图片】下的所有功能模块,用于识别到底是哪种模块,不同模块相应的界面是不同的,请看下面代码
- (void)setupImageView
{
if (self.type == FWBeautyProcessTypeAutoBeauty || self.type == FWBeautyProcessTypeColorList || self.type == FWBeautyProcessTypeEdit)
{
//105 = 设备高 - 关闭按钮高度 - 3段间距:30 - bar高度:55 - 的结果
self.imageView.frame = CGRectMake(0, 0, WIDTH, HEIGHT - 115);
}
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:self.imageView];
}
//配置单选项卡
- (void)setupBar
{
self.styleBar = [[FWEffectBar alloc] init];
NSDictionary *autoDict = nil;
if (self.type == FWBeautyProcessTypeAutoBeauty || self.type == FWBeautyProcessTypeColorList)
{
self.styleBar.frame = CGRectMake(0,HEIGHT - 105, WIDTH, 55);
if (self.type == FWBeautyProcessTypeAutoBeauty )
autoDict = [[FWCommonTools getPlistDictionaryForButton] objectForKey:@"AutoBeauty"];
else
autoDict = [[FWCommonTools getPlistDictionaryForButton] objectForKey:@"ColorValue"];
}
else if (self.type == FWBeautyProcessTypeEdit)
{
self.styleBar.frame = CGRectMake(100, HEIGHT - 55, 160, 55);
autoDict = [[FWCommonTools getPlistDictionaryForButton] objectForKey:@"Edit"];
}
NSArray *normalImageArr = [autoDict objectForKey:@"normalImages"];
NSArray *hightlightedImageArr = [autoDict objectForKey:@"HighlightedImages"];
NSArray *textArr = [autoDict objectForKey:@"Texts"];
NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:0];
for (int i = 0; i < [textArr count]; i++)
{
FWEffectBarItem *item = [[FWEffectBarItem alloc] initWithFrame:CGRectZero];
[item setFinishedSelectedImage:[UIImage imageNamed:[hightlightedImageArr objectAtIndex:i]] withFinishedUnselected