<殊途公寓>项目总结

2017.06.01-2017.07.15

扩大UIButton的点击范围

CGFloat const touchSize = 44; //苹果官方默认44,小于44则为弱反应
CGFloat const sizeMax   = - .5;

@implementation YFWLButton //继承UIButton的一个自定义类
///扩大点击范围
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
    CGRect bounds   = self.bounds;
    CGFloat width   = MAX(touchSize - bounds.size.width, 0);
    CGFloat height  = MAX(touchSize - bounds.size.height, 0);
    bounds = CGRectInset(bounds, sizeMax * width, sizeMax * height);
    return CGRectContainsPoint(bounds, point);
}

操作NSDate的自定义类方法

自定义类方法的.h文件

#import <Foundation/Foundation.h>

@interface YFWLDateManager : NSObject

/**获取day*/
+ (NSInteger)day:(NSDate *)date;
/**获取Month*/
+ (NSInteger)month:(NSDate *)date;
/**获取year*/
+ (NSInteger)year:(NSDate *)date;
/**获取第一天是在第几天*/
+ (NSInteger)firstWeekdayInThisMonth:(NSDate *)date;
/**获取月数总天数*/
+ (NSInteger)totaldaysInThisMonth:(NSDate *)date;
/**获取月份总天数*/
+ (NSInteger)totaldaysInMonth:(NSDate *)date;
/**获取上一个月*/
+ (NSDate *)lastMonth:(NSDate *)date;
/**获取下一个月*/
+ (NSDate*)nextMonth:(NSDate *)date;
/**时间戳转换为时间*/
+ (NSString *) timestampConversionDate:(NSInteger)time Format:(NSString *)format;
/**字符串转换为时间*/
+ (NSDate *) stringConversionDate:(NSString *)dateStr Format:(NSString *)format;
/**时间转换为字符串*/
+ (NSString *) dateConversionString:(NSDate *)date Format:(NSString *)format;

@end

自定义类方法的.m文件

#import "YFWLDateManager.h"

@implementation YFWLDateManager

#pragma mark - 日历方法
+ (NSInteger)day:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components day];
}

+ (NSInteger)month:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components month];
}

+ (NSInteger)year:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components year];
}

+ (NSInteger)firstWeekdayInThisMonth:(NSDate *)date{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    
    [calendar setFirstWeekday:1];//1.Sun. 2.Mon. 3.Thes. 4.Wed. 5.Thur. 6.Fri. 7.Sat.
    NSDateComponents *comp = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    [comp setDay:1];
    NSDate *firstDayOfMonthDate = [calendar dateFromComponents:comp];
    
    NSUInteger firstWeekday = [calendar ordinalityOfUnit:NSCalendarUnitWeekday inUnit:NSCalendarUnitWeekOfMonth forDate:firstDayOfMonthDate];
    return firstWeekday - 1;
}

+ (NSInteger)totaldaysInThisMonth:(NSDate *)date{
    NSRange totaldaysInMonth = [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date];
    return totaldaysInMonth.length;
}

+ (NSInteger)totaldaysInMonth:(NSDate *)date{
    NSRange daysInLastMonth = [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date];
    return daysInLastMonth.length;
}

+ (NSDate *)lastMonth:(NSDate *)date{
    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    dateComponents.month = -1;
    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    return newDate;
}

+ (NSDate*)nextMonth:(NSDate *)date{
    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    dateComponents.month = +1;
    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    return newDate;
}

///时间戳转换为时间
+ (NSString *) timestampConversionDate:(NSInteger)time Format:(NSString *)format{
    NSDate *date=[NSDate dateWithTimeIntervalSince1970:time];
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSString *timeStr=[dateformatter stringFromDate:date];
    return timeStr;
}

///字符串转换为时间
+ (NSDate *) stringConversionDate:(NSString *)dateStr Format:(NSString *)format{
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSDate *timeStr=[dateformatter dateFromString:dateStr];
    return timeStr;
}

///时间转换为字符串
+ (NSString *) dateConversionString:(NSDate *)date Format:(NSString *)format{
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSString *timeStr=[dateformatter stringFromDate:date];
    return timeStr;
}

自定义Excel的效果视图

达到效果

上下滚动时最上面一行保持不动,左右滚动时最左面一行保持不动,可以斜向滚动。
注:仅供参考,方法比较笨,抛砖引玉,希望大神指点

设计思路导图

思路导图.png

参考源码

#import "ZTFormViewController.h"
#import "ZTRoomInfoCollectionViewCell.h"
#import "ZTRoomTitleCollectionViewCell.h"
#import "ZTRoomFilterCollectionViewCell.h"

@interface ZTFormViewController ()<UICollectionViewDelegateFlowLayout, UICollectionViewDataSource,UIGestureRecognizerDelegate>

@property (nonatomic, strong) UIView *headView;
@property (nonatomic, strong) UIView *filterView;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *codeLabel;
@property (nonatomic, strong) UIScrollView *contentScrollView;   //内容容器
@property (nonatomic, strong) UICollectionView *topScrollView;    //头部滚动
@property (nonatomic, strong) UICollectionView *leftScrollView;   //左边滚动
@property (nonatomic, strong) UICollectionView *collectionView;   //内容视图

@property (nonatomic, strong) NSMutableArray *leftArray;//左边数组
@property (nonatomic, strong) NSMutableArray *infoArray;//数据数组
@property (nonatomic, strong) NSDate *currentDate;


@property (nonatomic, assign) CGPoint lastOffSet;
@property (nonatomic, assign) BOOL isApartment;
@property (nonatomic, strong) NSString *currentApartID;
@property (nonatomic, strong) NSString *currentHouseID;
@property (nonatomic, strong) NSString *currentMonth;
@property (nonatomic, strong) NSString *nextMonth;

@end

@implementation ZTFormViewController
{
    NSInteger _isNextMonth;
}

- (NSMutableArray *)leftArray {
    if (!_leftArray) {
        _leftArray = [[NSMutableArray alloc]init];
    }
    return _leftArray;
}

- (NSMutableArray *)infoArray {
    if (!_infoArray) {
        _infoArray = [[NSMutableArray alloc]init];
    }
    return _infoArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.currentDate = [NSDate date];
    self.isApartment = YES;
    _isNextMonth = 0;
    [self navigationBarSetting];
    [self setLabelFC];
    [self leftCollectionViewSetting];
    [self topCollectionViewSetting];
    [self scrollViewSetting];
    [self collectionViewSetting];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [YFWLHUDManager dismiss];
    _bgView.hidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark - 导航栏设计
- (void)navigationBarSetting {
    self.titleLable.text = @"房态";
    self.leftArray = [[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"", nil];
    self.view.backgroundColor = [UIColor appBackgroundColor];
    [self.leftButton setImage:[UIImage imageNamed:@"yf_1刷新"] forState:UIControlStateNormal];
    self.leftButton.size = CGSizeMake(Size(24), Size(24));
    self.leftButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
    [self addLeftButtonFouncation:@selector(leftButtonClick)];
}
- (void) leftButtonClick {
    
}

- (void) setLabelFC {
    self.codeLabel = [YFWLFactoryClass CreateLabel:@"房间/日期" FontSize:Size(14) FontColor:[UIColor appBlackTextColor] TextAligment:NSTextAlignmentCenter ToView:self.view];
    self.codeLabel.backgroundColor = [UIColor appHeadBgColor];
    [self.codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.view);
        make.width.mas_equalTo(Size(72));
        make.height.mas_equalTo(Size(44));
    }];
}

#pragma mark - 布局滚动视图
- (void) scrollViewSetting {
    self.contentScrollView = [[UIScrollView alloc]init];
    self.contentScrollView.showsVerticalScrollIndicator = NO;
    self.contentScrollView.showsHorizontalScrollIndicator = NO;
    self.contentScrollView.scrollEnabled = YES;
    self.contentScrollView.directionalLockEnabled = YES;
    self.contentScrollView.bounces = NO;
    self.contentScrollView.delegate = self;
    self.contentScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.contentScrollView];
    [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view);
        make.left.equalTo(self.topScrollView);
        make.top.equalTo(self.leftScrollView);
        make.bottom.equalTo(self.view).offset(-self.tabBarController.tabBar.height);
    }];
    
}

#pragma mark - CollectionView
- (void) collectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(52));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //创建collectionView
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,0,kMainScreenWidth,kMainScreenHeight) collectionViewLayout:flowLayout];
    self.collectionView.showsHorizontalScrollIndicator = NO;
    self.collectionView.showsVerticalScrollIndicator = NO;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    self.collectionView.scrollEnabled = NO;//appCuttingLineColor
    self.collectionView.backgroundColor = [UIColor appBackgroundColor];
    [self.contentScrollView addSubview:self.collectionView];
    
    //注册cell
    [self.collectionView registerClass:[ZTRoomInfoCollectionViewCell class] forCellWithReuseIdentifier:@"RoomInfoCell"];
}
- (void) topCollectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(44));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //创建collectionView
    self.topScrollView = [[UICollectionView alloc]initWithFrame:CGRectMake(Size(73),0,kMainScreenWidth,Size(44)) collectionViewLayout:flowLayout];
    self.topScrollView.showsHorizontalScrollIndicator = NO;
    self.topScrollView.showsVerticalScrollIndicator = NO;
    self.topScrollView.delegate = self;
    self.topScrollView.dataSource = self;
    self.topScrollView.scrollEnabled = NO;
    self.topScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.topScrollView];
    [self.topScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.codeLabel.mas_right).offset(1);
        make.top.equalTo(self.headView.mas_bottom);
        make.right.equalTo(self.view);
        make.height.mas_equalTo(Size(44));
    }];
    
    //注册cell
    [self.topScrollView registerClass:[ZTRoomTitleCollectionViewCell class] forCellWithReuseIdentifier:@"RoomTimeCell"];
}
- (void) leftCollectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(52));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //创建collectionView
    self.leftScrollView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,Size(45),Size(72),kMainScreenHeight) collectionViewLayout:flowLayout];
    self.leftScrollView.showsHorizontalScrollIndicator = NO;
    self.leftScrollView.showsVerticalScrollIndicator = NO;
    self.leftScrollView.delegate = self;
    self.leftScrollView.dataSource = self;
    self.leftScrollView.scrollEnabled = NO;
    self.leftScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.leftScrollView];
    [self.leftScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.top.equalTo(self.codeLabel.mas_bottom).offset(1);
        make.width.mas_equalTo(Size(72));
        make.bottom.equalTo(self.view).offset(-self.tabBarController.tabBar.height);
    }];
    
    //注册cell
    [self.leftScrollView registerClass:[ZTRoomTitleCollectionViewCell class] forCellWithReuseIdentifier:@"RoomNameCell"];
}

#pragma mark - collectionView代理
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    if (collectionView == self.collectionView) {
        NSInteger roomCount = self.leftArray.count;
        NSInteger day = [YFWLDateManager totaldaysInMonth:self.currentDate];
        self.contentScrollView.contentSize = CGSizeMake(Size(72)*day+day-1, Size(52)*(roomCount-1)+roomCount-1);
        self.collectionView.frame = CGRectMake(0,0,Size(72)*day+day-1,Size(52)*(roomCount)+roomCount-1);
        return roomCount*day;
    }
    if (collectionView == self.leftScrollView) {
        return self.leftArray.count;
    }
    return [YFWLDateManager totaldaysInMonth:self.currentDate];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (collectionView == self.leftScrollView) {
        ZTRoomTitleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomNameCell" forIndexPath:indexPath];
        cell.backgroundColor = [UIColor colorWithRGB:Color(FAFAFA)];
        if (self.leftArray.count > indexPath.row) {
            cell.roomNameLabel.text = @"大床房";
            cell.roomNumberLabel.text = @"520";
        }
        return cell;
    }
    if (collectionView == self.topScrollView) {
        ZTRoomTitleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomTimeCell" forIndexPath:indexPath];
        cell.userInteractionEnabled = NO;
        cell.backgroundColor = [UIColor appHeadBgColor];
        cell.roomNameLabel.font = [UIFont systemFontOfSize:Size(14)];
        cell.roomNameLabel.text = [self currentMD:indexPath];
        cell.roomNumberLabel.font = [UIFont systemFontOfSize:Size(12)];
        cell.roomNumberLabel.text = [self weekStr:[self currentMD:indexPath]];
        if ([[self weekStr:[self currentMD:indexPath]] isEqualToString:@"今天"]) {
            cell.roomNameLabel.textColor = [UIColor appMainColor];
            cell.roomNumberLabel.textColor = [UIColor appMainColor];
        }else {
            cell.roomNameLabel.textColor = [UIColor appGrayTextColor];
            cell.roomNumberLabel.textColor = [UIColor appGrayTextColor];
        }
        return cell;
    }
    
    ZTRoomInfoCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomInfoCell" forIndexPath:indexPath];
    NSInteger row = indexPath.row / [YFWLDateManager totaldaysInMonth:self.currentDate];
    if (row < self.leftArray.count) {
        [cell changeStatus:@""];
    }
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    self.lastOffSet = scrollView.contentOffset;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    if (scrollView == self.contentScrollView) {
        if (scrollView.contentOffset.x - self.lastOffSet.x != 0) {
            [self.topScrollView setContentOffset:CGPointMake(scrollView.contentOffset.x, 0)];
            
        }
        if (scrollView.contentOffset.y - self.lastOffSet.y != 0) {
            [self.leftScrollView setContentOffset:CGPointMake(0, scrollView.contentOffset.y)];
        }
    }
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    return UIEdgeInsetsMake(0, 0, 0, 0);
}

#pragma mark - 日期
- (NSString *) currentMD:(NSIndexPath *)indexPath {
    NSInteger day = (indexPath.row)%([YFWLDateManager totaldaysInMonth:self.currentDate])+1;
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:@"MM"];
    NSString *month = [dateformatter stringFromDate:self.currentDate];
    if (day < 10) {
        return [NSString stringWithFormat:@"%@-0%lu",month,day];
    }else {
        return [NSString stringWithFormat:@"%@-%lu",month,day];
    }
}
- (NSString *) weekStr:(NSString *)dateStr {
    //需要转换的字符串
    NSString *dateString = [NSString stringWithFormat:@"%lu-%@",[YFWLDateManager year:self.currentDate],dateStr];
    //设置转换格式
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
    [formatter setDateFormat:@"yyyy-MM-dd"];
    //NSString转NSDate
    NSDate *date=[formatter dateFromString:dateString];
    if ([dateString isEqualToString:[formatter stringFromDate:[NSDate date]]]) {
        return @"今天";
    }
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"EEE"];
    NSString *weekStr = [dateFormat stringFromDate:date];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
    NSString *currentLanguage = [languages objectAtIndex:0];
    if ([currentLanguage isEqualToString:@"zh_Hans"]) {
        NSString *weekRstr = [NSString stringWithFormat:@"周%@",[weekStr substringFromIndex:weekStr.length-1]];
        return weekRstr;
    }else {
        return weekStr;
    }
}

实现效果gif

实现效果.gif

日历的实现

效果图

效果图

核心方法

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 42;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    ZTPriceMgmCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PriceMgmCell" forIndexPath:indexPath];
    NSInteger daysInThisMonth = [YFWLDateManager totaldaysInMonth:_currentDate];
    NSInteger firstWeekday = [YFWLDateManager firstWeekdayInThisMonth:_currentDate];
    
    NSInteger day = 0;
    NSInteger i = indexPath.row;
    cell.topView.backgroundColor = [UIColor whiteColor];
    cell.boView.backgroundColor = [UIColor whiteColor];
    cell.selected = NO;
    if (i < firstWeekday) {
        [cell.dateLabel setText:@""];
        cell.userInteractionEnabled = NO;
        cell.boView.hidden = YES;
    }else if (i > firstWeekday + daysInThisMonth - 1){
        [cell.dateLabel setText:@""];
        cell.userInteractionEnabled = NO;
        cell.boView.hidden = YES;
    }else{
        day = i - firstWeekday + 1;
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"yyyy-MM-dd"];
        NSString *dayStr = [NSString stringWithFormat:@"%lu",day];
        [cell.dateLabel setText:dayStr];
        if (day < 10) {
            dayStr = [NSString stringWithFormat:@"0%lu",day];
        }
        NSInteger month = [YFWLDateManager month:self.currentDate];
        NSString *selectDate = [NSString stringWithFormat:@"%lu-%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
        if (month < 10) {
            selectDate = [NSString stringWithFormat:@"%lu-0%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
        }
        NSComparisonResult result = [[dateFormatter dateFromString:self.startDate] compare:[dateFormatter dateFromString:selectDate]];
        if (result == NSOrderedDescending) {
            cell.userInteractionEnabled = NO;
            cell.boView.hidden = YES;
        }else if (result == NSOrderedSame) {
            cell.userInteractionEnabled = NO;
            cell.boView.hidden = NO;
            cell.selected = YES;
            cell.priceLabel.text = @"开始";
            cell.priceLabel.textColor = [UIColor appMainColor];
        }else {
            cell.boView.hidden = YES;
        }
    }
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSInteger firstWeekday = [YFWLDateManager firstWeekdayInThisMonth:_currentDate];
    NSInteger day = 0;
    NSInteger i = indexPath.row;
    day = i - firstWeekday + 1;
    NSString *dayStr = [NSString stringWithFormat:@"%lu",day];
    if (day < 10) {
       dayStr = [NSString stringWithFormat:@"0%lu",day];
    }
    NSInteger month = [YFWLDateManager month:self.currentDate];
    NSString *selectDate = [NSString stringWithFormat:@"%lu-%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
    if (month < 10) {
        selectDate = [NSString stringWithFormat:@"%lu-0%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
    }
    NSComparisonResult result = [[dateFormatter dateFromString:self.startDate] compare:[dateFormatter dateFromString:selectDate]];
    if (result == NSOrderedDescending || result == NSOrderedSame) {
        [YFWLHUDManager showInfoMessage:@"不能小于或等于开始时间" duration:1.6];
    }else {
        if (self.ReverseValueBlock) {
            self.ReverseValueBlock(selectDate);
        }
        [self leftButtonClick];
    }
}

搜索框设计

- (void) setupSearchBar {
    
    self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, kMainScreenWidth-Size(50), Size(30))];
    self.searchBar.placeholder = @"手机号/订单号";
    [self.searchBar setValue:@"取消" forKey:@"_cancelButtonText"]; //取消设置为中文
    self.searchBar.keyboardType = UIKeyboardTypeDefault;
    self.searchBar.searchBarStyle = UISearchBarStyleProminent;
    self.searchBar.delegate = self;
    self.searchBar.tintColor = [UIColor whiteColor];
    self.searchBar.barTintColor = [UIColor appBackgroundColor];
    self.searchBar.returnKeyType = UIReturnKeySearch;
    UIView* backgroundView = [self.searchBar subViewOfClassName:@"_UISearchBarSearchFieldBackgroundView"];
    backgroundView.layer.cornerRadius = Size(15);
    backgroundView.clipsToBounds = YES;
    self.navigationItem.titleView = self.searchBar;
}

去除NSArray中的重复对象

NSArray *newArr = [oldArr valueForKeyPath:@“@distinctUnionOfObjects.self"];

防止离屏渲染为image添加圆角

// image分类
- (UIImage *)circleImage {
    // NO代表透明
    UIGraphicsBeginImageContextWithOptions(self.size, NO, 1);
    // 获得上下文
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    // 添加一个圆
    CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);
    // 方形变圆形
    CGContextAddEllipseInRect(ctx, rect);
    // 裁剪
    CGContextClip(ctx);
    // 将图片画上去
    [self drawInRect:rect];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

上线的问题综述

  • Does your application access any paid content?
    答: NO
  • Who is the target audience?
    答: 需要使用此工具的用户
  • How do users obtain an account?
    答: 一个用户注册一个账号,创建一个企业或油厂,此账号作为Agent账号
    答: 其他用户注册账号,申请加入到一个企业或油厂,Agent 审核是否同意此账号加入,并给予分配角色
  • Is this app meant for internal distribution in your own company, in the company of one target client, or in multiple target clients’ companies?
    答: in the company of one target client
  • In which countries will this app primarily be distributed?
    答: 中国
  • If this app is meant for internal distribution, will the app be accessible by both internal and external partners? Or will it be exclusive to in-house employees?
    答: both internal and external partners by adding them to a project group
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,298评论 4 360
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,701评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,078评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,687评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,018评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,410评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,729评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,412评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,124评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,379评论 2 242
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,903评论 1 257
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,268评论 2 251
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,894评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,014评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,770评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,435评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,312评论 2 260

推荐阅读更多精彩内容