chore: import upstream snapshot with attribution
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_friend@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_friend@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 519 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_audiocall@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 436 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_bottle@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 508 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_facefriend@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 526 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_favourite@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 537 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_game@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 522 B |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_newmessage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_newmessage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 390 B |
|
After Width: | Height: | Size: 557 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_groupmessage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 648 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_moment@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 494 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_myablum@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 312 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_mycard@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 144 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_myqrcode@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 205 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_nearby@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 504 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_photo@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 464 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_radar@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 651 B |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_scan@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_scan@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 687 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_shake@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 817 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_sticker@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 541 B |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_voip@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 240 B |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "receipt_payment_icon@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "receipt_payment_icon@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 808 B |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_wechatout@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "contacts_add_wechatout@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 378 B |
|
After Width: | Height: | Size: 561 B |
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// TLAddMenuCell.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TLAddMenuItem.h"
|
||||
|
||||
@interface TLAddMenuCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, strong) TLAddMenuItem *item;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// TLAddMenuCell.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAddMenuCell.h"
|
||||
|
||||
@interface TLAddMenuCell()
|
||||
|
||||
@property (nonatomic, strong) UIImageView *iconView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLAddMenuCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self setBackgroundColor:[UIColor colorBlackForAddMenu]];
|
||||
UIView *selectedView = [[UIView alloc] init];
|
||||
[selectedView setBackgroundColor:[UIColor colorBlackForAddMenuHL]];
|
||||
[self setSelectedBackgroundView:selectedView];
|
||||
|
||||
[self p_initUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
self.addSeparator(ZZSeparatorPositionBottom).beginAt(15).endAt(-15).color([UIColor colorGrayLine]);
|
||||
}
|
||||
|
||||
- (void)setItem:(TLAddMenuItem *)item
|
||||
{
|
||||
_item = item;
|
||||
[self.iconView setImage:[UIImage imageNamed:item.iconPath]];
|
||||
[self.titleLabel setText:item.title];
|
||||
}
|
||||
|
||||
#pragma mark - Private Methods
|
||||
- (void)p_initUI
|
||||
{
|
||||
self.iconView = self.contentView.addImageView(1)
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).mas_offset(15.0f);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.height.and.width.mas_equalTo(32);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.titleLabel = self.contentView.addLabel(2)
|
||||
.font([UIFont systemFontOfSize:16.0f])
|
||||
.textColor([UIColor whiteColor])
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.iconView.mas_right).mas_offset(10.0f);
|
||||
make.centerY.mas_equalTo(self.iconView);
|
||||
})
|
||||
.view;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// TLAddMenuItem.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, TLAddMneuType) {
|
||||
TLAddMneuTypeGroupChat = 0,
|
||||
TLAddMneuTypeAddFriend,
|
||||
TLAddMneuTypeScan,
|
||||
TLAddMneuTypeWallet,
|
||||
};
|
||||
|
||||
@interface TLAddMenuItem : NSObject
|
||||
|
||||
@property (nonatomic, assign) TLAddMneuType type;
|
||||
|
||||
@property (nonatomic, strong) NSString *title;
|
||||
|
||||
@property (nonatomic, strong) NSString *iconPath;
|
||||
|
||||
@property (nonatomic, strong) NSString *className;
|
||||
|
||||
+ (TLAddMenuItem *)createWithType:(TLAddMneuType)type title:(NSString *)title iconPath:(NSString *)iconPath className:(NSString *)className;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// TLAddMenuItem.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAddMenuItem.h"
|
||||
|
||||
@implementation TLAddMenuItem
|
||||
|
||||
+ (TLAddMenuItem *)createWithType:(TLAddMneuType)type title:(NSString *)title iconPath:(NSString *)iconPath className:(NSString *)className
|
||||
{
|
||||
TLAddMenuItem *item = [[TLAddMenuItem alloc] init];
|
||||
item.type = type;
|
||||
item.title = title;
|
||||
item.iconPath = iconPath;
|
||||
item.className = className;
|
||||
return item;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// TLAddMenuView.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TLAddMenuItem.h"
|
||||
|
||||
@class TLAddMenuView;
|
||||
@protocol TLAddMenuViewDelegate <NSObject>
|
||||
|
||||
- (void)addMenuView:(TLAddMenuView *)addMenuView didSelectedItem:(TLAddMenuItem *)item;
|
||||
|
||||
@end
|
||||
|
||||
@interface TLAddMenuView : UIView
|
||||
|
||||
@property (nonatomic, assign) id<TLAddMenuViewDelegate>delegate;
|
||||
@property (nonatomic, copy) void (^itemSelectedAction)(TLAddMenuView *addMenuView, TLAddMenuItem *item);
|
||||
|
||||
/**
|
||||
* 显示AddMenu
|
||||
*
|
||||
* @param view 父View
|
||||
*/
|
||||
- (void)showInView:(UIView *)view;
|
||||
|
||||
/**
|
||||
* 是否正在显示
|
||||
*/
|
||||
- (BOOL)isShow;
|
||||
|
||||
/**
|
||||
* 隐藏
|
||||
*/
|
||||
- (void)dismiss;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// TLAddMenuView.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/3/11.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAddMenuView.h"
|
||||
#import "TLAddMenuCell.h"
|
||||
#import "TLAppConfig.h"
|
||||
|
||||
#define WIDTH_TABLEVIEW 140.0f
|
||||
#define HEIGHT_TABLEVIEW_CELL 45.0f
|
||||
|
||||
@interface TLAddMenuView () <UITableViewDataSource, UITableViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) UITableView *tableView;
|
||||
|
||||
@property (nonatomic, strong) NSArray *data;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLAddMenuView
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
[self setBackgroundColor:[UIColor clearColor]];
|
||||
[self addSubview:self.tableView];
|
||||
|
||||
UIPanGestureRecognizer *panGR = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)];
|
||||
[self addGestureRecognizer:panGR];
|
||||
|
||||
[self.tableView registerClass:[TLAddMenuCell class] forCellReuseIdentifier:@"TLAddMenuCell"];
|
||||
self.data = [TLAppConfig sharedConfig].addMenuItems;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)showInView:(UIView *)view
|
||||
{
|
||||
[view addSubview:self];
|
||||
[self setNeedsDisplay];
|
||||
[self setFrame:view.bounds];
|
||||
|
||||
CGRect rect = CGRectMake(view.width - WIDTH_TABLEVIEW - 5, NAVBAR_HEIGHT + STATUSBAR_HEIGHT + 10, WIDTH_TABLEVIEW, self.data.count * HEIGHT_TABLEVIEW_CELL);
|
||||
[self.tableView setFrame:rect];
|
||||
}
|
||||
|
||||
- (BOOL)isShow
|
||||
{
|
||||
return self.superview != nil;
|
||||
}
|
||||
|
||||
- (void)dismiss
|
||||
{
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
[self setAlpha:0.0f];
|
||||
} completion:^(BOOL finished) {
|
||||
if (finished) {
|
||||
[self removeFromSuperview];
|
||||
[self setAlpha:1.0];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||
{
|
||||
[self dismiss];
|
||||
}
|
||||
|
||||
#pragma mark - # Delegate
|
||||
//MARK: UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return self.data.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
TLAddMenuItem *item = [self.data objectAtIndex:indexPath.row];
|
||||
TLAddMenuCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TLAddMenuCell"];
|
||||
[cell setItem:item];
|
||||
return cell;
|
||||
}
|
||||
|
||||
//MARK: UITableViewDelegate
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
TLAddMenuItem *item = [self.data objectAtIndex:indexPath.row];
|
||||
if (self.itemSelectedAction) {
|
||||
self.itemSelectedAction(self, item);
|
||||
}
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(addMenuView:didSelectedItem:)]) {
|
||||
[_delegate addMenuView:self didSelectedItem:item];
|
||||
}
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:NO];
|
||||
[self dismiss];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return HEIGHT_TABLEVIEW_CELL;
|
||||
}
|
||||
|
||||
#pragma mark - # Private Methods
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
CGFloat startX = self.width - 27;
|
||||
CGFloat startY = STATUSBAR_HEIGHT + NAVBAR_HEIGHT + 3;
|
||||
CGFloat endY = STATUSBAR_HEIGHT + NAVBAR_HEIGHT + 10;
|
||||
CGFloat width = 6;
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextMoveToPoint(context, startX, startY);
|
||||
CGContextAddLineToPoint(context, startX + width, endY);
|
||||
CGContextAddLineToPoint(context, startX - width, endY);
|
||||
CGContextClosePath(context);
|
||||
[[UIColor colorBlackForAddMenu] setFill];
|
||||
[[UIColor colorBlackForAddMenu] setStroke];
|
||||
CGContextDrawPath(context, kCGPathFillStroke);
|
||||
}
|
||||
|
||||
#pragma mark - # Getters
|
||||
- (UITableView *)tableView
|
||||
{
|
||||
if (_tableView == nil) {
|
||||
_tableView = [[UITableView alloc] init];
|
||||
[_tableView setScrollEnabled:NO];
|
||||
[_tableView setDelegate:self];
|
||||
[_tableView setDataSource:self];
|
||||
[_tableView setBackgroundColor:[UIColor colorBlackForAddMenu]];
|
||||
[_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
|
||||
[_tableView.layer setMasksToBounds:YES];
|
||||
[_tableView.layer setCornerRadius:3.0f];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
@end
|
||||