Commit aec37142 authored by Sandy's avatar Sandy

销售录入模块功能完成

parent 448e593b
This diff is collapsed.
#import "SaleInputState.h"
@interface HMSaleInputDetail_contract : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
......@@ -79,11 +79,14 @@
@property (nonatomic, strong) NSString <Optional> * receiver;
@property (nonatomic, strong) NSString <Optional> * billNumber;
@property (nonatomic, strong) NSString <Optional> * state;
@property (nonatomic, assign) BOOL balance;
@property (nonatomic, strong) HMSaleInputDetail_tenant <Optional> * tenant;
@property (nonatomic, strong) NSMutableArray <HMSaleInputDetail_payments,Optional> * payments;
@property (nonatomic, strong) SaleInputState <Ignore> *z_state;
@end
......@@ -2,6 +2,14 @@
@implementation HMSaleInputDetail
- (SaleInputState<Ignore> *)z_state {
if (!_z_state) {
_z_state = [SaleInputState new];
_z_state.code = self.state;
}
return _z_state;
}
@end
......
@protocol SaleInputHistory_details
@end
@interface SaleInputHistory_details_payment : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
@property (nonatomic, strong) NSString <Optional> * name;
@property (nonatomic, strong) NSString <Optional> * uuid;
@end
@interface SaleInputHistory_details : ZJBaseModel
@property (nonatomic, strong) NSNumber <Optional> * total;
@property (nonatomic, strong) SaleInputHistory_details_payment <Optional> * payment;
@end
@interface SaleInputHistory : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * date;
@property (nonatomic, strong) NSNumber <Optional> * total;
@property (nonatomic, strong) NSMutableArray <SaleInputHistory_details,Optional> * details;
@end
#import "SaleInputHistory.h"
@implementation SaleInputHistory
@end
@implementation SaleInputHistory_details
@end
@implementation SaleInputHistory_details_payment
@end
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,7 +7,7 @@
//
#import "SaleInputAddViewController.h"
#import "SaleInputHistoryViewController.h"
@interface SaleInputAddViewController ()<UITableViewDelegate, UITableViewDataSource>
@end
......@@ -16,6 +16,9 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 84, 0);
UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"历史查询" style:UIBarButtonItemStylePlain target:self action:@selector(actionGoHistory)];
self.navigationItem.rightBarButtonItem = rightBtn;
WS(weakSelf);
[self.viewModel httpAllPayments:^(BOOL isSuccess) {
......@@ -107,5 +110,14 @@
}];
}
/**
* 跳转查看历史界面
*/
- (void)actionGoHistory {
SaleInputHistoryViewController *historyVC = [SaleInputHistoryViewController viewControllerWithStoryBoardType:(STORYBOARD_TYPE_SALEINPUT)];
historyVC.contract = self.topView.contract;
[self.navigationController pushViewController:historyVC animated:YES];
}
ZJLazy(SaleInputViewModel, viewModel);
@end
......@@ -16,12 +16,29 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.viewModel.type = SaleInputTypeReadOnly;
self.viewModel.picVM.type = kPicCellTypeRead;
self.topView.right1.hidden = YES;
self.topView.right2.hidden = YES;
self.topView.userInteractionEnabled = NO;
self.totalView.textFieldBillCount.userInteractionEnabled = NO;
self.btnBottom.hidden = YES;
self.title = @"销售录入详情";
WS(weakSelf);
[self.viewModel httpDetailWithUuid:self.listModel.billNumber callBack:^(BOOL isSuccess) {
[weakSelf configUIWithDetail];
}];
}
- (void)configUIWithDetail {
self.topView.contract = self.viewModel.detail.contract;
self.totalView.textFieldBillCount.text = self.viewModel.detail.saleCount.stringValue;
[self.topView.btnStore setTitle:self.viewModel.detail.contract.name forState:UIControlStateNormal];
self.topView.textFieldDate.text = [self.viewModel.detail.saleDate substringToIndex:11];
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
//
// SaleInputHistoryViewController.h
// RealEstateManagement
//
// Created by Javen on 2016/10/12.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
#import "HMSaleInputDetail.h"
@interface SaleInputHistoryViewController : BaseViewController
@property (strong, nonatomic) HMSaleInputDetail_contract *contract;
@end
//
// SaleInputHistoryViewController.m
// RealEstateManagement
//
// Created by Javen on 2016/10/12.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "CalculateHelper.h"
#import "HistoryTopView.h"
#import "MMViewController.h"
#import "SaleInputHistoryViewController.h"
#import "SaleInputHistory.h"
@interface SaleInputHistoryViewController ()
@property (weak, nonatomic) IBOutlet HistoryTopView *topView;
@property (nonatomic, strong) MMViewController *sheetVC;
@property (nonatomic, strong) UIImageView *imageNoData;
@property (nonatomic, strong) NSMutableArray *arrData;
@end
@implementation SaleInputHistoryViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"历史查询";
WS(weakSelf);
[self.topView setBlockQuery:^{
[weakSelf httpHistoryData];
}];
[self updateUI];
[self configNoDataPic];
// Do any additional setup after loading the view.
}
- (void)viewDidLayoutSubviews
{
self.imageNoData.frame = CGRectMake(0, self.topView.bottom + 20, 150, 150);
self.imageNoData.centerX = self.view.centerX;
self.imageNoData.centerY = self.sheetVC.view.centerY + self.topView.bottom;
}
- (void)updateUI {
if (self.contract == nil) {
self.topView.labelShopName.text = @"请选择合同";
return;
}
self.topView.labelShopName.text = self.contract.name;
}
- (void)httpHistoryData
{
NSString *startDate = [NSString stringWithFormat:@"%@ 00:00:00", self.topView.startDate.text];
NSString *endDate = [NSString stringWithFormat:@"%@ 00:00:00", self.topView.endDate.text];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:self.contract.uuid, @"contract", [NSDictionary dictionaryWithObjectsAndKeys:startDate, @"beginDate", endDate, @"endDate", nil], @"dateRange", nil];
[MBProgressHUD j_loading];
WS(weakSelf);
[ZJHttpManager POST:@"hdmall/salesinput/getSalesTotal" parameters:params complete:^(id responseObject, NSError *error) {
[MBProgressHUD j_hideLoadingView];
if (kIsResponse) {
[weakSelf configDataArray:responseObject[@"data"]];
} else {
kFalseHttpTips;
}
}];
}
- (void)configNoDataPic
{
if (self.contract == nil) {
self.sheetVC.view.hidden = YES;
self.imageNoData.hidden = NO;
}
if (self.arrData.count > 0) {
self.sheetVC.view.hidden = NO;
self.imageNoData.hidden = YES;
} else {
self.sheetVC.view.hidden = YES;
self.imageNoData.hidden = NO;
}
}
/**
* 跳转选择商铺界面
*/
- (IBAction)actionChooseShop:(UIButton *)sender
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"选择合同" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
for (UserInfo_contracts *contract in AppGlobal.user.contracts) {
UIAlertAction *action = [UIAlertAction actionWithTitle:contract.name style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary];
self.topView.labelShopName.text = contract.name;
}];
[alert addAction:action];
}
UIAlertAction *action = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:action];
[self.navigationController presentViewController:alert animated:YES completion:nil];
}
- (void)configDataArray:(NSArray *)arr
{
NSMutableArray *arrData = [NSMutableArray array];
self.arrData = arrData;
for (NSDictionary *dict in arr) {
SaleInputHistory *model = [SaleInputHistory modelWithDic:dict];
[arrData addObject:model];
}
NSMutableArray *totalData = [NSMutableArray array];
//第一行的数据
NSMutableArray *data = [NSMutableArray array];
/**
* 支付方式
*/
NSMutableArray *payments = [NSMutableArray array];
[data addObject:@"日期"];
[data addObject:@"金额(元)"];
for (SaleInputHistory *model in arrData) {
for (NSInteger i = 0; i < model.details.count; i++) {
SaleInputHistory_details *payment = model.details[i];
if (![data containsObject:payment.payment.name]) {
[data addObject:payment.payment.name];
[payments addObject:payment.payment.name];
}
}
}
// [data addObject:@"附件"];
[totalData addObject:data];
//把所有支付金额分类归纳
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (SaleInputHistory *model in arrData) {
for (SaleInputHistory_details *payment in model.details) {
NSMutableArray *array = [dict objectForKey:payment.payment.name];
if (array) {
[array addObject:payment.total];
} else {
NSMutableArray *array = [NSMutableArray array];
[array addObject:payment.total];
[dict setObject:array forKey:payment.payment.name];
}
}
}
//中间的数据
for (NSInteger i = 0; i < arrData.count; i++) {
SaleInputHistory *historyModel = arrData[i];
NSMutableArray *arrCenter = [NSMutableArray array];
[arrCenter addObject:historyModel.date];
[arrCenter addObject:[NSString stringWithFormat:@"%.2f", historyModel.total.doubleValue]];
for (NSInteger j = 0; j < payments.count; j++) {
NSString *paymentName = payments[j];
BOOL isHas = NO;
for (SaleInputHistory_details *payment in historyModel.details) {
if ([paymentName isEqualToString:payment.payment.name]) {
[arrCenter addObject:[CalculateHelper getMoneyStringFrom:payment.total]];
isHas = YES;
}
}
if (!isHas) {
[arrCenter addObject:@"0.00"];
}
}
// [arrCenter addObject:@"查看附件"];
[totalData addObject:arrCenter];
}
//最后一行的数据
NSMutableArray *bottomRow = [NSMutableArray array];
[bottomRow addObject:@"总计"];
NSDecimalNumber *total = [NSDecimalNumber decimalNumberWithString:@"0"];
for (SaleInputHistory *model in arrData) {
total = [CalculateHelper add:total num2:model.total];
}
[bottomRow addObject:[CalculateHelper getMoneyStringFrom:total]];
for (NSInteger i = 0; i < payments.count; i++) {
NSString *paymentName = payments[i];
NSMutableArray *arrPaymentNumber = [dict objectForKey:paymentName];
NSDecimalNumber *number = [NSDecimalNumber decimalNumberWithString:@"0"];
for (NSNumber *obj in arrPaymentNumber) {
number = [CalculateHelper add:number num2:obj];
}
[bottomRow addObject:[CalculateHelper getMoneyStringFrom:number]];
}
// [bottomRow addObject:@"附件"];
NSInteger totalRowCount = totalData.count;
if (totalRowCount < 9) {
for (NSInteger i = totalRowCount; i < 9; i++) {
NSMutableArray *arr = [NSMutableArray array];
for (NSString *str in bottomRow) {
[arr addObject:@""];
}
[totalData addObject:arr];
}
}
[totalData addObject:bottomRow];
self.sheetVC.tableData = totalData;
[self.sheetVC reloadData];
[self configNoDataPic];
}
- (UIImageView *)imageNoData
{
if (!_imageNoData) {
_imageNoData = [[UIImageView alloc] init];
_imageNoData.center = self.view.center;
_imageNoData.contentMode = UIViewContentModeScaleAspectFit;
_imageNoData.image = [UIImage imageNamed:@"list_nodata"];
[self.view addSubview:_imageNoData];
}
return _imageNoData;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([segue.identifier isEqualToString:@"MMViewController"]) {
self.sheetVC = segue.destinationViewController;
}
}
/*
*/
@end
......@@ -24,6 +24,7 @@
// Do any additional setup after loading the view.
self.title = @"销售录入记录";
[self refresh];
self.tableView.rowHeight = 159;
self.btnAdd.hidden = !AppGlobal.permission.saleinput.newField;
}
......
//
// SaleInputState.h
// HDMall
//
// Created by Javen on 2017/8/4.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kSaleInputStateTypeEffect @"effect"
#define kSaleInputStateTypeIneffect @"ineffect"
@interface SaleInputState : NSObject
@property (strong, nonatomic) NSString *text;
@property (strong, nonatomic) NSString *code;
@property (strong, nonatomic) NSString *img;
/**
存放图片名状态名等信息
*/
@property (strong, nonatomic) NSDictionary *dicData;
//+ (SaleInputState *)stateWithText:(NSString *)text;
@end
//
// SaleInputState.m
// HDMall
//
// Created by Javen on 2017/8/4.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputState.h"
@implementation SaleInputState
- (instancetype)init {
self = [super init];
if (self) {
self.dicData = @{ kSaleInputStateTypeIneffect : @{@"text" : @"未生效",
@"img" : @"StateIneffect"},
kSaleInputStateTypeEffect : @{@"text" : @"已生效",
@"img" : @"StateEffect"} };
}
return self;
}
- (void)setCode:(NSString *)code {
_code = code;
self.text = [[self.dicData objectForKey:code] objectForKey:@"text"];
self.img = [[self.dicData objectForKey:code] objectForKey:@"img"];
}
@end
......@@ -36,16 +36,10 @@
}];
}
- (void)httpUpload:(void (^)(void))complete {
}
- (void)httpSubmit:(blockCallBack)callBack {
//赋值
if (self.request.contract == nil) {
[MBProgressHUD j_error:@"请选择合同" complete:nil];
return;
}
kCanNotBeNil(self.request.contract, @"请选择合同");
self.request.oper = AppGlobal.user.code;
self.request.store = [HMSaleInputDetail_store modelWithDic:AppGlobal.user.store.toDictionary];
// self.request.tenant = [HMSaleInputDetail_tenant modelWithDic:AppGlobal.user.tenant.toDictionary];
......@@ -93,8 +87,11 @@
[ZJHttpManager GET:url parameters:nil complete:^(id responseObject, NSError *error) {
if (kIsResponse) {
self.detail = [HMSaleInputDetail modelWithDic:responseObject[@"data"]];
self.arrPayments = self.detail.payments;
callBack(true);
}else{
callBack(false);
kFalseHttpTips;
}
}];
......
//
// HistoryTopView.h
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HistoryTopView : UIView
@property (weak, nonatomic) IBOutlet UIButton *buttonStartDate;
@property (weak, nonatomic) IBOutlet UIButton *buttonEndDate;
@property (weak, nonatomic) IBOutlet UITextField *startDate;
@property (weak, nonatomic) IBOutlet UITextField *endDate;
@property (weak, nonatomic) IBOutlet UILabel *labelShopName;
@property (weak, nonatomic) IBOutlet UIButton *buttonChooseShop;
@property (weak, nonatomic) IBOutlet UIButton *buttonQuery;
@property (weak, nonatomic) IBOutlet UIImageView *imgRight;
@property (nonatomic, copy) void (^blockQuery)(void);
- (void)startDateBecomeFistRespond;
- (void)endDateBecomeFistRespond;
@end
//
// HistoryTopView.m
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "HistoryTopView.h"
@interface HistoryTopView ()<UITextFieldDelegate>
@property (nonatomic, strong) UIDatePicker *startDatePicker;
@property (nonatomic, strong) UIDatePicker *endDatePicker;
@end
@implementation HistoryTopView
-(void)awakeFromNib {
[super awakeFromNib];
self.startDate.text = [[NSDate date] yearMonthDayString];
self.startDate.delegate = self;
self.startDate.tag = 1;
self.endDate.text = [[NSDate date] yearMonthDayString];
self.endDate.delegate = self;
self.endDate.tag = 2;
self.startDatePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, kWidth, 216)];
self.startDatePicker.datePickerMode = UIDatePickerModeDate;
self.startDatePicker.maximumDate = [NSDate date];
self.startDate.inputView = self.startDatePicker;
self.endDatePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, kWidth, 216)];
self.endDatePicker.datePickerMode = UIDatePickerModeDate;
self.endDatePicker.maximumDate = [NSDate date];
self.endDate.inputView = self.endDatePicker;
if (!AppGlobal.isMall) {
self.imgRight.hidden = YES;
self.buttonChooseShop.userInteractionEnabled = NO;
}
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
if (textField.tag == 1) {
textField.text = [self.startDatePicker.date yearMonthDayString];
}else{
textField.text = [self.endDatePicker.date yearMonthDayString];
}
}
- (IBAction)actionStart:(id)sender {
[self startDateBecomeFistRespond];
}
- (IBAction)actionEnd:(id)sender {
[self endDateBecomeFistRespond];
}
- (void)startDateBecomeFistRespond {
[self.startDate becomeFirstResponder];
}
- (void)endDateBecomeFistRespond {
[self.endDate becomeFirstResponder];
}
- (IBAction)queryAction:(id)sender {
HIDE_KEYBOARD;
NSLog(@"查询");
self.blockQuery();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
......@@ -20,7 +20,7 @@
self.labelTItle.text = self.model.contract.name;
self.labelBillCount.text = [NSString stringWithFormat:@"%ld",self.model.saleCount.integerValue];
self.labelTime.text = self.model.saleDate;
// self.imgState.image = [UIImage imageNamed:self.model.stateImageName];
self.imgState.image = [UIImage imageNamed:self.model.z_state.img];
self.labelBillNumber.text = self.model.billNumber;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ReadingStateEffect.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ReadingStateEffect@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ReadingStateEffect@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ReadingStateIneffect.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ReadingStateIneffect@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ReadingStateIneffect@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -61,4 +61,6 @@
+ (void)j_hideLoadingView;
+ (void)j_hideOnView:(UIView *)view;
+ (void)j_warningMessage:(NSString *)msg;
@end
......@@ -142,4 +142,51 @@ static CGFloat const delay = 1.2;
}
}
+ (void)j_warningMessage:(NSString *)msg {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:nil];
[alert addAction:action];
[[self getCurrentVC].navigationController presentViewController:alert animated:YES completion:nil];
}
//获取当前屏幕显示的viewcontroller
+ (UIViewController *)getCurrentVC
{
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
return currentVC;
}
+ (UIViewController *)getCurrentVCFrom:(UIViewController *)rootVC
{
UIViewController *currentVC;
if ([rootVC presentedViewController]) {
// 视图是被presented出来的
rootVC = [rootVC presentedViewController];
}
if ([rootVC isKindOfClass:[UITabBarController class]]) {
// 根视图为UITabBarController
currentVC = [self getCurrentVCFrom:[(UITabBarController *)rootVC selectedViewController]];
} else if ([rootVC isKindOfClass:[UINavigationController class]]){
// 根视图为UINavigationController
currentVC = [self getCurrentVCFrom:[(UINavigationController *)rootVC visibleViewController]];
} else {
// 根视图为非导航类
currentVC = rootVC;
}
return currentVC;
}
@end
......@@ -26,33 +26,32 @@ typedef NS_ENUM(NSInteger, STORYBOARD_TYPE_) {
};
/**
* 判断不能为空并提示
* 字符串/数组/
*
* @param obj 对象
* @param message 为空时提示信息
*/
#define kCanNotBeNil(obj, message) \
if (obj == nil) { \
[MBProgressHUD j_error:message complete:nil]; \
[MBProgressHUD j_warningMessage:message];; \
return; \
} \
if (obj == false) { \
[MBProgressHUD j_error:message complete:nil]; \
[MBProgressHUD j_warningMessage:message]; \
return; \
} \
if ([obj isKindOfClass:[NSString class]]) { \
NSString *string = (NSString *) obj; \
NSString *temp = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; \
if ([temp length] == 0) { \
[MBProgressHUD j_error:message \
complete:nil]; \
[MBProgressHUD j_warningMessage:message]; \
return; \
} \
} \
if ([obj isKindOfClass:[NSArray class]]) { \
NSArray *array = (NSArray *) obj; \
if (array.count == 0) { \
[MBProgressHUD j_error:message complete:nil]; \
[MBProgressHUD j_warningMessage:message]; \
return; \
} \
}
......
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface MMGridCell : UICollectionViewCell
@property (nonatomic, strong) UILabel *textLabel;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MMGridCell.h"
@implementation MMGridCell
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
CGRect rect = CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height);
_textLabel = [[UILabel alloc] initWithFrame:rect];
_textLabel.backgroundColor = [UIColor clearColor];
_textLabel.textAlignment = NSTextAlignmentCenter;
_textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_textLabel.font = [UIFont boldSystemFontOfSize:17];
_textLabel.numberOfLines = 0;
[self.contentView addSubview:_textLabel];
}
return self;
}
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
if (selected) {
[self.contentView setBackgroundColor:[UIColor lightGrayColor]];
} else {
[self.contentView setBackgroundColor:[UIColor clearColor]];
}
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface MMLeftColumnCell : UICollectionViewCell
@property (nonatomic, strong) UILabel *textLabel;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MMLeftColumnCell.h"
@implementation MMLeftColumnCell
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
CGRect rect = CGRectMake(10.0f, 0.0f, frame.size.width-20.0f, frame.size.height);
_textLabel = [[UILabel alloc] initWithFrame:rect];
_textLabel.backgroundColor = [UIColor clearColor];
_textLabel.font = [UIFont boldSystemFontOfSize:14.0f];
_textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.contentView addSubview:_textLabel];
}
return self;
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
/**
`MMGridLayout` provides the grid layout of cells for the spreadsheet.
Code for the layout was inspired by https://github.com/mattlangtree/grid-view-csv
*/
@interface CustomMMGridLayout : UICollectionViewLayout
///---------------------------------------
/// @name Accessing Layout Properties
///---------------------------------------
/**
The size for each cell in the grid.
@discussion This will be set either by `MMSpreadsheetView` or `MMGridLayout` using a delegate call to collectionView:layout:sizeForItemAtIndexPath: via the `setItemSize:` method. The layout is invalidated when the itemSize is changed.
*/
@property (nonatomic, assign) CGSize itemSize;
/**
The space between cells.
@discussion This allows for setting the spacing between cells. Lines are not drawn, but show the background of the collection view. The layout is invalidated when the cellSpacing is changed. Default is 1.
*/
@property (nonatomic, assign) CGFloat cellSpacing;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "CustomMMGridLayout.h"
#import "CustomMMSpreadsheetView.h"
@interface CustomMMGridLayout ()
@property (nonatomic, assign) NSInteger gridRowCount;
@property (nonatomic, assign) NSInteger gridColumnCount;
@property (nonatomic, assign) BOOL isInitialized;
@end
@implementation CustomMMGridLayout
- (id)init {
self = [super init];
if (self) {
_cellSpacing = 1.0f;
_itemSize = CGSizeMake(120.0f, 120.0f);
}
return self;
}
- (void)setItemSize:(CGSize)itemSize {
_itemSize = CGSizeMake(itemSize.width + self.cellSpacing, itemSize.height + self.cellSpacing);
[self invalidateLayout];
}
- (void)setCellSpacing:(CGFloat)cellSpacing {
_cellSpacing = cellSpacing;
[self invalidateLayout];
}
- (void)prepareLayout {
[super prepareLayout];
self.gridRowCount = [self.collectionView numberOfSections];
self.gridColumnCount = [self.collectionView numberOfItemsInSection:0];
if (!self.isInitialized) {
id<UICollectionViewDelegateFlowLayout> delegate = (id)self.collectionView.delegate;
CGSize size = [delegate collectionView:self.collectionView
layout:self
sizeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
self.itemSize = size;
self.isInitialized = YES;
}
}
- (CGSize)collectionViewContentSize {
if (!self.isInitialized) {
[self prepareLayout];
}
CGSize size = CGSizeMake(self.gridColumnCount * self.itemSize.width, self.gridRowCount * self.itemSize.height);
return size;
}
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSMutableArray *attributes = [NSMutableArray array];
NSUInteger startRow = floorf(rect.origin.y / self.itemSize.height);
NSUInteger startCol = floorf(rect.origin.x / self.itemSize.width);
NSUInteger endRow = MIN(self.gridRowCount - 1, ceilf(CGRectGetMaxY(rect) / self.itemSize.height));
NSUInteger endCol = MIN(self.gridColumnCount - 1, ceilf(CGRectGetMaxX(rect) / self.itemSize.width));
NSParameterAssert(self.gridRowCount > 0);
NSParameterAssert(self.gridColumnCount > 0);
for (NSUInteger row = startRow; row <= endRow; row++) {
for (NSUInteger col = startCol; col <= endCol; col++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:col inSection:row];
UICollectionViewLayoutAttributes *layoutAttributes = [self layoutAttributesForItemAtIndexPath:indexPath];
[attributes addObject:layoutAttributes];
}
}
return attributes;
}
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attributes.frame = CGRectMake(indexPath.item * self.itemSize.width, indexPath.section * self.itemSize.height, self.itemSize.width-self.cellSpacing, self.itemSize.height-self.cellSpacing);
return attributes;
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return NO;
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
/**
`MMGridLayout` provides the grid layout of cells for the spreadsheet.
Code for the layout was inspired by https://github.com/mattlangtree/grid-view-csv
*/
@interface MMGridLayout : UICollectionViewLayout
///---------------------------------------
/// @name Accessing Layout Properties
///---------------------------------------
/**
The size for each cell in the grid.
@discussion This will be set either by `MMSpreadsheetView` or `MMGridLayout` using a delegate call to collectionView:layout:sizeForItemAtIndexPath: via the `setItemSize:` method. The layout is invalidated when the itemSize is changed.
*/
@property (nonatomic, assign) CGSize itemSize;
/**
The space between cells.
@discussion This allows for setting the spacing between cells. Lines are not drawn, but show the background of the collection view. The layout is invalidated when the cellSpacing is changed. Default is 1.
*/
@property (nonatomic, assign) CGFloat cellSpacing;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MMGridLayout.h"
#import "MMSpreadsheetView.h"
@interface MMGridLayout ()
@property (nonatomic, assign) NSInteger gridRowCount;
@property (nonatomic, assign) NSInteger gridColumnCount;
@property (nonatomic, assign) BOOL isInitialized;
@end
@implementation MMGridLayout
- (id)init {
self = [super init];
if (self) {
_cellSpacing = 1.0f;
_itemSize = CGSizeMake(120.0f, 120.0f);
}
return self;
}
- (void)setItemSize:(CGSize)itemSize {
_itemSize = CGSizeMake(itemSize.width + self.cellSpacing, itemSize.height + self.cellSpacing);
[self invalidateLayout];
}
- (void)setCellSpacing:(CGFloat)cellSpacing {
_cellSpacing = cellSpacing;
[self invalidateLayout];
}
- (void)prepareLayout {
[super prepareLayout];
self.gridRowCount = [self.collectionView numberOfSections];
self.gridColumnCount = [self.collectionView numberOfItemsInSection:0];
if (!self.isInitialized) {
id<UICollectionViewDelegateFlowLayout> delegate = (id)self.collectionView.delegate;
CGSize size = [delegate collectionView:self.collectionView
layout:self
sizeForItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]];
self.itemSize = size;
self.isInitialized = YES;
}
}
- (CGSize)collectionViewContentSize {
if (!self.isInitialized) {
[self prepareLayout];
}
CGSize size = CGSizeMake(self.gridColumnCount * self.itemSize.width, self.gridRowCount * self.itemSize.height);
return size;
}
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSMutableArray *attributes = [NSMutableArray array];
NSUInteger startRow = floorf(rect.origin.y / self.itemSize.height);
NSUInteger startCol = floorf(rect.origin.x / self.itemSize.width);
NSUInteger endRow = MIN(self.gridRowCount - 1, ceilf(CGRectGetMaxY(rect) / self.itemSize.height));
NSUInteger endCol = MIN(self.gridColumnCount - 1, ceilf(CGRectGetMaxX(rect) / self.itemSize.width));
NSParameterAssert(self.gridRowCount > 0);
NSParameterAssert(self.gridColumnCount > 0);
for (NSUInteger row = startRow; row <= endRow; row++) {
for (NSUInteger col = startCol; col <= endCol; col++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:col inSection:row];
UICollectionViewLayoutAttributes *layoutAttributes = [self layoutAttributesForItemAtIndexPath:indexPath];
[attributes addObject:layoutAttributes];
}
}
return attributes;
}
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attributes.frame = CGRectMake(indexPath.item * self.itemSize.width, indexPath.section * self.itemSize.height, self.itemSize.width-self.cellSpacing, self.itemSize.height-self.cellSpacing);
return attributes;
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
return NO;
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
/**
This category renames section and row values from NSIndexPath to reduce confusion when referring to a particular cell in a `MMSpreadsheetView`.
*/
@interface NSIndexPath (MMSpreadsheetView)
/**
The column value of an `NSIndexPath`.
*/
- (NSInteger)mmSpreadsheetColumn;
/**
The row value of an `NSIndexPath`.
*/
- (NSInteger)mmSpreadsheetRow;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "NSIndexPath+MMSpreadsheetView.h"
@implementation NSIndexPath (MMSpreadsheetView)
- (NSInteger)mmSpreadsheetRow {
return self.section;
}
- (NSInteger)mmSpreadsheetColumn {
return self.row;
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface MMTopRowCell : UICollectionViewCell
@property (nonatomic, strong) UILabel *textLabel;
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MMTopRowCell.h"
@implementation MMTopRowCell
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
CGRect rect = CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height);
_textLabel = [[UILabel alloc] initWithFrame:rect];
_textLabel.backgroundColor = [UIColor clearColor];
_textLabel.textAlignment = NSTextAlignmentCenter;
_textLabel.numberOfLines = 2;
_textLabel.font = [UIFont boldSystemFontOfSize:16.0f];
_textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.contentView addSubview:_textLabel];
}
return self;
}
@end
// Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface MMViewController : UIViewController
@property (nonatomic, strong) NSMutableArray *tableData;
- (void)reloadData;
@end
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment