设为首页 加入收藏

TOP

美图秀秀美化图片之【增强】模块界面与功能设计(二)
2017-10-12 12:09:18 】 浏览:1083
Tags:美图 美化 图片 增强 模块 界面 功能 设计
return minimumTabBarContentHeight; } #pragma mark - Item selection - (void)tabBarItemWasSelected:(id)sender { [self setSelectedItem:sender]; if ([[self delegate] respondsToSelector:@selector(effectBar:didSelectItemAtIndex:)]) { NSInteger index = [self.items indexOfObject:self.selectedItem]; [[self delegate] effectBar:self didSelectItemAtIndex:index]; } } - (void)setSelectedItem:(FWEffectBarItem *)selectedItem { if (selectedItem == _selectedItem) { return; } [_selectedItem setSelected:NO]; _selectedItem = selectedItem; [_selectedItem setSelected:YES]; } @end FWEffectBar.m

  我定义了一个FWEffectBarDelegate的协议,当点击bar中按钮时,将触发- (void)effectBar:(FWEffectBar *)bar didSelectItemAtIndex:(NSInteger)index,我们可以在FWEffectBar的代理中实现当我们点击按钮时要做的事情。

items属性是该bar所包含的所有子项(FWEffectBarItem)。

 

 FWEffectBarItem是包含在bar中的按钮,图像文字竖着排列,当点击它时将呈现高亮状态。

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

#import <UIKit/UIKit.h>

@interface FWEffectBarItem : UIControl

/**
 * itemHeight is an optional property. When set it is used instead of tabBar's height.
 */
@property CGFloat itemHeight;

#pragma mark - Title configuration

/**
 * The title displayed by the tab bar item.
 */
@property (nonatomic, copy) NSString *title;

/**
 * The offset for the rectangle around the tab bar item's title.
 */
@property (nonatomic) UIOffset titlePositionAdjustment;

/**
 * For title's text attributes see
 * https://developer.apple.com/library/ios/documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html
 */

/**
 * The title attributes dictionary used for tab bar item's unselected state.
 */
@property (copy) NSDictionary *unselectedTitleAttributes;

/**
 * The title attributes dictionary used for tab bar item's selected state.
 */
@property (copy) NSDictionary *selectedTitleAttributes;

#pragma mark - Image configuration

/**
 * The offset for the rectangle around the tab bar item's image.
 */
@property (nonatomic) UIOffset imagePositionAdjustment;

/**
 * The image used for tab bar item's selected state.
 */
- (UIImage *)finishedSelectedImage;

/**
 * The image used for tab bar item's unselected state.
 */
- (UIImage *)finishedUnselectedImage;

/**
 * Sets the tab bar item's selected and unselected images.
 */
- (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage;

#pragma mark - Background configuration

/**
 * The background image used for tab bar item's selected state.
 */
- (UIImage *)backgroundSelectedImage;

/**
 * The background image used for tab bar item's unselected state.
 */
- (UIImage *)backgroundUnselectedImage;

/**
 * Sets the tab bar item's selected and unselected background images.
 */
- (void)setBackgroundSelectedImage:(UIImage *)selectedImage withUnselectedImage:(UIImage *)unselectedImage;

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

#import "FWEffectBarItem.h"

@interface FWEffectBarItem ()
{
    NS
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇自定义进度条 下一篇UIButton

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目