设为首页 加入收藏

TOP

美图秀秀美化图片之【增强】模块界面与功能设计(一)
2017-10-12 12:09:18 】 浏览:1076
Tags:美图 美化 图片 增强 模块 界面 功能 设计

  本文从【增强】模块入手介绍一下界面设计和功能实现。所有功能都已实现,部分功能有待改善,我会在以后时间中步步改善。目前效果也很棒。有兴趣的可以在文章最后提供的下载链接中下载并运行。模拟器最好使用iphone6模拟器【增强】功能包含如下功能

  1.亮度

  2.对比度

  3.色温

  4.饱和度

  5.高光

  6.暗部

  7.智能补光

涉及开发技巧

  效果bar的实现

  UISlider的使用

  GPUImage的使用

 

  一、自定义bar

  点击一个效果按钮时,该按钮变为高亮状态,而前面的按钮自动恢复到正常状态

  代码实现

#import <UIKit/UIKit.h>


@class FWEffectBar, FWEffectBarItem;

@protocol FWEffectBarDelegate <NSObject>
- (void)effectBar:(FWEffectBar *)bar didSelectItemAtIndex:(NSInteger)index;

@end

@interface FWEffectBar : UIScrollView

@property (nonatomic, assign) id<FWEffectBarDelegate> delegate;
@property (nonatomic, copy) NSArray *items;
@property (nonatomic, weak) FWEffectBarItem *selectedItem;
@property UIEdgeInsets contentEdgeInsets;

/**
 * Sets the height of tab bar.
 */
- (void)setHeight:(CGFloat)height;

/**
 * Returns the minimum height of tab bar's items.
 */
- (CGFloat)minimumContentHeight;

@end
FWEffectBar.h
//
//  FWEffectBar.m
//  FWMeituApp
//
//  Created by ForrestWoo on 15-9-23.
//  Copyright (c) 2015年 ForrestWoo co,.ltd. All rights reserved.
//

#import "FWEffectBar.h"
#import "FWEffectBarItem.h"

@interface FWEffectBar ()

@property (nonatomic) CGFloat itemWidth;

@end

@implementation FWEffectBar

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
    }
    return self;
}

- (id)init {
    return [self initWithFrame:CGRectZero];
}

- (void)layoutSubviews {
    CGSize frameSize = self.frame.size;
    CGFloat minimumContentHeight = [self minimumContentHeight];
    
    [self setItemWidth:roundf((frameSize.width - [self contentEdgeInsets].left -
                               [self contentEdgeInsets].right) / [[self items] count])];
    
    NSInteger index = 0;
    
    // Layout items
    
    for (FWEffectBarItem *item in [self items]) {
        CGFloat itemHeight = [item itemHeight];
        
        if (!itemHeight) {
            itemHeight = frameSize.height;
        }
        
        [item setFrame:CGRectMake(self.contentEdgeInsets.left + (index * self.itemWidth),
                                  roundf(frameSize.height - itemHeight) - self.contentEdgeInsets.top,
                                  self.itemWidth, itemHeight - self.contentEdgeInsets.bottom)];
        [item setNeedsDisplay];
        
        index++;
    }
}

#pragma mark - Configuration

- (void)setItemWidth:(CGFloat)itemWidth {
    if (itemWidth > 0) {
        _itemWidth = itemWidth;
    }
}

- (void)setItems:(NSArray *)items {
    for (FWEffectBarItem *item in _items) {
        [item removeFromSuperview];
    }
    
    _items = [items copy];
    for (FWEffectBarItem *item in _items) {
        [item addTarget:self action:@selector(tabBarItemWasSelected:) forControlEvents:UIControlEventTouchDown];
        [self addSubview:item];
    }
}

- (void)setHeight:(CGFloat)height {
    [self setFrame:CGRectMake(CGRectGetMinX(self.frame), CGRectGetMinY(self.frame),
                              CGRectGetWidth(self.frame), height)];
}

- (CGFloat)minimumContentHeight {
    CGFloat minimumTabBarContentHeight = CGRectGetHeight([self frame]);
    
    for (FWEffectBarItem *item in [self items]) {
        CGFloat itemHeight = [item itemHeight];
        if (itemHeight && (itemHeight < minimumTabBarContentHeight)) {
            minimumTabBarContentHeight = itemHeight;
        }
    }
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 1/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇自定义进度条 下一篇UIButton

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目